///////////////////////////////////////////// // sets sount volume /////////////////////////////////////////// int CSound::SetSoundVolume(int vol) { SOUND_VOLUME = vol; FSOUND_SetSFXMasterVolume(SOUND_VOLUME); SetMusicVolume(MUSIC_VOLUME); return vol; };
void SoundSystem::setSoundEffectVolume(float volume) { ASSERT(volume >= 0.0f, "Volume is negative: " + ftos(volume)); ASSERT(volume <= 1.0f, "Volume is greater than 100%: " + ftos(volume)); soundVolume = volume; FSOUND_SetSFXMasterVolume((int)(soundVolume * 255.0f)); }
CSoundManager::CSoundManager() { m_bCanauxJeu = true; // On initialise Fmod : Fréquence de sortie, nombre de canaux utilisés et option (non util pour nous) FSOUND_Init (44100, CANAL_MAX, 0); FSOUND_SetSFXMasterVolume (64); // On initialise tous les canaux de sons à 0 pour pouvoir vérifier qu'ils sont utilisés ou non. for (int Canal = CANAL_NULL; Canal < CANAL_MAX; Canal++) m_pSon[Canal] = 0; }
//=========================================================================== // DM_FModExtSet //=========================================================================== void DM_FModExtSet(int property, float value) { if(!ext_inited) return; switch (property) { case MUSIP_VOLUME: // This affects streams. FSOUND_SetSFXMasterVolume(ext_volume = value * 255 + 0.5); if(module) FMUSIC_SetMasterVolume(module, ext_volume); break; } }
//----------------------------------------------------------------------- void LLAudioEngine_FMOD::setInternalGain(F32 gain) { if (!mInited) { return; } gain = llclamp( gain, 0.0f, 1.0f ); FSOUND_SetSFXMasterVolume( llround( 255.0f * gain ) ); if ( mInternetStreamChannel != -1 ) { F32 clamp_internet_stream_gain = llclamp( mInternetStreamGain, 0.0f, 1.0f ); FSOUND_SetVolumeAbsolute( mInternetStreamChannel, llround( 255.0f * clamp_internet_stream_gain ) ); } }
//----------------------------------------------------------------------- void LLAudioEngine_FMOD::setInternalGain(F32 gain) { if (!mInited) { return; } gain = llclamp( gain, 0.0f, 1.0f ); FSOUND_SetSFXMasterVolume( llround( 255.0f * gain ) ); LLStreamingAudioInterface *saimpl = getStreamingAudioImpl(); if ( saimpl ) { // fmod likes its streaming audio channel gain re-asserted after // master volume change. saimpl->setGain(saimpl->getGain()); } }
void CAudio::Volume(int volume){ if(volume<0) volume = 0; else if(volume>100) volume = 100; FSOUND_SetSFXMasterVolume((int)(volume*2.55)); }
void click_button(GUI *B) { if(B->disabled) return; switch(B->action) { case ACTION_NEWGAME: { action_newgame(); break; } case ACTION_EXIT: { action_exit(); break; } case ACTION_RESUME: { action_resume(); break; } case ACTION_OPTIONS: { action_options(); break; } case ACTION_RETURNMENU: { action_returnmenu(); break; } case ACTION_CREDITS: { action_credits(); break; } case ACTION_SHIPSELECT_STORY: { game_mode = MODE_STORY; action_shipselect(); break; } case ACTION_SHIPSELECT_SURVIVAL: { game_mode = MODE_SURVIVAL; action_shipselect(); break; } case ACTION_RESTART: { action_restartlevel(); break; } case OPTION_DIFFICULTY: { if(!strcmp(B->text, ">")) { config[CFG_DIFFICULTY]++; if(config[CFG_DIFFICULTY] > DIFF_IMPOSSIBLE) config[CFG_DIFFICULTY] = DIFF_EASY; } else { config[CFG_DIFFICULTY]--; if(config[CFG_DIFFICULTY] < DIFF_EASY) config[CFG_DIFFICULTY] = DIFF_IMPOSSIBLE; } break; } case OPTION_CONTROLSTYLE: { config[CFG_ABSOLUTE_CONTROL] = !config[CFG_ABSOLUTE_CONTROL]; break; } case OPTION_MOUSEWHEEL: { config[CFG_MOUSE_WHEEL] = !config[CFG_MOUSE_WHEEL]; break; } case OPTION_SOUNDVOLUME: { if(!strcmp(B->text, ">")) { if(config[CFG_SFX_VOLUME] < 250) config[CFG_SFX_VOLUME] += 25; } else { if(config[CFG_SFX_VOLUME] > 0) config[CFG_SFX_VOLUME] -= 25; } break; } case OPTION_MUSICVOLUME: { if(!strcmp(B->text, ">")) { if(config[CFG_MUSIC_VOLUME] < 250) config[CFG_MUSIC_VOLUME] += 25; } else { if(config[CFG_MUSIC_VOLUME] > 0) config[CFG_MUSIC_VOLUME] -= 25; } FSOUND_SetSFXMasterVolume( config[CFG_MUSIC_VOLUME]); break; } case OPTION_FULLSCREEN: { config[CFG_FULLSCREEN] = !config[CFG_FULLSCREEN]; break; } case OPTION_BLENDING: { config[CFG_PARTICLE_BLENDING] = !config[CFG_PARTICLE_BLENDING]; break; } case OPTION_MEMBRANES: { config[CFG_SHOW_MEMBRANES] = !config[CFG_SHOW_MEMBRANES]; break; } case OPTION_LIGHTFLASHES: { config[CFG_LIGHT_FLASHES] = !config[CFG_LIGHT_FLASHES]; break; } case OPTION_SHIPSELECT: { if(!strcmp(B->text, ">")) { player->playerdata.shiptype++; if(player->playerdata.shiptype > 5) player->playerdata.shiptype = 1; set_ship_type(player->playerdata.shiptype); } else { player->playerdata.shiptype--; if(player->playerdata.shiptype < 1) player->playerdata.shiptype = 5; set_ship_type(player->playerdata.shiptype); } break; } default: return; } play_sample(select_sound, config[CFG_SFX_VOLUME], 128, 1000, 0); }
void CFMOD::SetSoundVolume(float f) { if(!bfmod) return; svol=(unsigned char)f; FSOUND_SetSFXMasterVolume(svol); }
/// <summary> Play WAV. </summary> /// /// <param name="Index"> Zero-based index of the. </param> /// <param name="channel"> The channel. </param> void CSound::PlayWav(int Index, int channel) { try { if (p->Options->sound == 1) { //Channel -1 is FSOUND_FREE (will play on first available channel) FSOUND_SetSFXMasterVolume(100); switch(Index) { case 0: FSOUND_PlaySound(channel, s_tanklaser); break; case 1: FSOUND_PlaySound(channel, s_fire); break; case 2: FSOUND_PlaySound(channel, s_engine); break; case 3: FSOUND_PlaySound(channel, s_build); break; case 4: FSOUND_PlaySound(channel, s_die); break; case 5: FSOUND_PlaySound(channel, s_eXplode); break; case 6: FSOUND_PlaySound(channel, s_turret); break; case 7: FSOUND_PlaySound(channel, s_buzz); break; case 8: FSOUND_PlaySound(channel, s_click); break; case 9: FSOUND_PlaySound(channel, s_bigturret); break; case 10: FSOUND_PlaySound(channel, s_demolish); break; case 11: FSOUND_PlaySound(channel, s_screech); break; case 12: FSOUND_PlaySound(channel, s_hit); break; case 13: FSOUND_PlaySound(channel, s_cloak); break; case 14: FSOUND_PlaySound(channel, s_flare); break; //default: } } } catch (...) {p->Options->sound = 0; p->Options->SaveOptions(); p->Engine->logerror("Crashed playing sound!");} }