[Openal-devel] Using C++ in ALUT?
Killian De Volder
killian.de.volder at scarlet.be
Sun Jun 1 23:23:01 PDT 2008
IMO,
Depends on who "owns" the code .
But you could wrap it (and don't compile it, but offer it as a header
(so you don't get overhead)) :
Ow and we'd need a new standard to allow this (otherwise it will not
work on all openal implementations) very important !!!
namespace OpenAl{
class Stream{
public:
Stream(std::string file){
alutStream *stream =
alutCreateStreamFromFile("somefile.ogg");
}
bool IsPlaying(){ return alutStreamIsPlaying(stream)}
private:
alutStream *stream;
}
}
...
You get the idea :)
Performance overhead ? 1 function call worst case.
Is it standard ??? HELL NO !!! (We'd need a new standard from it, (can't
stress it enough :D ) ).
(That's my 2 cents)
Killian
> 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?
> _______________________________________________
> Openal-devel mailing list
> Openal-devel at opensource.creative.com
> http://opensource.creative.com/mailman/listinfo/openal-devel
>
>
More information about the Openal-devel
mailing list