I have an app that plays a wav loop in the background (16 seconds long) while loading, at random, other wavs in new sounds.
The other wavs are about 40 seconds long. When these are created, I have FMOD assign a new channel, start paused, set up the parameters (Volume, pan, etc…) and then unpause.
I made every sound a stream to conserve memory usage.
What I find is that when a new sound is played, there is a click/stutter/ehat have you from the background loop wav.
Changing buffer lengths/counts has no effect. If I load but do not unpause the random wavs, then the click is not heard.
I do not hear this when I pre-load the wavs, however, since I may need to play multiple copies of the same wav (and its streaming), I can not preload all wavs and so I’ve taken this approach of loading on demand.
Windows XP Pro SP2
Pentium 4, 2.53GHz
Sound Blaster PCI128
VB6 Development Environment
The whole time, the CPU utilization is less than 1%
- JasonG asked 13 years ago
The clicks seem to come from the Channel_SetFrequency changes that I make after playing the sound.
The sequency of events are:
2) PlaySound (start paused)
3) GetFrequency (to get the nominal frequency)
4) SetFrequency (to change to the settings for the random sample)
If I omit #4, no clicks (perceivable anyways).
However, I need to adjust the frequency to make the small sample base seem larger. Hope this helps in providing a suggestion/solution.
You were right that I was trying setDSPBufferSize. I tried the other two suggestions and they had no effect.
I started to think that maybe the random play samples had some discontinuous starts in the data so I applied a slight fade in on all the files and resaved them.
When I reran my app, the original click turned into a noticable silence when it went to play the files. I have seven possible files to choose from and I noticed that when it played the same file the second or later times that it was back to the slight click. This suggests that file caching is causing some delay in the file retrieval and FMOD playback is blocked during this delay. Perhaps you can look into creating this with large wav files (mine are 2 to 7 megabytes in length). The loop is 3 megabytes in length (all 44.1kHz/16bit/stereo).
I can provide the code if that will help.
Please login first to submit.