When I Use FMOD_NONBLOCKING Flag To Create Steam Sound,Call Releasesound Function cost long time

Hello Guys
Use FMOD_NONBLOCKING Flag To Create Steam Sound Duration 25s,when The Sound Openstate is FMOD_OPENSTATE_PLAYING I Call ReleaseSound to destroy it, ReleaseSound process stalling the main thread about 8ms,what can i do to avoid ReleaseSound talling the main thread?why does releasesound take so much time?@cameron-fmod

If the Stream is FMOD_OPENSTATE_PLAYING, the Sound::release call must wait until the stream thread has finished its current update pass before the stream can be safely released. To avoid any stall make sure you stop the stream first.

Hi mathew
Thank you reply ,I will judge whether the current state of sound is FMOD_OPENSTATE_READY If not, stop first and wait for FMOD_OPENSTATE_READY Release again, but there is a huge problem of thread consumption. What is the thread doing? Why is it consuming so much? There were about 50 sound in the system at that time.

To get some more information about how much CPU is being used by streaming, consider using System::getCPUUsage. If you have a lot of streaming content, consider loading some as FMOD_CREATECOMPRESSEDSAMPLE.

A post was split to a new topic: Pitch issues with 3D sounds

I used FMOD_CREATECOMPRESSEDSAMPLE to create sound, why to cost much CPU at the DSP process. Used the flag to creating sound should be hardware decoding, why use FMOD_CREATECOMPRESSEDSAMPLE the CPU cost is higher than not used it. The following are the results of my sound test using 50 different FSB Vorbis files, the sounds hadn’t stream sound.
used FMOD_CREATECOMPRESSEDSAMPLE:



used FMOD_CREATESAMPLE

When you play sounds as compressed samples your memory is lower because the audio data remains compressed in memory. CPU usage will be higher because chunks of the sound are decoded regularly on the CPU (there is no hardware offload for Vorbis). When you load as sample, the entire file is decoded up front, this uses a lot of memory but has very low runtime CPU cost.

thank you reply
if I want to support hardware decoded in Mobile Device (for example Qualcomm \ Kirin \ MTK \ IOS ), what should sound format?

There is no guaranteed hardware decoding available on mobile devices, you must use CPU decoding for most of your sounds. To support music playback, most phones can decode a single stream (mono or stereo) of AAC in hardware, that is all.