Fixed: Update audio mixer during buffer streaming in streaming sample

This commit is contained in:
kaetemi 2012-04-10 00:05:01 +02:00
parent d229915603
commit 14242f73c6

View file

@ -367,6 +367,7 @@ static void initSample()
string sample = SAMPLE_OGG; string sample = SAMPLE_OGG;
s_AudioDecoder = IAudioDecoder::createAudioDecoder(sample, false, false); s_AudioDecoder = IAudioDecoder::createAudioDecoder(sample, false, false);
s_StreamSource->setFormat(s_AudioDecoder->getChannels(), s_AudioDecoder->getBitsPerSample(), (uint32)s_AudioDecoder->getSamplesPerSec()); s_StreamSource->setFormat(s_AudioDecoder->getChannels(), s_AudioDecoder->getBitsPerSample(), (uint32)s_AudioDecoder->getSamplesPerSec());
s_StreamSource->setPitch(2.0f);
} }
//CMutex *s_Mutex = NULL; //CMutex *s_Mutex = NULL;
@ -413,6 +414,7 @@ static void runSample()
return; return;
} }
bufferMore(bytes); bufferMore(bytes);
s_AudioMixer->update();
//if (!s_StreamSource->asUSource()->isst) //if (!s_StreamSource->asUSource()->isst)
//{ //{
// printf("*!playing!*"); // printf("*!playing!*");
@ -424,6 +426,7 @@ static void runSample()
while (s_StreamSource->hasFilledBuffersAvailable()) while (s_StreamSource->hasFilledBuffersAvailable())
{ {
nlSleep(40); nlSleep(40);
s_AudioMixer->update();
} }
s_StreamSource->stop(); s_StreamSource->stop();