Playing theora's movie sound with OgreOgg

okasugandi

20-03-2010 15:48:06

Hello stickymango,
I would like to seek help from you,
I have implemented both OgreOgg and OgreTheora well, I have succeeded playing movie in my application, but I have a problem producing the sound from the movie.

From the documentation of OgreTheora, OgreTheora will call this listener function:

//! A function that the TheoraVideoClip object calls once more audio packets are decoded
/*!
\param data contains one or two channels of float PCM data in the range [-1,1]
\param nSamples contains the number of samples that the data parameter contains in each channel
*/
virtual void insertData(float** data,int nSamples)=0;

every frame if i am not mistaken.

The problem is, with just a pair of float** and int, how I can play this sound? Can I use OgreOgg to play this?

Thank you stickymango for your help!

Nb. I posted this message in OgreOgg forum not in Theora forum because I think the Theora's author (Kreso) have made the interface to play the sound with above function, and how the sound is being played is up to the user.

Kreso

21-03-2010 13:56:46

Take a look at this file: http://libtheoraplayer.svn.sourceforge. ... p?view=log

there you'll find an example how to use the ogre video plugin's PCM data for playback via OpenAL. I'm not sure what OgreOGGSound uses for playback, but since you have PCM data from the playing video, it should be easy enough to implement.

stickymango

22-03-2010 10:45:50

At present there is no method to pipe raw audio data into or extract out of an OgreOggSound sound, so you would have to handle this yourself using OpenAL directly. At present OgreOggSound doesn't support float format PCM sounds.

Kreso

22-03-2010 10:49:34

I checked ogreoggsound a bit and indeed it uses OpenAL. so as far as ogre theora is concerned, you can use the stock openal interface to pipe sound

okasugandi

23-03-2010 02:36:07

Thanks for your help Kreso and StickyMango.

I tried to make a new class that implements OgreOggISound and Theora's Audio stream, but I stucked :(, I think my skill in OpenAL is very low so I got confused much :(.

Then my solution is: I will use the Theora's sample implementation of decoding sound, side by side with OgreOgg then. I hope both of them are not conflicting each other. :)

Kreso

23-03-2010 07:54:07

It should work okay. the audio interface uses one source only, unless OgreOggSound uses all available sources, it should be ok.

stickymango

23-03-2010 10:31:06

That should be fine, OgreOggSound uses sources as and when it needs them.

okasugandi

25-03-2010 15:10:36

Kreso and Stickymango,

I have implemented both the OgreOgg and the Audio Interface side by side, and everything's working very well. Thank you very much for all of your help.

stickymango

25-03-2010 21:31:44

Excellent :)