0
0

I’m trying to figure out how to play multiple sounds at once, say for example I’m playing an mp3 as background music and I want to play a wav for a sound effect. How do I do that without stoping the mp3 first?

If it helps here’s my code so far.
[code:xk6hr0wu]
void CFmodTestDlg::OnButton1()
{

signed char test;

test=FSOUND_Init(65535, 32, FSOUND_INIT_USEDEFAULTMIDISYNTH);

 FSOUND_STREAM *Track1;

Track1 = FSOUND_Stream_OpenFile(".\\sounds\\track1.mp3",FSOUND_LOOP_NORMAL,0);

if(!Track1)
{
    CString str;
    str.Format("%s\n", FMOD_ErrorString(FSOUND_GetError()));
    MessageBox(str);
    exit(1);
}


FSOUND_Stream_Play(0,Track1);

}

void CFmodTestDlg::OnButton2()
{
// TODO: Add your control notification handler code here

signed char test;

test=FSOUND_Init(65535, 20, FSOUND_INIT_USEDEFAULTMIDISYNTH);

FSOUND_SAMPLE  *sound;

sound = FSOUND_Sample_Load(FSOUND_FREE ,".\\sounds\\sound.wav",FSOUND_LOOP_OFF,0);

if(!sound)
{
    CString str;
    str.Format("%s\n", FMOD_ErrorString(FSOUND_GetError()));
    MessageBox(str);
    exit(1);
}


FSOUND_PlaySound(0,sound);

}
[/code:xk6hr0wu]

  • You must to post comments
0
0

Use FSOUND_FREE as channel number with FSOUND_Stream_Play und FSOUND_PlaySound instead of 0.

  • You must to post comments
0
0

[quote:23e3sd2a]FSOUND_Init(65535…)[/quote:23e3sd2a]

BTW: Why do you set the outputrate to 65535 ?
A ‘normal’ output-rate should be set to 11025 22050 44100 48000, or am I wrong?

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.