0
0

Hi,

Has anyone else noticed that occasionally FMOD_Sound_Release() seems to take ~10ms in some cases? The case I’m seeing this happen is with a sound that is using real time stitching.

I modified the real time stitch example to record the time it takes to release the sound. Here are the code modifications I made:

at the top of main i added this:

[code:2bcca7mu]
LARGE_INTEGER qpcFreq;

QueryPerformanceFrequency(&qpcFreq);

[/code:2bcca7mu]

and then in the loop i added this:

[code:2bcca7mu]
/*
Release the sound that isn’t playing any more.
*/
LARGE_INTEGER qpcStart, qpcEnd;
double flTimeMs;
unsigned int dwElapsed, dwStart = GetTickCount();
QueryPerformanceCounter(&qpcStart);
result = FMOD_Sound_Release(subsound[subsoundid]);
QueryPerformanceCounter(&qpcEnd);
dwElapsed = GetTickCount() – dwStart;
flTimeMs = 1000.0 * (((double)qpcEnd.QuadPart – (double)qpcStart.QuadPart) / (double)qpcFreq.QuadPart);
printf("Release took %d ticks qpc: %.3f ms\n", dwElapsed, flTimeMs);
ERRCHECK(result);
[/code:2bcca7mu]

The output looks like this for me:

[code:2bcca7mu]

Real-time stitching example. Copyright (c) Firelight Technologies 2004-2008.

Press space to pause, Esc to quit

Inserted subsound 0 / 2 with sound 0 / 32
Inserted subsound 1 / 2 with sound 1 / 32
Release took 16 ticks qpc: 11.790 ms
Replacing subsound 0 / 2 with sound 2 / 32
Release took 15 ticks qpc: 5.422 ms
Replacing subsound 1 / 2 with sound 3 / 32
Release took 15 ticks qpc: 16.654 ms
Replacing subsound 0 / 2 with sound 4 / 32
Release took 16 ticks qpc: 12.863 ms
Replacing subsound 1 / 2 with sound 5 / 32
Release took 16 ticks qpc: 8.921 ms
Replacing subsound 0 / 2 with sound 6 / 32
Release took 15 ticks qpc: 8.923 ms
Replacing subsound 1 / 2 with sound 7 / 32
Release took 15 ticks qpc: 12.773 ms
Replacing subsound 0 / 2 with sound 8 / 32
Release took 16 ticks qpc: 12.820 ms
Replacing subsound 1 / 2 with sound 9 / 32
Release took 16 ticks qpc: 12.818 ms
[/code:2bcca7mu]

Could someone (fmod) please take a look at why this is so slow? Or else provide an alternative that is faster?

thanks,
sam

PS – I used both GetTickCount as well as qpc because GetTickCount has a notoriously low resolution.

  • You must to post comments
0
0

FMod guys? Any idea why release is taking so long, or any ideas how we can avoid this?

thanks,
sam

  • You must to post comments
0
0

If the stream is playing, you have to stop it first, then use getOpenState to make sure ‘streaming’ state is not set, then you can release the sound without fear of it blocking on a file read or mixer thread update which might be happening at the time.

  • You must to post comments
0
0

[quote="brett":368ifqwr]If the stream is playing, you have to stop it first, then use getOpenState to make sure ‘streaming’ state is not set, then you can release the sound without fear of it blocking on a file read or mixer thread update which might be happening at the time.[/quote:368ifqwr]

Could you incorporate some code into the real time stitching example to show exactly how this would be done?

Also, would it be possible for you guys to just do this internally? I’m not sure who or why you would actually want the FMOD_Sound_Release call to block for that much time under any circumstances..

thanks,
sam

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.