当前位置: 首页>>代码示例>>C++>>正文


C++ Mix_ResumeMusic函数代码示例

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


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

示例1: toluaI_sound_sound_resume_music00

/* function: Mix_ResumeMusic */
static int toluaI_sound_sound_resume_music00(lua_State* tolua_S)
{
 if (
 !tolua_isnoobj(tolua_S,1)
 )
 goto tolua_lerror;
 else
 {
 {
  Mix_ResumeMusic();
 }
 }
 return 0;
tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'resume_music'.");
 return 0;
}
开发者ID:jcubic,项目名称:ToME,代码行数:18,代码来源:w_sound.c

示例2: jhi_replay_music

void jhi_replay_music(JHI_Music *music, int loop)
{
	if (Mix_PausedMusic() == 1)
	{
		Mix_ResumeMusic();
	}

	if (Mix_PlayingMusic() != 0) 
	{
		jhi_stop_music();
	}

	jhi_free_music(music);
	jhi_load_music(music, music->filename);

	jhi_play_music(music, loop);
}
开发者ID:joaogf,项目名称:libjhi-sdl,代码行数:17,代码来源:jhi_sound.c

示例3: handleKey

void handleKey(SDL_KeyboardEvent key) {
	switch(key.keysym.sym) {
	case SDLK_p:
		shoot(phaser, NULL, key.type);
		break;
	case SDLK_1:
		shoot(one, oneEnd, key.type);
		break;
	case SDLK_2:
		shoot(two, twoEnd, key.type);
		break;
	case SDLK_3:
		shoot(three, threeEnd, key.type);
		break;
	case SDLK_4:
		shoot(four, fourEnd, key.type);
		break;
	case SDLK_5:
		shoot(five, fiveEnd, key.type);
		break;
	case SDLK_6:
		shoot(six, sixEnd, key.type);
		break;
	case SDLK_m:
		if(key.state == SDL_PRESSED) {
			if(music == NULL) {
				music = Mix_LoadMUS("music.ogg");
				Mix_PlayMusic(music, 0);
				Mix_HookMusicFinished(musicDone);
			}
			if (!musicPlaying) {
				printf("Play\n");
				musicPlaying = 1;
				Mix_ResumeMusic();
			} else {
				printf("Pause\n");
				musicPlaying = 0;
				Mix_PauseMusic();
				//Mix_HaltMusic();
				//Mix_FreeMusic(music);
				//music = NULL;
			}
		}
		break;
	}
}
开发者ID:knickers,项目名称:binauralAlgorithms,代码行数:46,代码来源:mixer.c

示例4: Mix_ResumeMusic

//----------------------------------------------------------------------------------------------------------------------
void Game::update()
{
  // only update if game is acutally playing
  if(m_playing)
  {
    // if the music is paused when changing levels
    if(Mix_PausedMusic()==1)
    {
      // play the music
      Mix_ResumeMusic();
    }
    // update all the game's systems
    m_controlSys.update(m_rotX, m_rotY);
    m_sensorSys.update();
    m_autoSys.update();
    // get rid of dead boids
    cleanup();
    m_flightSys.update();
    m_combatSys.update();
    // check if vulnerable boid lists are empty
    if(m_world->m_stdBoids.empty() && m_world->m_ldrBoids.empty())
    {
      // increment the level
      ++m_level;
      // if level is still within max levels
      if(m_level<m_maxLevels)
      {
        // congratulations for beating level, loading new level
        Mix_PauseMusic();
        // load next level after reset
        m_world->resetWorld();
        loadLevel(m_levelList[m_level]);
      }
      else
      {
        // finished the game, return to menu
        gameover();
      }
    }
    if(m_world->m_player->m_auto.m_dead)
    {
      // gameover, return to menu
      gameover();
    }
  }
}
开发者ID:ryanchanwo,项目名称:Kinobird,代码行数:47,代码来源:Game.cpp

示例5: Mix_PauseMusic

void CSound::SetPause (bool Pause)
{
    // If the sound works
    if (m_SoundOK)
    {    
        if (Pause)
        {    
            Mix_PauseMusic();
        }
        else
        {
            Mix_ResumeMusic();	
        }

        m_GlobalPause = Pause;
    }
}
开发者ID:Enucatl,项目名称:bombermaaan-x,代码行数:17,代码来源:CSound.cpp

示例6: Mix_ResumeMusic

void music_muter::handle_window_event(const SDL_Event& event)
{
	if (preferences::stop_music_in_background() && preferences::music_on())
	{
		if (event.window.event == SDL_WINDOWEVENT_FOCUS_GAINED)
		{
			Mix_ResumeMusic();
		}
		else if (event.window.event == SDL_WINDOWEVENT_FOCUS_LOST)
		{
			if (Mix_PlayingMusic())
			{
				Mix_PauseMusic();
			}
		}
	}
}
开发者ID:aquileia,项目名称:wesnoth,代码行数:17,代码来源:sound.cpp

示例7: Mix_ResumeMusic

void cMusicSDL2::Play(int _repeat, int fade){
	if(music != NULL){
		if(Mix_PlayingMusic() > 0){	//Music is already playing
			if(isPaused){
				Mix_ResumeMusic();
				isPaused = false;
				return;
			}else if(Mix_FadingMusic() == MIX_FADING_OUT){
				Mix_HaltMusic();
			}else{
				return;
			}
		}
		if(Mix_FadeInMusic(music, _repeat, fade) < 0){
			StormPrintLog(STORM_LOG_ERROR, "cMusicSDL2", "Error %s", Mix_GetError());
		}
	}
}
开发者ID:master312,项目名称:quantum-kidney,代码行数:18,代码来源:cMusicSDL2.cpp

示例8: Mix_ResumeMusic

void Player::Play() {
	if (MusicPaused) {
		Mix_ResumeMusic();
		MusicPaused = false;
	} else {
		//Get first song to play

		//TEMP: just grab test song
		current = Mix_LoadMUS("song.flac");
		next = Mix_LoadMUS("next.flac");
		if (!current) {
			fprintf(stderr, "Error opening music file: %s\n", SDL_GetError());
			exit(1);
		}

		playCurrent();
	}
}
开发者ID:raemarks,项目名称:Crescendo,代码行数:18,代码来源:player.cpp

示例9: one_iter

void one_iter() {
  static int frames = 0;
  frames++;
  
  switch( frames ) {
    case 1:
      soundChannel = Mix_PlayChannel(-1, sound, 0);
      printf("channel = %d", soundChannel);
      assert(soundChannel != -1 && soundChannel != 0);
      break;
    case 2:
      printf("channel %d is playing = %d", soundChannel, Mix_Playing(soundChannel));
      assert(Mix_Playing(soundChannel));
      break;
    case 30:
      Mix_Pause(soundChannel);
      Mix_PlayMusic(music, 1);
      break;
    case 31:
      assert(Mix_Paused(soundChannel));
      assert(Mix_PlayingMusic());
      break;
    case 60:
      Mix_Resume(soundChannel);
      Mix_PauseMusic();
      break;
    case 61:
      assert(Mix_Playing(soundChannel));
      assert(Mix_PausedMusic());
      break;
    case 90:
      Mix_ResumeMusic();
      break;
    case 91:
      assert(Mix_PlayingMusic());
      break;
    case 120:
      Mix_HaltChannel(soundChannel);
      Mix_HaltMusic();
      int result = 1;
      REPORT_RESULT();
      break;
  };
}
开发者ID:13609594236,项目名称:CrossApp,代码行数:44,代码来源:sdl_audio_mix.c

示例10: applySurface

    bool Tela::showConfScreen() {
        bool quit = false, execute = true;

        if(audio) {
            applySurface( 0, 0, telaConfigSound_ON, screen );
            SDL_Flip( screen );
        } else {
            applySurface( 0, 0, telaConfigSound_OFF, screen );
            SDL_Flip( screen );
        }

        while( execute ) {

            if( SDL_PollEvent( &event ) ) {
                Ponto tmp;

                if( event.type == SDL_MOUSEBUTTONDOWN && event.button.button == SDL_BUTTON_LEFT) {
                    tmp.x = event.button.x;
                    tmp.y = event.button.y;
                    if((tmp.x >= 590 && tmp.x <= 645) && (tmp.y >= 100 && tmp.y <= 160)) {
                        execute = false;
                    } else if((tmp.x >= 140 && tmp.x <= 660) && (tmp.y >= 60 && tmp.y <= 580)) {
                        if(audio) {
                            applySurface( 0, 0, telaConfigSound_OFF, screen );
                            SDL_Flip( screen );
                            audio = false;
                            Mix_PauseMusic();
                        } else {
                            applySurface( 0, 0, telaConfigSound_ON, screen );
                            SDL_Flip( screen );
                            audio = true;
                            Mix_ResumeMusic();
                        }
                    }
                } else if( (event.type == SDL_QUIT)  || (event.type == SDL_KEYDOWN && event.key.keysym.sym == SDLK_ESCAPE)) {
                    //Encerra programa
                    quit = true;
                    return quit;
                }
            }
        }
        return execute;
    }
开发者ID:jefferssongalvao,项目名称:JewelrySpace,代码行数:43,代码来源:Tela.cpp

示例11: Mix_PauseMusic

//Checks if music is on
void Application::checkMusic()
{
    if (isMusicOn)
    {
        isMusicOn = false;
        Mix_PauseMusic();
    }
    else
    {
        isMusicOn = true;
        if (Mix_PausedMusic() == 1)
        {
            Mix_ResumeMusic();
        }
        else
        {
            Mix_PlayMusic(menuBackgroundSound, 10);
        }
    }
}
开发者ID:gody93,项目名称:Rally,代码行数:21,代码来源:Application.cpp

示例12: DrawText

void GameThroneMode::GameOver()
{
	const int fontSize = 60;
	int middleX=(int) RESX/2;
	int middleY=(int) RESY/2;
	if(snake1->GetDead())
	{
		player2Score++;
		DrawText(middleX-250,middleY-10,"Player  WASD  WIN",fontSize,250,152,5);
	}
	if(snake2->GetDead())
	{
		player1Score++;
		DrawText(middleX-250,middleY-10,"Player  ULDR  WIN",fontSize,250,152,5);
	}
	SDL_Flip(screen);
	
	Mix_PauseMusic();
	Mix_PlayChannel(-1,sounds[4],0);
	SDL_Delay(4500);
	Mix_ResumeMusic();

	for(int i=0;i<65;i++)
	{
		for(int j=0;j<35;j++)
		{
			Converter.CreateConvert<CellEmpty>(i,j);
		}
	}
	Converter.Convert();

	delete snake1;
	delete snake2;

	snake1=new Snake(Left,"Snake1",CellStruct(61,17),CellStruct(62,17),CellStruct(63,17));
	snake2=new Snake(Right,"Snake2",CellStruct(3,18),CellStruct(2,18),CellStruct(1,18),1);

	SDL_PumpEvents();
	SDL_Event event[30];
	SDL_PeepEvents(event,30,SDL_GETEVENT,SDL_KEYDOWNMASK);
}
开发者ID:Jeky-v,项目名称:Snake,代码行数:41,代码来源:GameThroneMode.cpp

示例13: SDLH_Play

void SDLH_Play(void)
{
    musicMutex = !songs.empty();
    while (musicMutex)
    {
        HIDUSER_GetSoundVolume(&currentVolume);
        if (!Mix_PlayingMusic() || (currentVolume == 0 && songs.size() > 1))
        {
            if (song)
            {
                Mix_FreeMusic(song);
                song = nullptr;
            }
            if (Configuration::getInstance().randomMusic())
            {
                currentSong = randomNumbers() % songs.size();
            }
            else
            {
                currentSong = (currentSong + 1) % songs.size();
            }
            song = Mix_LoadMUS(songs[currentSong].c_str());
            Mix_PlayMusic(song, 1);
        }
        if (currentVolume == 0)
        {
            Mix_PauseMusic();
        }
        while (currentVolume == 0 && musicMutex)
        {
            HIDUSER_GetSoundVolume(&currentVolume);
            svcSleepThread(250000000);
        }
        if (Mix_PausedMusic() && musicMutex)
        {
            Mix_ResumeMusic();
        }
        svcSleepThread(250000000);
    }
    donePlaying = true;
}
开发者ID:BernardoGiordano,项目名称:EventAssistant,代码行数:41,代码来源:mixer.cpp

示例14: startStopSound

void startStopSound()
{
    if( Mix_PlayingMusic() == 0 )
    {
        Mix_PlayMusic( gMusic, -1 );
        chunk = true;
    }
    else
    {
        if( Mix_PausedMusic() == 1 )
        {
            Mix_ResumeMusic();
            chunk = true;
        }
        else
        {
            Mix_PauseMusic();
            chunk = false;
        }
    }
}
开发者ID:rosen90,项目名称:GitHub,代码行数:21,代码来源:main.cpp

示例15: audio_set_music_on_off

void
audio_set_music_on_off (int on)
{
#ifdef USE_AUDIO
  if (!sound_supported) return;
    if (on) {
        if (Mix_PausedMusic()) Mix_ResumeMusic();
        else
        {
            while (Mix_FadingMusic() == MIX_FADING_OUT) SDL_Delay(100);
        }
        if (music[currentMus])
            Mix_FadeInMusic (music[currentMus], -1, 1000);
    }
    else {
        while (Mix_FadingMusic() == MIX_FADING_IN) SDL_Delay(100);
        Mix_FadeOutMusic (1000);
    }
    music_on = on;
#endif
}
开发者ID:gp2xdev,项目名称:gp2x-flobopuyo,代码行数:21,代码来源:audio.c


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