0
0

I thought I read somewhere in the docs or on this forum that FMOD’s stream sentencing should automatically update the frequency as each substream is playing. (Edit: here’s where i read it: [url:1ao7nsih]http://www.fmod.org/forum/viewtopic.php?t=2221&highlight=fsoundstreamsetbuffersize[/url:1ao7nsih] – “…all sentencing does is do a file seek and update the name field and frequency when it switches over.”)

I’m playing a sentence comprised of four substreams, 3 are @ 22050Hz, 1 is @ 16000Hz. The problem is that the frequency of the first substream that plays is used to play all the other substreams as well. i.e. If the 16kHz substream is played first, the all the 22.05KHz substreams will be played at 16KHz.

I’ve used to FSOUND_Sample_GetDefaults() and FSOUND_SetFrequency() as a workaround and it plays fine, but yeah – I thought FMOD was supposed to take care of this?

I’m using FMOD 3.74.

  • You must to post comments
0
0

I am encountering a problem implementing the workaround. It seems that having a mixed-frequency sentence might mess up the FSOUND_Stream_GetTime() function.

In order to detect when to change the frequency of the stream’s channel I wait for FSOUND_Stream_GetTime() to return a value that is less than the value it returned in the prior frame (call this test T(f) < T(f-1)). This method of detecting when a substream has finished playing works fine for sentences comprised of samples will all the same frequency, but in the case of a sentence with two different frequencies it goes awry. It’s difficult to describe what happens but i’ll give it a go…

My test sentence is as follows:

[code:lw2l5vpr]
// All sounds except SOUND5_16k are 22.05kHz.
int sampleIndices[6] = { SOUND1, SOUND2, SOUND3, SOUND4, SOUND5_16k, SOUND6 };[/code:lw2l5vpr]

The frequency change works fine when SOUND5_16k begins playing, but towards the end of that sound T(f) < T(f-1) becomes true (and T(f) is nowhere near 0, it’s around 700), a few moments later the test is true again (this time T(f) is small as you would expect) and SOUND6 plays normally. The result is that the last few moments of SOUND5_16k are played at the wrong frequency.

Is this a bug? Is there a better way I can detect when the current substream changes (I can’t use the name since that changes when the new substream begins buffering, not when it begins playing).

Thanks a lot.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.