Пример #1
0
void MainState::close()
{
	mPlayer1Texture.free();
	mPlayer2Texture.free();
	mBallTexture.free();

	mPlayer1ScoreTextTexture.free();
	mPlayer2ScoreTextTexture.free();

	mPlayer1Sprite.free();
	mPlayer2Sprite.free();
	mBallSprite.free();

	TTF_CloseFont(mFont);
	mFont = NULL;

	Mix_FreeChunk(mPaddleHitSound);
	Mix_FreeChunk(mWallHitSound);
	mPaddleHitSound = NULL;
	mWallHitSound = NULL;
}
Пример #2
0
static void CleanUp(void)
{
	if ( wave ) {
		Mix_FreeChunk(wave);
		wave = NULL;
	}
	if ( audio_open ) {
		Mix_CloseAudio();
		audio_open = 0;
	}
	SDL_Quit();
}
Пример #3
0
void cleanSound()
{
    Sint32 i;
    
    stopSound();
    
    for (i=0;i<20;i++)
       if (samples[i])
          Mix_FreeChunk(samples[i]);
    
    Mix_CloseAudio();
}
Пример #4
0
ResourceManager::~ResourceManager()
{
	map<string, Surface *>::iterator si;
	for (si = m_images.begin(); si != m_images.end(); si++)
		delete (*si).second;
	map<string, Mix_Chunk *>::iterator ci;
	for (ci = m_chunk.begin(); ci != m_chunk.end(); ci++)
		Mix_FreeChunk((*ci).second);
	map<string, Mix_Music *>::iterator mi;
	for (mi = m_music.begin(); mi != m_music.end(); mi++)
		Mix_FreeMusic((*mi).second);
}
Пример #5
0
	void Sound::quit()	{
		for(s_mpi = s_mpSound.begin(); s_mpi != s_mpSound.end(); ++s_mpi) {
			if(s_mpi->second.chunk) {
				Mix_FreeChunk(s_mpi->second.chunk);
				s_mpi->second.chunk = NULL;
			}
		}
		s_mpSound.clear();
		s_mpSoundChannel.clear();
		s_mpSoundPlaying.clear();
		ROE_SAFE_DELETE_ARRAY(s_abChannelPlaying);
	}
Пример #6
0
bool ModuleSound::CleanUp()
{
	LOG("Freeing music");

	for (std::list<Mix_Music*>::iterator it = Lmusic.begin(); it != Lmusic.end(); ++it)
		Mix_FreeMusic(*it);
	for (std::list<Mix_Chunk*>::iterator it = Lsoundse.begin(); it != Lsoundse.end(); ++it)
		Mix_FreeChunk(*it);
	Lsoundse.clear();
	Lmusic.clear();
	return true;
}
Пример #7
0
ContentManager::~ContentManager()
{
	for(map<string, Mix_Music*>::const_iterator iter = m_p_Music.begin(); iter != m_p_Music.end(); ++iter)
	{
		Mix_FreeMusic(iter->second);
	}

	for(map<string, Mix_Chunk*>::const_iterator iter = m_p_SoundEffects.begin(); iter != m_p_SoundEffects.end(); ++iter)
	{
		Mix_FreeChunk(iter->second);
	}
}
Пример #8
0
void Sound::destroy(){
    if (own){
        *own -= 1;
        if ( *own == 0 ){
            delete own;
            if (data.chunk != NULL){
                Mix_FreeChunk(data.chunk);
            }
            own = NULL;
        }
    }
}
Пример #9
0
void cSound_PC::MixerChannelFinished( int32 pChannel ) {

	for (std::vector<sVocPlaying>::iterator ChannelIT = mMixerChunks.begin(); ChannelIT != mMixerChunks.end(); ++ChannelIT) {
		
		if (ChannelIT->mChannel == pChannel) {
			Mix_FreeChunk( ChannelIT->mCurrentChunk );

			mMixerChunks.erase( ChannelIT );
			return;
		}
	}
}
Пример #10
0
	~SDLSoundData()
	{
		QMutableMapIterator<int, SDLSoundData*> it(*channelsMap());
		while (it.hasNext()) {
			it.next();
			if (it.value() == this) {
				Mix_HaltChannel(it.key());
				it.remove();
			}
		}
		Mix_FreeChunk(chunk);
	}
Пример #11
0
void FreeSound(Sound *sound)
{
  if(sound->used > 1)
  {
    sound->used--;
    return;
  }
  NumSounds--;
  sound->used--;
  Mix_FreeChunk(sound->sound);
  sound->sound = NULL;
}
Пример #12
0
void freeSounds()
{
	int i;
	
	for (i=0;i<MAX_SOUNDS;i++)
	{
		if (sound[i].effect != NULL)
		{
			Mix_FreeChunk(sound[i].effect);
		}
	}
}
Пример #13
0
void clean_up()
{
  //Free the images
  SDL_FreeSurface(background);

  Mix_FreeChunk(scratch);
  Mix_FreeChunk(high);
  Mix_FreeChunk(med);
  Mix_FreeChunk(low);

  Mix_FreeMusic(music);

  Mix_CloseAudio();

  TTF_CloseFont(font);

  TTF_Quit();

  //Quit SDL
  SDL_Quit();
}
Пример #14
0
void sound_free( void ) {
	int i;
	
	for( i = 0 ; i < NUM_SOUNDS ; i++ ) {
		if( sounds[i] ) {
			Mix_FreeChunk( sounds[i] );
			sounds[i] = NULL;
		}
	}

	sound_close_mixer();
}
Пример #15
0
Sound::~Sound()
{
   if(sound != NULL)
   {
      if(ownsChannel(this, playingChannel))
      {
         stop();
      }

      Mix_FreeChunk(sound);
   }
}
Пример #16
0
FFDemo::~FFDemo()
{
    cleanStatus();
    cleanAbout();
    cleanItems();
    cleanMagicSkills();	
    cleanMain();
	

    delete mSplashImage;

    delete mTimeLabel1;
    delete mTimeLabel2; 
    delete mTime;
	
    delete mGoldFootstepsInfo1;
    delete mGoldFootstepsInfo2;
    delete mGoldFootsteps;

    delete mMenuList;
    delete mMenuListModel;
    delete mMenu;

    delete mMain;
	
    delete mFontWhite;
    delete mFontCyan;
    delete mTop;
    delete mGui;

    delete mSDLInput;
    delete mSDLGraphics;
    delete mSDLImageLoader;
	 
    Mix_FreeChunk(mChooseSound);
    Mix_FreeChunk(mEscapeSound);
    Mix_CloseAudio();
	
    SDL_Quit();
}
Пример #17
0
Vista::~Vista() {
	this->barra->closeFont();
	Mix_FreeChunk( musica_creacion );
	SDL_DestroyTexture(backgroundTexture);
	SDL_DestroyTexture(perdedorTexture);
	SDL_DestroyTexture(ganadorElfosTexture);
	SDL_DestroyTexture(ganadorHobbitTexture);
	SDL_DestroyTexture(ganadorMordorTexture);
	TTF_Quit();
	SDL_DestroyRenderer(gRenderer);
	SDL_DestroyWindow(gWindow);
    Mix_FreeChunk( musicaLoading );
	Mix_FreeChunk( music_ganador_elfo );
	Mix_FreeChunk( musica_ganador_hobbit );
	Mix_FreeChunk( musica_ganador_humanos );
	Mix_FreeChunk( musica_ganador_mordor );


    Mix_CloseAudio();
	gWindow = NULL;
	gRenderer = NULL;

	IMG_Quit();
	SDL_Quit();
}
Пример #18
0
///////////////////////////////////////////////////////////
// BGS play
///////////////////////////////////////////////////////////
void Audio::BGS_Play(std::string file, int volume, int pitch) {
	std::string path = FileFinder::FindMusic(file);
	if (path.empty()) ARGSS::AError::FileNotFound(file);

	if (bgs != NULL) Mix_FreeChunk(bgs);

	bgs = Mix_LoadWAV(path.c_str());
	if (!bgs) ARGSS::AError::AudioNotLoad("BGS", file, Mix_GetError());

	bgs_channel = Mix_PlayChannel(-1, bgs, -1);
	Mix_Volume(bgs_channel, volume * MIX_MAX_VOLUME / 100);
	if (bgs_channel == -1) ARGSS::AError::AudioNotPlay("BGS", file, Mix_GetError());
}
Пример #19
0
void sound_cleanup (void) {
	int i;

	/* Free the sound effects */
	for (i = 0; i < NUM_WAVES; i++)
		Mix_FreeChunk(sounds[i]);

	/* Quit SDL_mixer */
	Mix_CloseAudio();

	/* Quit SDL */	/* Oh boy, what a meaningful comment! */
	SDL_Quit();
}
Пример #20
0
bool clean_up() {
    // WARNING: Assumes all these are the same
    for (int i=0;i<MAX_BITMAPS;i++) {
        if (FONTS[i] != NULL) {
            SDL_FreeSurface(BITMAPS[i]);
            Mix_FreeChunk(SOUNDS[i]);
            TTF_CloseFont(FONTS[i]);
        }
    }
    SDL_FreeSurface(MAIN_SCREEN); // this is important and needs to stay

    return true;
}
Пример #21
0
Sound::~Sound()
{
    for(unsigned int i =0; i<m_music.size(); i++)
    {
        m_music[i]=NULL;
    }

	for(unsigned int i =0; i<m_sound_effect.size(); i++)
    {
        Mix_FreeChunk( m_sound_effect[i] );
        m_sound_effect[i]=NULL;
    }
}
Пример #22
0
void WavePool::unload(void)
{
   int   i;

   if (nsamples == 0) return;

   for (i = 0; i < nsamples; i++) {
#ifndef NO_SOUND
      Mix_FreeChunk(sample[i].sample);
#endif
   }
   delete []sample;
}
Пример #23
0
void SoundSystem::UnloadAll(void)
{
	if (!initialized)
		return;

	for (int i = 0; i < MAX_SOUNDS; i++) {
		if (sounds[i]) {
			printf("Unloading Sound in Channel: %d\n", i);
			Mix_FreeChunk(sounds[i]);
			sounds[i] = NULL;
		}
	}
}
Пример #24
0
void GameplayScreen::Cleanup(Game* game)
{
	levelManager->CleanupLevel();

	SDL_DestroyTexture(pauseTexture);
	pauseTexture = NULL;

	TTF_CloseFont(arialFont);
	arialFont = NULL;

	// Unload the textures that were loaded from the GameplayScreen
	TextureManager::UnloadTexture("tile");
	TextureManager::UnloadTexture("playerLives");
	TextureManager::UnloadTexture("wall");
	TextureManager::UnloadTexture("wall_top_left");
	TextureManager::UnloadTexture("wall_top_right");
	TextureManager::UnloadTexture("wall_bottom_left");
	TextureManager::UnloadTexture("wall_bottom_right");
	TextureManager::UnloadTexture("wall_horizontal");
	TextureManager::UnloadTexture("wall_vertical");
	TextureManager::UnloadTexture("pellet");
	TextureManager::UnloadTexture("powerPellet");
	TextureManager::UnloadTexture("redEnemy");
	TextureManager::UnloadTexture("pinkEnemy");
	TextureManager::UnloadTexture("blueEnemy");
	TextureManager::UnloadTexture("orangeEnemy");
	TextureManager::UnloadTexture("frightened");
	TextureManager::UnloadTexture("frightenedWhite");
	TextureManager::UnloadTexture("player");
	TextureManager::UnloadTexture("walls");

	// Free the sound effects
	Mix_FreeMusic(background);
	Mix_FreeMusic(backgroundPower);
	Mix_FreeChunk(eatEnemy);
	Mix_FreeChunk(pop);
	Mix_FreeChunk(powerUp);
	Mix_FreeChunk(death);
}
Пример #25
0
/**
 * quit-functions
 * saves the highscore quits TTF and SDL and then exit(0)
 * @param data the dataStore
 */
void quitSDL(dataStore *data)
{
	
	
	saveDataStore(data,1,0);
	

	Mix_FreeMusic( data->startmusic );
	Mix_FreeMusic( data->ingamemusic);
	Mix_FreeChunk( data->chaingo ); 
	Mix_FreeChunk( data->chainpause);
	Mix_CloseAudio();


	
	/*quit TTF */
	TTF_Quit();
	/* Clean up the SDL library */
	SDL_Quit();
	
	exit(0);
}
void AudioPlayer::close()
{
	if (bgm)
    {
		Mix_FreeMusic(bgm);
		bgm = NULL;
    }
    if (sfx)
    {
    	Mix_FreeChunk(sfx);
		sfx = NULL;
    }
}
Пример #27
0
CResources::~CResources ()
{
	for (Uint16 i = 0; i < CFIELDS; ++i)
	{
		if (b_field[i] != NULL)
		{
			SDL_FreeSurface(b_field[i]);
		}
	}

	for (Uint16 i = 0; i < C_DIE_SOUNDS; i++)
	{
		Mix_FreeChunk(s_dieSounds[i]);
	}

	for (Uint16 i = 0; i < C_EXPLODE_SOUNDS; i++)
	{
		Mix_FreeChunk(s_explodeSounds[i]);
	}

	Mix_FreeChunk(s_chooseSound);
}
Пример #28
0
// UnLoad WAV
bool ModuleAudio::UnLoadFx(uint id)
{
	bool ret = false;

	if (fx[id] != nullptr)
	{
		Mix_FreeChunk(fx[id]);
		fx[id] = nullptr;
		ret = true;
	}

	return ret;
}
void SDLSoundManager::unload(SoundManager::SoundID sid) {

	SoundMapIterator it;
	it = sounds.find(sid);
	if (it == sounds.end())
		return;

	if (--it->second->refCnt == 0) {
		Mix_FreeChunk(it->second->chunk);
		delete it->second;
		sounds.erase(it);
	}
}
Пример #30
0
//-----------------
void CAudioManager::destroy( ) {
  for( auto & music : m_songs ) {
    Mix_FreeMusic( music.second );
  }
  m_songs.clear( );

  for( auto & audio : m_audios ) {
    Mix_FreeChunk( audio.second );
  }
  m_audios.clear( );

  Mix_Quit( );
}