Hello
Well I managed to look a bit more at the plugin using openal. I have one question though concerning the update of the audio stream. How to update the audio stream and make sure that it is synchronised with the video. I guess my problems could be linked with that. For the video, I call mClip->blitFrameCheck() At the moment I have an mAudioClip->update() function called every frame too.
void AudioClip::update()
{
//Every time through - check for empty que's and fill them
int processed = 0;
alGetSourcei( stream_source, AL_BUFFERS_PROCESSED, &processed );
while(processed--)
{
//Ogre::LogManager::getSingleton().logMessage("bool AudioClip::frameStarted()****");
ALuint buffer;
unsigned int numRead = outFIFO.read( mAudioBuffer, stream_size );
if( numRead < stream_size )
{
//No Data was read at all, hopefully next time we will have some
if( numRead == 0 )
{
//Ogre::LogManager::getSingleton().logMessage("bool AudioClip::frameStarted() AudioLow");
break;
}
//Ogre::LogManager::getSingleton().logMessage("bool AudioClip::frameStarted()$$$");
//In case we ran out of data, insert audio
//XXX: Should adjust stream time for inserted blank
unsigned int temp = stream_size - numRead;
memset( mAudioBuffer + numRead, 0, temp );
alSourceUnqueueBuffers(stream_source, 1, &buffer);
alBufferData( buffer, stream_format, mAudioBuffer, stream_size, stream_rate );
alSourceQueueBuffers(stream_source, 1, &buffer);
break;
}
alSourceUnqueueBuffers(stream_source, 1, &buffer);
alBufferData( buffer, stream_format, mAudioBuffer, stream_size, stream_rate );
alSourceQueueBuffers(stream_source, 1, &buffer);
}
int state = 0;
alGetSourcei(stream_source, AL_SOURCE_STATE, &state);
if ( state != AL_PLAYING )
{
alGetSourcei(stream_source, AL_BUFFERS_PROCESSED, &processed);
alSourcePlay(stream_source);
}
}
Which is exactly the same that you used in the old version of the plugin with openal. I had a look on the new fmod version but it is quite different (use a CustomStreamCallBack). Even if now I have improved my knowledge of openal, i do not have the time to do the same with fmod. Is it the correct way to update the audio ?
I am update myself the rendering using:
bool COgre::Render(){
if(!mRoot->_fireFrameStarted())
return false;
mRoot->_updateAllRenderTargets();
if(!mRoot->_fireFrameEnded())
return false;
return true;
}
Well thanks a lot for your help.