[Openal-devel] FreeALUT stream proof-of-concept

Sherief N. Farouk sherief at mganin.com
Sun Jun 8 16:39:20 PDT 2008


> 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).

[Sherief N. Farouk] 

Why's that? Why not a base class with overridable, virtual functions? You do
know the concrete type anyway, which is a stream-from-file, so why not give
it a natural C++ syntax rather than a C-like bridge? There's an actual
function doing the work anyway, the only difference here is including it in
the constructor.

> > 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.

[Sherief N. Farouk] 

Why would you need to override the new operator? I think you have this bit
mixed up. You override new to provide your own allocations. You can make
alut::stream transparently call anything you want, by placing that call in
the constructor.

> > 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).

[Sherief N. Farouk] 

Wouldn't mind that at all. I'm talking from a pure C++ perspective here.

- Sherief



More information about the Openal-devel mailing list