[Openal-devel] Using C++ in ALUT?
Sherief N. Farouk
sherief at mganin.com
Mon Jun 2 06:18:59 PDT 2008
I second the ownership opinion. I'd love to have a C++ interface, but
that'll need its own ARB-like entity to guarantee consistency. The C++ layer
would be thin (and inline-able, I believe) enough not to pose any
performance issues.
- Sherief
> -----Original Message-----
> From: openal-devel-bounces at opensource.creative.com [mailto:openal-
> devel-bounces at opensource.creative.com] On Behalf Of Killian De Volder
> Sent: Monday, June 02, 2008 2:23 AM
> To: Chris Robinson
> Cc: openal-devel at opensource.creative.com
> Subject: Re: [Openal-devel] Using C++ in ALUT?
>
> 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
> >
> >
>
> _______________________________________________
> 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