Exemple #1
0
int CSound::Loopsound(int soundnum)
{

	for(int i =1;i< int(FSOUND_GetMaxChannels);i++)
	{
		if(!FSOUND_IsPlaying(i))
		{
			FSOUND_PlaySound(i,FSOUND_Sample_Get(soundnum));
			FSOUND_SetLoopMode(i,FSOUND_LOOP_NORMAL);
			return i;
		}
	}
	return 0;
}
Exemple #2
0
//////////////////////////////////////////////////////////////////////////////////
//playsound plays a sound from the sound index. The sounds can only be played after
// they have been loaded into the sound index. returns the channel its played on
//////////////////////////////////////////////////////////////////////////////////
int CSound::Playsound(int soundnum)
{

	printf("Playing Sound\n");
	for(int i =1;i< int(FSOUND_GetMaxChannels);i++)
	{
		if(!FSOUND_IsPlaying(i))
		{
			FSOUND_PlaySound(i,FSOUND_Sample_Get(soundnum));
			return i;
		}
	}
	return 1;
}
void CAudioManager::StopSoundClip(int id){
  if(FSOUND_IsPlaying(id)==true)
    FSOUND_StopSound(id);
  return;

  if(m_bValidAudio == false)
    return;
  FSOUND_SAMPLE *handle;
  for(int i = 0; i < m_AudioClip.size(); i++){
    if(m_AudioClip[i].AudioID == id){
      for(int j=0; j < GetMaxChannels(); j++){
        handle = FSOUND_Sample_Get(j);
        
        if(handle == m_AudioClip[i].handle){
          if(j > -1)
            FSOUND_StopSound(j - 1);
        }
      }//for
    }//if
  }
}