Пример #1
0
	void pause()
	{
		// Pause all sound
		Mix_Pause(-1);

		// Pause music
		Mix_PauseMusic();
	}
Пример #2
0
void SoundBank::PauseOrResume() {
	if (Mix_PausedMusic()) {
		Mix_ResumeMusic();
	}
	else {
		Mix_PauseMusic();
	}
}
Пример #3
0
void GsMusic::pause(void)
{
    if (!Mix_PlayingMusic())
        return;
    if (Mix_PausedMusic())
        return;
    Mix_PauseMusic();
}
Пример #4
0
	void Music::Pause()
	{
		if (Audio::GetInstance()->GetCurrentMusic() != this)
			return;

		if (Mix_PausedMusic() == 0)
			Mix_PauseMusic();
	}
Пример #5
0
void SoundEngine::PauseMusic()
{
    if (nosound)
    {
        return;
    }
    Mix_PauseMusic();
}
Пример #6
0
void SDL::pauseMusic()
{
    if (!(SDL::startedAudio))
        return;

    if (SDL::musicPlaying())
        Mix_PauseMusic();
}
Пример #7
0
void SoundManager::toggleSound() {
	notmute = !notmute;
	if(!notmute)
		Mix_PauseMusic();
	else if(Mix_PausedMusic())
		Mix_ResumeMusic();

}
Пример #8
0
void GsMusic::toggle(void)
{
    if (!Mix_PlayingMusic())
        return;
    if (Mix_PausedMusic())
        Mix_ResumeMusic();
    else
        Mix_PauseMusic();
}
Пример #9
0
void Music::PauseMusic() {
	if(Mix_PausedMusic() == 1) {
		Mix_ResumeMusic();
		musicStopped = false;
	} else {
		Mix_PauseMusic();
		musicStopped = true;
	}
}
Пример #10
0
void Audio::pauseTrack()
{
    //std::cout << "pauseTrack()" << std::endl;
    if (!_opt._bMusic) return;

    if (Mix_Paused(-1))
        Mix_ResumeMusic();
    else
        Mix_PauseMusic();
}
Пример #11
0
Audio::~Audio() {
    if (SOUND) {
        freeSounds();
        Mix_PauseMusic();
        Mix_VolumeMusic(previous_volume);
        Mix_HaltMusic();
        Mix_FreeMusic(music);
        Mix_CloseAudio();
    }
}
void MySoundEffect::resumeMusic()
{
	if (Mix_PausedMusic() == 1) {
		Mix_ResumeMusic();
	}
	else
	{
		Mix_PauseMusic();
	}
}
Пример #13
0
void Mixer::PauseMusic()
{
   if (!theBgMusic)
   {
      LOG_WARNING() << "Trying to pause music, but never loaded any";
      return;
   }

   Mix_PauseMusic();
}
Пример #14
0
bool	Sounds::pause_audio_player(void)
{
	if (Mix_PausedMusic() != 1)
	{
		Mix_PauseMusic();
		Mix_Pause(1);
		return (true);
	}
	return (false);
}
Пример #15
0
void SdlAudio::BGM_Pause() {
	// Midi pause is not supported... (for some systems -.-)
#if SDL_MAJOR_VERSION>1
	// SDL2_mixer bug, see above
	if (Mix_GetMusicType(bgm.get()) == MUS_WAV) {
		BGS_Pause();
		return;
	}
#endif
	Mix_PauseMusic();
}
Пример #16
0
/**
 * Pauses music playback when game loses focus.
 */
void Music::pause()
{
#ifndef __NO_MUSIC
	if (!Options::mute)
	{
		Mix_PauseMusic();
		if (Mix_GetMusicType(0) == MUS_NONE)
			Mix_HookMusic(NULL, NULL);
	}
#endif
}
Пример #17
0
void SDLAudio::toggleMusic()      // returns true or false based on if the music was currently playing ( true if it was, false if it was muted );
{
  if ( Mix_PausedMusic() == 1 )
  {
    Mix_ResumeMusic();
  }
  else
  {
    Mix_PauseMusic();
  }
}
Пример #18
0
void Tetris::run()
{
    SDL_Texture* background_ = nullptr;
    SDL_Event event;
    bool playGame = false;
    bool exitGame = false;

    // Start playing music.
    Mix_PlayMusic( music_, -1 );

    while( !exitGame ){
        // Load the main menu background and display it.
        background_ = resourceLoader_.loadImage( "menu_background.png", renderer_ );
        SDL_RenderCopy( renderer_, background_, nullptr, nullptr );
        SDL_RenderPresent( renderer_ );

        // Initialize the available options: play the game or exit it.
        playGame = false;
        exitGame = false;

        // Wait for user to decide if he/she plays or exits the game.
        do{
            SDL_WaitEvent( &event );

            switch( event.type ){
                case SDL_KEYDOWN:
                    if( event.key.keysym.sym == SDLK_RETURN ){
                        playGame = true;
                    }else if( event.key.keysym.sym == SDLK_ESCAPE ){
                        exitGame = true;
                    }else if( event.key.keysym.sym == SDLK_m ){
                        if( Mix_PausedMusic() ){
                            Mix_ResumeMusic();
                        }else{
                            Mix_PauseMusic();
                        }
                    }
                break;
                case SDL_QUIT:
                    exitGame = true;
                break;
            }
        }while( !playGame && !exitGame );

        // Free resources.
        SDL_DestroyTexture( background_ );

        // Start the game if player wants to.
        if( playGame ){
            game_->run();
        }
    }
}
Пример #19
0
void Music::PlayPause(int loops)
{
	if(Mix_PlayingMusic())
	{
		if(Mix_PausedMusic())
			Mix_ResumeMusic();
		else
			Mix_PauseMusic();
	}
	else
		Mix_PlayMusic(music, loops);
}
Пример #20
0
void cAudio :: PauseMusic( void )
{
	if( !bMusic || !bInitialised )
	{
		return;
	}

	if( Mix_PlayingMusic() )// Check if music is currently playing
	{
		Mix_PauseMusic();
	}
}
Пример #21
0
void I_PauseSong (int handle)
{
	if(!music_initialized)
		return;

    curpause = 1;
    I_SetMusicVolume (0.0);

#ifndef OSX
	Mix_PauseMusic();
#endif
}
Пример #22
0
// Pauses music, if play() was not called, return false
bool AudioHandler::pause()
{
	if (!Mix_PlayingMusic())
	{
		return false;
	}
	if (!Mix_PausedMusic())
	{
		Mix_PauseMusic();
	}
	return true;
}
Пример #23
0
void ChannelInternalState::RealChannelPause() {
  assert(is_real());
  if (IsStream()) {
#ifdef PINDROP_MULTISTREAM
    Mix_PauseMusicCh(channel_id_);
#else
    Mix_PauseMusic();
#endif  // PINDROP_MULTISTREAM
  } else {
    Mix_Pause(channel_id_);
  }
}
Пример #24
0
void cAudio :: Pause_Music( void ) const
{
	if( !m_music_enabled || !m_initialised )
	{
		return;
	}

	// if music is playing
	if( Mix_PlayingMusic() )
	{
		Mix_PauseMusic();
	}
}
Пример #25
0
void snd_pause(int on)
{
	if (!sound_on) 
		return;
	if (on) {
		Mix_Pause(-1);
		Mix_PauseMusic();
	} else {
		Mix_Resume(-1);
		Mix_ResumeMusic();
	}
	return;
}
Пример #26
0
void PauseWave ( int no )
{
	switch ( s_iYGSSoundType[no] )
	{
	case YGS_SOUNDTYPE_WAV:
		Mix_Pause(no);
		break;

	case YGS_SOUNDTYPE_MUS:
		Mix_PauseMusic();
		break;
	}
}
Пример #27
0
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);

      noiseLoopChannel = Mix_PlayChannel(-1, noiseLoop, -1);
      printf("noiseLoopChannel = %d", noiseLoopChannel);
      assert(noiseLoopChannel != -1 && noiseLoopChannel != 0);
      // set noiseLoopChannel to half volume
      Mix_Volume(noiseLoopChannel,MIX_MAX_VOLUME/10);
      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();
#ifdef REPORT_RESULT
      REPORT_RESULT(1);
#endif
      break;
  };
}
void Room_MainParent::setMusic(const char *path, bool play)
{
	music = Mix_LoadMUS(path);
	if (music == NULL)
	{
		std::cout << "Could not play music with path '" << path << "'!" << endl;
	}
	else 
	{
		Mix_PlayMusic(music, -1);
		if (!play)
			Mix_PauseMusic();
	}
}
Пример #29
0
void GameApplication::startStopSound() {
	if (Mix_PlayingMusic() == 0) {
		Mix_PlayMusic(music, -1);
		chunk = true;
	} else {
		if (Mix_PausedMusic() == 1) {
			Mix_ResumeMusic();
			chunk = true;
		} else {
			Mix_PauseMusic();
			chunk = false;
		}
	}
}
Пример #30
0
void cSound::pauseSound(string name)
{
	map<string, Mix_Chunk*>::iterator iterChunk = m_Chunks.find(name);
	map<string, Mix_Music*>::iterator iterMusic = m_Music.find(name);

	if (iterChunk != m_Chunks.end())
	{
		Mix_HaltChannel(1);
	}
	else if(iterMusic != m_Music.end())
	{
		Mix_PauseMusic();
	}
}