• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ Mix_FreeMusic函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Mix_FreeMusic函数的典型用法代码示例。如果您正苦于以下问题:C++ Mix_FreeMusic函数的具体用法?C++ Mix_FreeMusic怎么用?C++ Mix_FreeMusic使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Mix_FreeMusic函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: SDL_FreeSurface

// 終了処理を行う
void Game::Finalize(void) {
    // 解放する
    SDL_FreeSurface(block_image);
    SDL_FreeSurface(section_image);
    SDL_FreeSurface(section_image_02);
    SDL_FreeSurface(particle_image);
    TTF_CloseFont(font);
    TTF_CloseFont(big_font);
    Mix_FreeMusic(music_main);
    
    // 終了する
    TTF_Quit();
    Mix_CloseAudio();
    SDL_Quit();
}
开发者ID:hujita,项目名称:kadai_01,代码行数:16,代码来源:game.cpp


示例2: load

bool Music::load()
{
    if (!SDLManager::hasAudio()) return false;

	if (this->music) Mix_FreeMusic(this->music);

    this->music = Mix_LoadMUS(this->filepath.c_str());
    if (!this->music)
    {
        SDLManager::errorLog("Music::load: Couldn't load music on " + this->filepath);
        return false;
    }

    return true;
}
开发者ID:alexdantas,项目名称:sdl-toe,代码行数:15,代码来源:Music.cpp


示例3: noegnud_sound_done

void noegnud_sound_done() {
    noegnud_tcollection *sound;

    if (!noegnud_sound_initialised) return;

    sound=noegnud_sounds;
    while (sound) {
	if (((noegnud_sound_tsound *)(sound->data))->chunk) Mix_FreeChunk(((noegnud_sound_tsound *)(sound->data))->chunk);
	if (((noegnud_sound_tsound *)(sound->data))->music) Mix_FreeMusic(((noegnud_sound_tsound *)(sound->data))->music);
	noegnud_mem_free(sound->data);
	sound=sound->next;
    }
    noegnud_collection_destroy(&noegnud_sounds);
    noegnud_sounds=NULL;
}
开发者ID:chasonr,项目名称:noegnud-0.8.5,代码行数:15,代码来源:noegnud_sound.c


示例4: SDL_FreeSurface

        void Tela::clean_up() {
            
            //Libera todas as superficies da memoria
            SDL_FreeSurface( telaInicial );
            SDL_FreeSurface( telaIdentificacao );
            SDL_FreeSurface( telaInstrucoes );
            SDL_FreeSurface( telaConfigSound_ON );
            SDL_FreeSurface( telaConfigSound_OFF );
            SDL_FreeSurface( telaLevelUp );
            SDL_FreeSurface( telaGameOver );
            SDL_FreeSurface( gems );
            SDL_FreeSurface( gems_dica );
            SDL_FreeSurface( screen );
            SDL_FreeSurface( fundo );
            SDL_FreeSurface( nomeJogador );
            SDL_FreeSurface( pontosJogador );
            SDL_FreeSurface( gemYellow );
            SDL_FreeSurface( gemWhite );
            SDL_FreeSurface( gemBlue );
            SDL_FreeSurface( gemRed );
            SDL_FreeSurface( gemPurple );
            SDL_FreeSurface( gemOrange );
            SDL_FreeSurface( gemGreen );
            SDL_FreeSurface( fase1 );
            SDL_FreeSurface( fase2 );
            SDL_FreeSurface( fase3 );
            SDL_FreeSurface( fase4 );
            SDL_FreeSurface( hint );

            //Libera ficheiro de audio da memoria
            Mix_FreeMusic(music);

            //Encerra SDL_mixer
            Mix_CloseAudio();

            //Fecha a fonte que foi usada
            TTF_CloseFont( font );

            //Encerra SDL_ttf
            TTF_Quit();

            //Encerra SDL
            SDL_Quit();

            //Libera objetos que foram alocados dinamicamente anteriormente
            delete pontos;
            delete user;
        }
开发者ID:jefferssongalvao,项目名称:JewelrySpace,代码行数:48,代码来源:Tela.cpp


示例5: Mix_FreeMusic

Graphics::~Graphics() {
	Mix_FreeMusic(backgroundMusic);
	Mix_FreeChunk(soundEffect1);
	Mix_FreeChunk(soundEffect2);
	this->backgroundMusic = NULL;
	this->soundEffect1 = NULL;
	this->soundEffect2 = NULL;


	SDL_DestroyWindow(window);
	SDL_DestroyTexture(backgroundImage);
	SDL_DestroyTexture(border);
	SDL_DestroyTexture(snakeBody);
	SDL_DestroyTexture(snakeHeadDown);
	SDL_DestroyTexture(snakeHeadLeft);
	SDL_DestroyTexture(snakeHeadRight);
	SDL_DestroyTexture(snakeHeadUp);
	SDL_DestroyTexture(snakeTail);
	SDL_DestroyTexture(apple);
	SDL_DestroyTexture(banana);
	SDL_DestroyTexture(bomb);
	SDL_DestroyTexture(text);
	SDL_DestroyTexture(playerNameText);
	SDL_DestroyTexture(scoreText);
	SDL_DestroyTexture(currentScore);
	SDL_DestroyRenderer(renderTarget);
	this->window = NULL;
	this->backgroundImage = NULL;
	this->border = NULL;
	this->snakeBody = NULL;
	this->snakeHeadDown = NULL;
	this->snakeHeadLeft = NULL;
	this->snakeHeadRight = NULL;
	this->snakeHeadUp = NULL;
	this->snakeTail = NULL;
	this->apple = NULL;
	this->banana = NULL;
	this->bomb = NULL;
	this->text = NULL;
	this->playerNameText = NULL;
	this->scoreText = NULL;
	this->currentScore = NULL;
	this->renderTarget = NULL;
	Mix_CloseAudio();
	Mix_Quit();
	IMG_Quit();
	SDL_Quit();
}
开发者ID:kamilglonek,项目名称:snakeGame,代码行数:48,代码来源:Graphics.cpp


示例6: Mix_FreeMusic

void SoundManager::releaseMusic(const std::string& fileName)
{
	std::string absFileName = RESOURCE_DIR + AUDIO_DIR + fileName;
	// If the resource already exists, check its tracker count.
	// If it is currently 1, we are removing the last handle to it
	// so we need to free the resource and remove it from our map.
	//
	// Otherwise, just decrease the count in the tracker
	MusicIterator musicElement = musics.find(absFileName);
	if (musicElement != musics.end())
	{
		Mix_FreeMusic(musicElement->second);
		musics.erase(musicElement);
	}

}
开发者ID:deepbansal15,项目名称:Game-Engine,代码行数:16,代码来源:SoundManager.cpp


示例7: I_SDL_UnRegisterSong

static void I_SDL_UnRegisterSong(void *handle)
{
    Mix_Music *music = (Mix_Music *) handle;

    if (!music_initialized)
    {
        return;
    }

    if (handle == NULL)
    {
        return;
    }

    Mix_FreeMusic(music);
}
开发者ID:fabiangreffrath,项目名称:crispy-doom,代码行数:16,代码来源:i_sdlmusic.c


示例8: CleanUp

void CleanUp(void)
{
	if( Mix_PlayingMusic() ) {
		Mix_FadeOutMusic(1500);
		SDL_Delay(1500);
	}
	if ( music ) {
		Mix_FreeMusic(music);
		music = NULL;
	}
	if ( audio_open ) {
		Mix_CloseAudio();
		audio_open = 0;
	}
	SDL_Quit();
}
开发者ID:Jay-Jay-OPL,项目名称:ps2sdk-ports,代码行数:16,代码来源:playmus.c


示例9: close

void close()
{
    
    //Free the sound effects
    Mix_FreeChunk( sample );
    sample = NULL;
    
    //Free the music
    Mix_FreeMusic( music );
    music = NULL;

    
    //Quit SDL subsystems
    Mix_Quit();
    SDL_Quit();
}
开发者ID:poptartans,项目名称:bandify,代码行数:16,代码来源:SDL.cpp


示例10: Mix_FreeMusic

void AudioManager::destroy()
{
	if (isInitialized_)
	{
		isInitialized_ = false;
		//Cleanup
		for (auto& it : musicMap_)
		{
			Mix_FreeMusic(it.second);
		}

		musicMap_.clear();
		Mix_CloseAudio();
		Mix_Quit();
	}
}
开发者ID:awallgr,项目名称:TheGameOfLifeVII,代码行数:16,代码来源:AudioManager.cpp


示例11: Mix_HaltMusic

void soundLib::load_boss_music(string music_file) {
	string filename;

	if (boss_music != NULL) {
		Mix_HaltMusic();
		Mix_FreeMusic(boss_music);
        boss_music = NULL;
	}
    filename = FILEPATH + "music/" + music_file;
	//std::cout << "soundLib::load_boss_music - filename: " << filename << std::endl;
	boss_music = Mix_LoadMUS(filename.c_str());
	if (!boss_music) {
        std::cout << "Error in soundLib::load_boss_music::Mix_LoadMUS('" << filename << "': '" << Mix_GetError() << "'\n";
		exit(-1);
	}
}
开发者ID:farleyknight,项目名称:rockbot,代码行数:16,代码来源:soundlib.cpp


示例12: Mix_FreeMusic

void BGMusic::closeMedia()
{
    Mix_FreeMusic( bgmusic );
    bgmusic = NULL;
    Mix_FreeChunk( start_sound );
    start_sound = NULL;
    Mix_FreeChunk( victory_sound );
    victory_sound = NULL;
    Mix_FreeChunk( lose_sound );
    lose_sound = NULL;
    Mix_FreeChunk( aggro_sound );
    aggro_sound = NULL;
    //Quit SDL subsystems
    Mix_Quit();
    SDL_Quit();
}
开发者ID:luke-c-sargent,项目名称:ogre_3rd_person_ninjas,代码行数:16,代码来源:BGMusic.cpp


示例13: stopMusic

SDLInteraction::~SDLInteraction()
{
    stopMusic();
    if (m_audioInitialized)
    {
        if (m_music != NULL)
        {
            Mix_HaltMusic();
            Mix_FreeMusic(m_music);
        }
        Mix_CloseAudio();
    }
    SDL_Quit();

    delete m_soundMap;
}
开发者ID:hedgewars,项目名称:hw,代码行数:16,代码来源:SDLInteraction.cpp


示例14: glDeleteProgram

void ResourceManager::Clear()
{
    // (Properly) delete all shaders	
    for (auto iter : Shaders)
        glDeleteProgram(iter.second.ID);
    // (Properly) delete all textures
    for (auto iter : Textures)
        glDeleteTextures(1, &iter.second.ID);
    // (Properly) delete all cubemaps
    for (auto iter : Cubemaps)
        glDeleteTextures(1, &iter.second.ID);
    for(auto iterator : Musics)
        Mix_FreeMusic(iterator.second);
    for(auto iterator : Sons)
        Mix_FreeChunk(iterator.second);
}
开发者ID:Chadys,项目名称:Demo_OpenGL,代码行数:16,代码来源:ResourceManager.cpp


示例15: Mix_FadeOutMusic

void Sound::fadeOutMusic(int ms)
{
    mCurrentMusicFile.clear();

    if (!mInstalled)
        return;

    logger->log("Sound::fadeOutMusic() Fading-out (%i ms)", ms);

    if (mMusic)
    {
        Mix_FadeOutMusic(ms);
        Mix_FreeMusic(mMusic);
        mMusic = NULL;
    }
}
开发者ID:Ablu,项目名称:invertika,代码行数:16,代码来源:sound.cpp


示例16: ME_Play

///////////////////////////////////////////////////////////
// ME play
///////////////////////////////////////////////////////////
void Audio::ME_Play(std::string file, int volume, int pitch) {
	std::string path = FileFinder::FindMusic(file);
	if (path.empty()) ARGSS::AError::FileNotFound(file);

	if (me != NULL) Mix_FreeMusic(me);
	me = Mix_LoadMUS(path.c_str());
	if (!me) ARGSS::AError::AudioNotLoad("ME", file, Mix_GetError());

	Mix_VolumeMusic(volume * MIX_MAX_VOLUME / 100);
	if (Mix_PlayMusic(me, 1) == -1) ARGSS::AError::AudioNotPlay("ME", file, Mix_GetError());

	me_playing = true;
	if (bgm_playing) {
		bgm_playing = false;
		Mix_HookMusicFinished(ME_finish);
	}
}
开发者ID:cstrahan,项目名称:argss,代码行数:20,代码来源:audio_sdl.cpp


示例17: LoadSongList

void LoadSongList(struct SongDef **songList, const char *dirPath)
{
	tinydir_dir dir;
	int errsv;
	if (tinydir_open(&dir, dirPath) == -1)
	{
		errsv = errno;
		printf("Cannot open music dir: %s\n", strerror(errsv));
		goto bail;
	}

	for (; dir.has_next; tinydir_next(&dir))
	{
		Mix_Music *m;
		tinydir_file file;
		if (tinydir_readfile(&dir, &file) == -1)
		{
			errsv = errno;
			debug(D_VERBOSE, "cannot read file: %s\n", strerror(errsv));
			goto bail;
		}
		if (!file.is_reg)
		{
			debug(D_VERBOSE, "not a regular file %s\n", file.name);
			continue;
		}
		if (strcmp(file.extension, "txt") == 0 ||
			strcmp(file.extension, "TXT") == 0)
		{
			debug(D_VERBOSE, "Skipping text file %s\n", file.name);
			continue;
		}

		m = Mix_LoadMUS(file.path);
		if (m == NULL)
		{
			debug(D_VERBOSE, "not a music file %s\n", file.name);
			continue;
		}
		Mix_FreeMusic(m);
		AddSong(songList, file.path);
	}

bail:
	tinydir_close(&dir);
}
开发者ID:ChunHungLiu,项目名称:cdogs-sdl,代码行数:46,代码来源:gamedata.c


示例18: Mix_FreeChunk

void Bola::closeMedia(){
    //Free the sound effects
    Mix_FreeChunk( gGol );
    Mix_FreeChunk( gColision );
    Mix_FreeChunk( gNewPj );
    gGol = NULL;
    gColision = NULL;
    gNewPj = NULL;

    //Free the music
    Mix_FreeMusic( gMusic );
    gMusic = NULL;

    //Quit SDL subsystems
    Mix_Quit();
    SDL_Quit();
}
开发者ID:Junki22,项目名称:multipong,代码行数:17,代码来源:Bola.cpp


示例19: Mix_FreeMusic

Resource::~Resource(){
	
	for( musicMap::iterator i = musicList->begin(); i != musicList->end(); i++ ){
		Mix_FreeMusic( i->second );
	}
	delete musicList;

	for( soundMap::iterator i = soundList->begin(); i != soundList->end(); i++ ){
		Mix_FreeChunk( i->second );
	}
	delete soundList;

	for( imageMap::iterator i = imageList->begin(); i != imageList->end(); i++ ){
		SDL_DestroyTexture(i->second);
	}
	delete imageList;
}
开发者ID:osse101,项目名称:beware-the-demon,代码行数:17,代码来源:resources.cpp


示例20: Mix_FreeMusic

 ~music_t()
 {
     if(pMusic)
     {
         Mix_FreeMusic(pMusic);
         pMusic = NULL;
     }
     if(pRWop)
     {
         // Some SDL_Mixer backends will free this for you, and some will
         // not. As we do not know what the backend will do, we have to do
         // the same in every case, and a minor memory leak is less serious
         // (see http://code.google.com/p/corsix-th/issues/detail?id=3).
         //SDL_FreeRW(pRWop);
         pRWop = NULL;
     }
 }
开发者ID:AtlasRedux,项目名称:CorsixTH,代码行数:17,代码来源:sdl_audio.cpp



注:本文中的Mix_FreeMusic函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Mix_GetError函数代码示例发布时间:2022-05-30
下一篇:
C++ Mix_FreeChunk函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap