0
0

I have two sounds that I want to be able to play simultaneously. The first sound is a continuous sound, while the second is a non continuous sound played in a thread and repeated in a loop together with a sleep function. When I try to play them together, the first sound is cut off every time the second is sounded.

The variables is defined as following

FMOD_CHANNEL *channel[5];
FMOD_SOUND *sound[5];
FMOD_SYSTEM *system;

and the sounds like this

result = FMOD_System_CreateStream(system, "g-h-loop.wav", FMOD_HARDWARE | FMOD_LOOP_NORMAL | FMOD_2D, 0, &sound[0]);
result = FMOD_System_CreateSound(system, "tampura.wav", FMOD_SOFTWARE | FMOD_LOOP_OFF, 0, &sound[1]);

and they are played like this.

result = FMOD_System_PlaySound(systemx, FMOD_CHANNEL_FREE, sound[0], 0, &channel[0]);
result = FMOD_System_PlaySound(systemx, FMOD_CHANNEL_FREE, sound[1], 0, &channel[1]);

To me this looks quite straightforward. So I wonder what could be wrong.

I will be grateful for any help.

  • You must to post comments
0
0

I found that it helps a little to use the update system function. But I am uncertain whether I use it in the right way. I first placed it in the loop in the thread, and it worked fine, but then I read that it should only be used in the main thread, which I believe must be in the WndProc. It is also said in the FMOD manual that the update system function should be used once per ‘game’ tick, or once per frame, in an application, but I have difficulty to find out what a "game tick" or a "frame" in this context means. For now, I use the system update every time I play a sound in a new frequency, as by the following. But still I have problems with cutting off of sound.

[code:1lu0v2vd]
if (LOWORD(wParam) == 20) {

            result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound[0], 1, &channel[0]);
                FMOD_System_Update(system);         
                frequency = keyfrequency;
                FMOD_Channel_SetFrequency(channel[0], frequency);
                FMOD_Channel_SetPaused(channel[0], 0);               
      }

[/code:1lu0v2vd]

I would appreciate if someone could make some comments on this.

Sincerely

Keitel

  • You must to post comments
0
0

It seems that putting the max channels to 1024 in the system init, as suggested elsewhere in this forum, has solved the problem.

Sincerely

Ketil

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.