// ---------------------------------------------------------------------------- void ofxSoundPlayerFMOD::play() { // if it's a looping sound, we should try to kill it, no? // or else people will have orphan channels that are looping if (bLoop == true){ FMOD_Channel_Stop(channel); } // if the sound is not set to multiplay, then stop the current, // before we start another if (!bMultiPlay){ FMOD_Channel_Stop(channel); } FMOD_System_PlaySound(sys, FMOD_CHANNEL_FREE, sound, bPaused, &channel); FMOD_Channel_GetFrequency(channel, &internalFreq); FMOD_Channel_SetVolume(channel,volume); FMOD_Channel_SetPan(channel,pan); FMOD_Channel_SetFrequency(channel, internalFreq * speed); FMOD_Channel_SetMode(channel, (bLoop == true) ? FMOD_LOOP_NORMAL : FMOD_LOOP_OFF); //fmod update() should be called every frame - according to the docs. //we have been using fmod without calling it at all which resulted in channels not being able //to be reused. we should have some sort of global update function but putting it here //solves the channel bug FMOD_System_Update(sys); }
bool Systems::SoundSystem::StopSound(const Events::StopSound &event) { auto eComp = m_World->GetComponent<Components::SoundEmitter>(event.Emitter); if(eComp) { FMOD_Channel_Stop(m_Channels[event.Emitter]); } else { FMOD_Channel_Stop(m_BGMChannel); } return true; }
bool ModuleIrisAudio::MePlay(wstring filePath, int volume, int rate){ string sfilepath = WStringToString(filePath); const char* fpath = sfilepath.c_str(); if (channels == 0){ if (meChannel != NULL){ BOOL isPlaying; FMOD_Channel_IsPlaying(meChannel, &isPlaying); if (isPlaying) FMOD_Channel_Stop(meChannel); } } FMOD_RESULT result; result = FMOD_System_CreateStream(fmodSystem, fpath, FMOD_DEFAULT, 0, &me); if (result != FMOD_OK) return false; result = FMOD_System_PlaySound(fmodSystem, FMOD_CHANNEL_FREE, me, true, &meChannel); if (result != FMOD_OK) return false; FMOD_Channel_SetMode(meChannel, FMOD_LOOP_NORMAL); FMOD_Channel_SetVolume(meChannel, volume / 100.0f); float frequancy; FMOD_Channel_GetFrequency(meChannel, &frequancy); FMOD_Channel_SetFrequency(meChannel, frequancy * (rate / 100.0)); FMOD_Channel_SetPaused(meChannel, FALSE); return true; }
void Chunk::Stop() { if( m_pChannel ) { FMOD_Channel_Stop(m_pChannel); // m_pChannel->stop(); } }
void Audio::StopAll() { for (Iterator i = samples.begin(); i != samples.end(); ++i) { FMOD_Channel_Stop( (*i)->channel ); } }
void CDA_Stop (void) { #ifdef UQE_FMOD_CDAUDIO if(SND_InitialisedCD == false || SND_MusicChannel.inuse == false) return; if(SND_MusicChannel.channel) { result = FMOD_Channel_Stop(SND_MusicChannel.channel); FMOD_ERROR(result, true, false); } if(fmod_musicCD_subsound) { result = FMOD_Sound_Release(fmod_musicCD_subsound); FMOD_ERROR(result, true, false); } if(fmod_musicCD) { result = FMOD_Sound_Release(fmod_musicCD); FMOD_ERROR(result, true, false); } SND_MusicChannel.inuse = false; #else CDAudio_Stop(); #endif }
void FMOD_Shutdown (void) { if (COM_CheckParm("-nosound")) { SND_Initialised = false; SND_InitialisedCD = false; return; } if (SND_MusicChannel.channel) FMOD_Channel_Stop(SND_MusicChannel.channel); CDA_Shutdown(); if (fmod_music) FMOD_Sound_Release(fmod_music); if (fmod_system) { result = FMOD_System_Close(fmod_system); FMOD_ERROR(result, true, false); result = FMOD_System_Release(fmod_system); FMOD_ERROR(result, true, false); } SND_Initialised = false; SND_InitialisedCD = false; }
void stop_sound_num(int num) { if(!sound_is_on)return; FMOD_Channel_Stop(sound_data[num].voice_num); sound_data[num].used=0; }
//! Stop void teSound::Stop() { if(channel) { teSoundManager::CheckResult(FMOD_Channel_Stop(channel)); channel = NULL; } }
void sound_unload(void) { if(loaded) { FMOD_Channel_Stop(_channel); FMOD_Sound_Release(_sound); loaded = false; } }
void I_StopSound(INT32 handle) { FMOD_CHANNEL *chan; FMR(FMOD_System_GetChannel(fsys, handle, &chan)); if (music_stream && chan == music_channel) return; FMR(FMOD_Channel_Stop(chan)); }
void stop() { if (NULL != m_channel) { FMOD_Channel_Stop(m_channel); FMOD_System_Update(System); m_channel = NULL; } }
void Audio::Stop(std::string name) { if (!IsPlaying(name)) return; Sample *sample = FindSample(name); if (sample == NULL) return; FMOD_Channel_Stop(sample->channel); }
void FMCSound::stop() { m_has_played = false; FMOD_System_Update(m_fmod_system); if (m_fmod_channel == 0) return; FMOD_Channel_Stop(m_fmod_channel); }
void StopAudio() /* Stop the sound if is playing.*/ { if (systemFMOD != NULL) { BOOL isPlaying = FALSE; FMOD_Channel_IsPlaying(channel, &isPlaying); if (isPlaying) FMOD_Channel_Stop(channel); } }
void soundHelico() { if(helico->positionWin.y + HELICO_HEIGHT < POSITION_BOTTOM-5) { if(timeAllowed(&previousTimeSoundHelico, 1300)) FMOD_System_PlaySound(sound_system, 1, sound_helico, 0, &canal_game); } else FMOD_Channel_Stop(canal_game); }
void Audio::StopAllExcept(std::string name) { for (Iterator i = samples.begin(); i != samples.end(); ++i) { if ((*i)->getName() != name) { FMOD_Channel_Stop( (*i)->channel ); } } }
void AudioPlayer::stopSound( SoundID sID ) { if ( sID == ERROR_SOUND_ID ) return; Channel* channel = getChannel( sID ); if ( !channel ) return; FMOD_CHECK( FMOD_Channel_Stop( channel ) ); }
int fmod_stopsound() { FMOD_RESULT result; result = FMOD_Channel_Stop(channel); //printf("fmod_playsound(%i)...\n",i); if (ERRCHECK(result)) { printf("error fmod_playsound()\n"); return 1; } return 0; }
void Audio::definirMusique(audio_t m) { if(_musique == m) return; if(_canalMusique) { FMOD_Channel_Stop(_canalMusique); _canalMusique = 0; } _musique = m; }
/* --------------------------------------- 释放接口 --------------------------------------- */ static void_t iXMM_FMOD_release ( __CR_IN__ iXMMEDIA* that ) { iXMM_FMOD* real; real = (iXMM_FMOD*)that; FMOD_Channel_Stop(real->m_chn); FMOD_Sound_Release(real->m_snd); TRY_FREE(real->m_dat); mem_free(that); }
void CSound::Stop(void) { // Check if we have a sound loaded if (!mLoaded) { return; } #if __ENABLE_CFMOD // Check if we have a valid channel if (0 != mpChannel) { // Stop the channel that is playing the sound FMOD_Channel_Stop(mpChannel); mpChannel = 0; } #endif }
// ---------------------------------------------------------------------------- void ofSoundPlayer::play(){ // if it's a looping sound, we should try to kill it, no? // or else people will have orphan channels that are looping if (bLoop == true){ FMOD_Channel_Stop(channel); } // if the sound is not set to multiplay, then stop the current, // before we start another if (!bMultiPlay){ FMOD_Channel_Stop(channel); } FMOD_System_PlaySound(sys, FMOD_CHANNEL_FREE, sound, bPaused, &channel); FMOD_Channel_GetFrequency(channel, &internalFreq); FMOD_Channel_SetVolume(channel,volume); FMOD_Channel_SetPan(channel,pan); FMOD_Channel_SetFrequency(channel, internalFreq * speed); FMOD_Channel_SetMode(channel, (bLoop == true) ? FMOD_LOOP_NORMAL : FMOD_LOOP_OFF); }
void stop_fiend_music(void) { if(!sound_is_on)return; if(strcmp(current_music,"none")==0)return; if(strcmp(current_music,"none")!=0) { FMOD_Channel_Stop(fmod_music_channel); FMOD_Sound_Release(music_sound); music_channel = -1; strcpy(current_music,"none"); } }
void ModuleIrisAudio::FadeBgmThreadProc(int duration){ bgmIsFading = true; int time = duration; while (time >= 0){ float v; FMOD_Channel_SetPaused(bgmChannel, true); FMOD_Channel_GetVolume(bgmChannel, &v); FMOD_Channel_SetVolume(bgmChannel, v - v / (duration / 1000)); time -= 1000; FMOD_Channel_SetPaused(bgmChannel, false); Sleep(1000); } FMOD_Channel_Stop(bgmChannel); bgmIsFading = false; }
void Sound::Stop() { // Check if we have a sound loaded if (!mLoaded) { return; } // Check if we have a valid channel if (0 != mpChannel) { // Stop the channel that is playing the sound FMOD_Channel_Stop(mpChannel); mpChannel = 0; } }
bool Systems::SoundSystem::PlayBGM(const Events::PlayBGM &event) { FMOD_RESULT result; result = FMOD_Channel_Stop(m_BGMChannel); if(result != FMOD_OK) LOG_INFO("FMOD error! (%d) %s\n", result, FMOD_ErrorString(result)); Sound* sound = ResourceManager->Load<Sound>("Sound2D", event.Resource); result = FMOD_System_PlaySound(m_System, FMOD_CHANNEL_FREE, *sound, false, &m_BGMChannel); if(result != FMOD_OK) LOG_INFO("FMOD error! (%d) %s\n", result, FMOD_ErrorString(result)); FMOD_Channel_SetMode(m_BGMChannel, FMOD_LOOP_NORMAL); FMOD_Sound_SetLoopCount(*sound, -1); return true; }
void stop_all_sounds(void) { int i; if(!sound_is_on)return; for(i=0;i<MAX_SOUNDS_PLAYING;i++) { if(sound_data[i].used) { FMOD_Channel_Stop(sound_data[i].voice_num); sound_data[i].used=0; } } }
bool ClientActionToneMelody::runAction() { FMOD_RESULT result; if (!system) { channel = 0; result = FMOD_System_Create(&system); ERRCHECK(result); FMOD_System_SetDSPBufferSize(system, 64, 1); result = FMOD_System_Init(system, 2, FMOD_INIT_STREAM_FROM_UPDATE | FMOD_INIT_MIX_FROM_UPDATE, NULL); ERRCHECK(result); result = FMOD_System_CreateDSPByType(system, FMOD_DSP_TYPE_OSCILLATOR, &dsp); ERRCHECK(result); } if (channel) { result = FMOD_Channel_Stop(channel); ERRCHECK(result); channel = 0; } if (tone_frequency) { result = FMOD_DSP_SetParameterFloat(dsp, FMOD_DSP_OSCILLATOR_RATE, (float) tone_frequency); ERRCHECK(result); result = FMOD_System_PlayDSP(system, dsp, 0, true, &channel); ERRCHECK(result); result = FMOD_Channel_SetVolume(channel, 1.0f); ERRCHECK(result); result = FMOD_DSP_SetParameterInt(dsp,FMOD_DSP_OSCILLATOR_TYPE, 1); ERRCHECK(result); StartMelodyTone(settings->value("MELODY")); updateTimer->start(); settings->insert("ACTIVE", "1"); } else { updateTimer->stop(); periodicToneTimer->stop(); prog_led_tone_control = false; tone_state = false; tone_periodic = false; tone_period = 0; settings->insert("ACTIVE", "0"); } return true; }
int play_fiend_music(char* file, int loop) { char path[100]; char error_string[50]; if(!sound_is_on)return -1; if(strcmp(file,current_music)==0)return 1; if(strcmp(current_music,"none")!=0) { FMOD_Channel_Stop(fmod_music_channel); FMOD_Sound_Release(music_sound); } sprintf(path,"music/%s",file); if(loop) { FMOD_System_CreateSound(fmod_system, path, FMOD_SOFTWARE | FMOD_CREATESTREAM, &soundex_info, &music_sound); music_is_looping = 1; } else { FMOD_System_CreateSound(fmod_system, path, FMOD_SOFTWARE | FMOD_CREATESTREAM, &soundex_info, &music_sound); music_is_looping=0; } if(music_sound==NULL) { sprintf(error_string,"Error loading stream \"%s\" ",path); make_engine_error(error_string); return 0; } strcpy(current_music,file); speed_counter=0; FMOD_System_PlaySound(fmod_system, FMOD_CHANNEL_FREE, music_sound, 0, &fmod_music_channel); set_fiend_music_volume(fiend_music_volume); return 1; }