[Openal-devel] Using C++ in ALUT?

Chris Robinson chris.kcat at gmail.com
Sun Jun 1 20:36:14 PDT 2008


I'm curious about the thought of using C++ in ALUT. It's wouldn't be a 
compulsory addition, but I'm thinking something along the lines of making it 
a bit more C++ friendly out of the box.

For instance, with a proposed streaming API, in C you would have an opaque 
object:
alutStream *stream = alutCreateStreamFromFile("somefile.ogg");

alutPlayStreamOnSource(stream, sourceID);
while(alutStreamIsPlaying(stream))
    alutPollStream(stream);
alutDestroyStream(stream);

while in C++, you would optionally have an opaque interface:
alutStream *stream = alutCreateStreamFromFile("somefile.ogg");

stream->PlayOnSource(sourceID);
while(stream->IsPlaying())
    stream->Poll();
delete stream;

You would still have the ability to use the C functions in C++ if you needed, 
but I think such a C++ interface would be more welcoming to C++ users. The 
only issue would be that to properly do it, the implementation must be C++ 
and the C functions would call the C++ methods. This can be done without 
making a dependancy on libstdc++, though..

Thoughts?


More information about the Openal-devel mailing list