0
0

Hi,

The following code has worked before but is now causing me intermittant problems.

////////////////////////////////////////
bool SoundSystemInit()
{
while(!FSOUND_Init(22050,32,FSOUND_INIT_GLOBALFOCUS))
{
Sleep(100);
}

char fname[260];
for(int n=0;n<FX_NUMBER;n++)
{
fx[n]=NULL;
sprintf(fname,”fx%d0″,n);
fx[n]=FSOUND_Sample_Load(FSOUND_FREE,fname,FSOUND_NORMAL,0);
streamchan[n]=-1;
}

FSOUND_Sample_SetLoopMode(fx[FX_BONUS],FSOUND_LOOP_NORMAL);
FSOUND_Sample_SetLoopMode(fx[FX_ALIENCLOUD],FSOUND_LOOP_NORMAL);
fmBackground=FMUSIC_LoadSong(track);
FMUSIC_SetMasterVolume(fmBackground,g_nMusicVol);
FMUSIC_PlaySong(fmBackground);

return TRUE;
}

////////////////////////////////////////////
void SoundSystemTerminate()
{
for(int n=0;n<FX_NUMBER;n++)
{
FSOUND_Sample_Free(fx[n]);
}
FMUSIC_StopSong(fmBackground);
FMUSIC_FreeSong(fmBackground);
FSOUND_Close();
}

But sometimes on exiting (calling SoundSystemTerminate) the music continues playing. Could somebody tell me why?

Thanks in advance
Bad

  • You must to post comments
0
0

Hello again,

The board did not seem to like my code, so here it is again:-

[CODE]
bool SoundSystemInit()
{
while(!FSOUND_Init(22050,32,FSOUND_INIT_GLOBALFOCUS))
{
Sleep(100);
}

char fname[260];
for(int n=0;n<FX_NUMBER;n++)
{
fx[n]=NULL;
sprintf(fname,”fx%d0″,n);
fx[n]=FSOUND_Sample_Load(FSOUND_FREE,fname,FSOUND_NORMAL,0);
streamchan[n]=-1;
}

FSOUND_Sample_SetLoopMode(fx[FX_BONUS],FSOUND_LOOP_NORMAL);
FSOUND_Sample_SetLoopMode(fx[FX_ALIENCLOUD],FSOUND_LOOP_NORMAL);
fmBackground=FMUSIC_LoadSong(track);
FMUSIC_SetMasterVolume(fmBackground,g_nMusicVol);
FMUSIC_PlaySong(fmBackground);

return TRUE;
}

////////////////////////////////////////////
void SoundSystemTerminate()
{
for(int n=0;n<FX_NUMBER;n++)
{
FSOUND_Sample_Free(fx[n]);
}
FMUSIC_StopSong(fmBackground);
FMUSIC_FreeSong(fmBackground);
FSOUND_Close();
}
</CODE]
But sometimes on exiting (calling SoundSystemTerminate) the music continues playing. Could somebody tell me why?

Thanks in advance
Bad

  • You must to post comments
0
0

I give up with the bulletin board!!!

I’m logged in, I have tried to use the BBcode and it won’t let me edit all of my original post.

Anyway

There are two loops in the code, they work. It is the FMOD stuff that maybe causing me problems

Thanks in advance
Bad

  • You must to post comments
0
0

I’ll second that :smile:

I have been testing my new game with the pre-release version for the past 12 hours and all is very well.

Thanks again Brett, money well spent.

Bad

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.