void AudioManager::Unload( const AudioManager::AudioType Type, const string& ID ) { // Create local variables. unordered_map< string, SoundData >::iterator AudioMapIterator; // Check arguments. if( Type == MaxAudioTypes ) throw exception(); // Unload specified audio file and remove it from the appropriate audio map. if( Initialized ) { AudioMapIterator = AudioMaps[ Type ].Instance.find( ID ); if( AudioMapIterator == AudioMaps[ Type ].Instance.end() ) throw exception(); if( FMOD_ChannelGroup_Stop( AudioMapIterator->second.Group ) != FMOD_OK ) throw exception(); if( FMOD_ChannelGroup_Release( AudioMapIterator->second.Group ) != FMOD_OK ) throw exception(); if( FMOD_Sound_Release( AudioMapIterator->second.Instance ) != FMOD_OK ) throw exception(); AudioMaps[ Type ].Instance.erase( AudioMapIterator ); } }
void AudioManager::Stop( const AudioManager::AudioType Type, const string& ID ) { // Create local variables. unordered_map< string, SoundData >::iterator AudioMapIterator; // Check arguments. if( Type == MaxAudioTypes ) throw exception(); // Stop playback of all instances of the specified audio sample or stream. if( Initialized ) { AudioMapIterator = AudioMaps[ Type ].Instance.find( ID ); if( AudioMapIterator == AudioMaps[ Type ].Instance.end() ) throw exception(); if( FMOD_ChannelGroup_Stop( AudioMapIterator->second.Group ) != FMOD_OK ) throw exception(); } }
// ---------------------------------------------------------------------------- void ofxSoundStopAll() { ofxSoundInitialize(); FMOD_ChannelGroup_Stop(channelgroup); }
int main(int argc, char *argv[]) { int continuer = 1; float volume = 1.0; Touche tab[NB_TOUCHES]; SDL_Surface *ecran = NULL, *fde = NULL; SDL_Event event; SDL_Rect positionFond; FMOD_SYSTEM *system; FMOD_CHANNELGROUP* channel = null; positionFond.x = 0; positionFond.y = 0; /*SONS*/ /* Création et initialisation d'un objet système pour le FMOD*/ FMOD_System_Create(&system); FMOD_System_Init(system, 1, FMOD_INIT_NORMAL, NULL); /* Chargement des sons */ if(init_touches(system, tab)) return EXIT_FAILURE; /*SDL*/ /* Initialisation de la SDL */ SDL_Init(SDL_INIT_VIDEO); ecran = SDL_SetVideoMode(283, 200, 32, SDL_HWSURFACE | SDL_DOUBLEBUF); SDL_WM_SetCaption("Launchpad de la TIPS", NULL); fde = IMG_Load("../files/fde.png"); SDL_WM_SetIcon(fde, NULL); SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); SDL_BlitSurface(fde, NULL, ecran, &positionFond); SDL_Flip(ecran); while (continuer) { SDL_WaitEvent(&event); switch(event.type) { case SDL_QUIT: continuer = 0; break; case SDL_MOUSEBUTTONDOWN: /* Si clique de la souris */ /* Non utile pour le moment*/ break; case SDL_KEYDOWN: /* Si appuie sur une touche */ /* Esc pour quitter */ if(event.key.keysym.sym == SDLK_ESCAPE) continuer = 0; /* UP pour monter le son */ else if(event.key.keysym.sym == SDLK_UP) { FMOD_System_GetMasterChannelGroup(system, &channel); volume += 0.1; FMOD_ChannelGroup_SetVolume(channel, volume); } /* DOWN pour baisser le son */ else if(event.key.keysym.sym == SDLK_DOWN) { FMOD_System_GetMasterChannelGroup(system, &channel); volume -= 0.1; FMOD_ChannelGroup_SetVolume(channel, volume); } /* LEFT ou RIGHT pour stopper la musique */ else if((event.key.keysym.sym == SDLK_LEFT) || (event.key.keysym.sym == SDLK_RIGHT)) { FMOD_System_GetMasterChannelGroup(system, &channel); FMOD_ChannelGroup_Stop(channel); } else if(tab[event.key.keysym.sym].son != NULL) { FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, tab[event.key.keysym.sym].son, 0, NULL); } break; } } /* On ferme la SDL */ SDL_FreeSurface(fde); SDL_Quit(); /* On libère le son et on ferme et libère l'objet système */ libere_touches(tab); FMOD_System_Close(system); FMOD_System_Release(system); return EXIT_SUCCESS; }
//-------------------- void ofFmodSoundStopAll(){ ofFmodSoundPlayer::initializeFmod(); FMOD_ChannelGroup_Stop(channelgroup); }
void SoundEngine::stopAllChannel() { FMOD_ChannelGroup_Stop(getChannelGroup()); }