[Openal-devel] FreeALUT stream proof-of-concept
Chris Robinson
chris.kcat at gmail.com
Sun Jun 8 16:08:21 PDT 2008
On Sunday 08 June 2008 03:27:16 pm Sherief N. Farouk wrote:
> Regarding the line:
> stream = alutCreateStreamFromFile(argv[1], 8192, 4);
>
> Why not have that functionality in the constructor? The current way seems a
> bit too attached to C heritage.
Because the actual implementation declaration is never exported from the lib
(and currently, isn't even declared outside of the file it's in). Don't
forget, ALUTStream (which really should be ALUTstream to better match AL
type-naming) is a virtual interface with no implementation. The actual
implementation is a StreamImpl object, but the app uses it through the base
ALUTstream type. An app can't explicitly new an ALUTstream object because it
has pure virtuals (the compiler will throw an error).
> How about:
>
> stream = new alut::Stream(argv[1], 8192, 4);
Hmm. The main issue there would be overriding new just for that type. Is it
possible to make 'new alut::stream(a,b,c)' transparently
call 'alutCreateStreamFromFile(a,b,c)'? I've never played around with
overriding new before.
> Minor point: I vote for all lower-case class names (alut::stream VS
> Stream), ala STL. C++ aimed to make user-created types and native types on
> a similar ground, and most C++ de-facto libraries (Boost, for one) use that
> convention.
For C, I think it should be ALUTstream so it better matches AL's type-naming
(ALuint, ALboolean, etc). Though with a C++ alut namespace, I don't have an
issue with alut::stream being a mirror of ALUTstream (though it must be
possible that an ALUTstream* and a alut::stream* be interchangeable).
More information about the Openal-devel
mailing list