コード例 #1
0
 SoundManager::~SoundManager(){
    //Stop all the sounds
    Mix_HaltChannel(-1);
    //Destroying the background music
    destroySound(&m_BackgroundMusic);
    destroySound(&m_LaserSound);
    destroySound(&m_ZombieSound);
    Mix_CloseAudio();
 };
コード例 #2
0
ファイル: SoundSystem.cpp プロジェクト: abc00/adrian
void SoundSystem::HaltAllChannels(void)
{
	if (!initialized)
		return;

	Mix_HaltChannel(-1);
	for (int i = 0; i < MAX_SOUNDS; i++)
		channels[i] = -1;
}
コード例 #3
0
ファイル: main.c プロジェクト: dorkster/espada
void game_titlescreen()
{
    gamestate_over = true;
    gamestate_pause = false;
    gamestate_title = true;
    game_setstatustext("",0);
    Mix_FadeOutMusic(sound_fadetime);
    Mix_HaltChannel(-1);
}
コード例 #4
0
d_define_method(track, set_channel)(struct s_object *self, int channel) {
    d_using(track);
    if ((track_attributes->next_channel = channel) == d_track_auto_channel)
        track_attributes->auto_channel = d_true;
    else
        Mix_HaltChannel(channel); /* nothing */
        track_attributes->auto_channel = d_false;
    return self;
}
コード例 #5
0
ファイル: sample.cpp プロジェクト: GreyGhost/OpenAnno-Archive
bool Sample::stop()
{
	if (m_Channel != -1) {
		Mix_HaltChannel(m_Channel);
		m_Channel = -1;
        return true;
    }
    return false;
}
コード例 #6
0
ファイル: i_sound.cpp プロジェクト: JohnnyonFlame/odamex
void I_StopSound (int handle)
{
	if(!sound_initialized)
		return;

	channel_in_use[handle] = -1;

	Mix_HaltChannel(handle);
}
コード例 #7
0
ファイル: audio.cpp プロジェクト: zurn/Zakes
audio::~audio()
{
	Mix_HaltChannel(-1);
	Mix_HaltMusic();
	free_music();
	delete sfact;
	Mix_CloseAudio();
	SDL_QuitSubSystem(SDL_INIT_AUDIO);
}
コード例 #8
0
ファイル: audio.c プロジェクト: LibreGames/edgar
void stopSound(int channel)
{
	if (channel < 0 || game.audio == FALSE || game.sfxDefaultVolume == 0 || channel > MAX_CHANNELS)
	{
		return;
	}

	Mix_HaltChannel(channel);
}
コード例 #9
0
ファイル: l_sound_sdl.c プロジェクト: hexameron/DOOM
void I_ShutdownSound(void)
{
  int i;    
  I_ShutdownMusic();
  Mix_HaltChannel(-1);
  for (i=0 ; i<NUMSFX ; i++)
    Mix_FreeChunk( S_sfx[i].chunk );
  SDL_CloseAudio();
}
コード例 #10
0
ファイル: x_Game.cpp プロジェクト: richi902/FurbyKill-3D
//
// FreeResources
//
void Game::FreeResources()
{
	int i;
	
	if(!framework->GetNoSound())
	{
		Mix_HaltChannel(-1);
		Mix_FreeChunk(pickAmmoSnd);
		Mix_FreeChunk(killSnd);
		Mix_FreeChunk(shootSnd);
		Mix_FreeChunk(MGshootSnd);
		Mix_FreeChunk(startSnd);
		Mix_FreeChunk(PlayerHurt);
		Mix_FreeChunk(EnemyHurt);
		Mix_FreeChunk(PlayerDead);
		Mix_FreeChunk(pickKey);
		Mix_FreeChunk(pickHealth);
		Mix_FreeChunk(framework->EnemyShoot);
		Mix_FreeChunk(framework->ClosingDoor);
		Mix_FreeChunk(framework->OpeningDoor);
		Mix_FreeChunk(HeartBeat);
		Mix_FreeChunk(LVLClear);
		Mix_HaltMusic();
		Mix_FreeMusic(music1);
	}
	
	SDL_FreeSurface(keyImg);
	SDL_FreeSurface(fireImg);
	SDL_FreeSurface(gunImg);
	SDL_FreeSurface(gunHudImg);
	SDL_FreeSurface(headRedImg);
	SDL_FreeSurface(hudBgImg);
	SDL_FreeSurface(headImg);
	SDL_FreeSurface(crosshairImg);
	SDL_FreeSurface(MGgunHudImg);
	SDL_FreeSurface(MGgunImg);
	SDL_FreeSurface(MGfireImg);
	
	for(i=0; i<MAX_SPRITES; i++)
	{
		if(textures[i] != NULL)
			SDL_FreeSurface(spriteImgs[i]);
		else
			break;
	}
	
	for(i=0; i<MAX_TEXTURES; i++)
	{
		if(textures[i][0] != NULL)
		{
			SDL_FreeSurface(textures[i][0]);
			SDL_FreeSurface(textures[i][1]);
		}
		else
			break;
	}
}
コード例 #11
0
void
CGame::StopFuse (void)
{
	mStage->RemoveDrawable (mFuse);

	// stop fuse sound
	if (mFuseChannel >= 0)
		Mix_HaltChannel (mFuseChannel);
	mFuseChannel = -1;
}
コード例 #12
0
ファイル: sound.cpp プロジェクト: MaddTheSane/maelstrom
Sound::~Sound()
{
	Mix_HaltChannel(-1);
	for ( Mix_Chunk *c : chunks) {
		if ( c == nullptr )
			continue;
		Mix_FreeChunk(c);
	}
	Mix_CloseAudio();
}
コード例 #13
0
void
vsSoundSystem::Deinit()
{
	StopMusic();
#if !TARGET_OS_IPHONE
	Mix_HaltChannel(-1);
#endif
	vsLog(" ++ Sound channels in use: %d", m_channelsInUse);
	vsLog(" ++ Max sound channels in use: %d", m_maxChannelsInUse);
}
コード例 #14
0
void MainApp::onUnloadWorld()
{
	PEON_DELETE( m_pFont );
	PEON_DELETE( m_pFontTexture );

	Mix_HaltChannel( m_iSound );
	Mix_FreeChunk( m_pSound );


}
コード例 #15
0
ファイル: c_soundsystem.cpp プロジェクト: Bong1236/europa
    void C_SoundSystem::UnloadSound(Mix_Chunk* sound)
    {
        if (sound) {
            if(Mix_Playing(-1) != 0) {
                Mix_HaltChannel(-1); //TODO: Should only stop the channel the sound is playing on
            }

            Mix_FreeChunk(sound);
        }
    }
コード例 #16
0
ファイル: SdlMusPlayer.cpp プロジェクト: tcvicio/PGE-Project
void PGE_Sounds::clearSoundBuffer()
{
    Mix_HaltChannel(-1);
    for (QHash<QString, Mix_Chunk* >::iterator it=chunksBuffer.begin(); it!=chunksBuffer.end(); ++it)
	{
        Mix_FreeChunk((*it));
	}
	chunksBuffer.clear();
    Mix_ReserveChannels(0);
}
コード例 #17
0
ファイル: audio.cpp プロジェクト: zurn/Zakes
void audio::cleanup()
{
	Mix_HaltChannel(-1);
	Mix_HaltMusic();
	free_music();
	if (sfact != NULL)
		delete sfact;
	Mix_CloseAudio();
	SDL_QuitSubSystem(SDL_INIT_AUDIO);
}
コード例 #18
0
ファイル: soundlib.cpp プロジェクト: farleyknight/rockbot
void soundLib::stop_repeated_sfx()
{
    //std::cout << ">>>>>> soundLib::stop_repeated_sfx._repeated_sfx_channel: " << _repeated_sfx_channel << std::endl;
    if (_repeated_sfx_channel == -1) {
        return;
    }
	Mix_HaltChannel(_repeated_sfx_channel);
	_repeated_sfx = -1;
	_repeated_sfx_channel = -1;
}
コード例 #19
0
ファイル: sound.c プロジェクト: wimh/instead
void snd_halt_chan(int han, int ms)
{
	if (han >= MIX_CHANNELS)
		han %= MIX_CHANNELS;
	if (ms)
		Mix_FadeOutChannel(han, ms);
	else {
		Mix_HaltChannel(han);
	}
}
コード例 #20
0
ファイル: jukebox.cpp プロジェクト: Arnaud474/Warmux
int JukeBox::StopAll() const
{
  if (!m_init)
    return 0;
  const Config* cfg = Config::GetConstInstance();
  if (!cfg->GetSoundMusic() && !cfg->GetSoundEffects()) return 0;

  // halt playback on all channels
  return Mix_HaltChannel(-1);
}
コード例 #21
0
ファイル: id_sd.cpp プロジェクト: JohnnyonFlame/ecwolf
void SD_StopDigitized(void)
{
    DigiPlaying = false;
    DigiPriority = 0;
    SoundPositioned = false;
    if ((DigiMode == sds_PC) && (SoundMode == sdm_PC))
        SDL_SoundFinished();

    Mix_HaltChannel(-1);
}
コード例 #22
0
void LevelScene::collectGarbagePlayers()
{
    QVector<LVL_Player *> stillVizible;//Avoid camera crash (which uses a cached render list)
    while(!dead_players.isEmpty())
    {
        LVL_Player *corpse = dead_players.last();
        dead_players.pop_back();
        if(corpse->isInRenderList())
        {
            stillVizible.push_back(corpse);//Avoid camera crash (which uses a cached render list)
            continue;
        }
        LVL_Player::deathReason reason = corpse->kill_reason;

        #if (QT_VERSION >= 0x050400)
        players.removeAll(corpse);
        #else
        //He-he, it's a great workaround for a Qt less than 5.4 which has QVector without removeAll() function
        while(1)
        {
            const QVector<LVL_Player *>::const_iterator ce = players.cend(), cit = std::find(players.cbegin(), ce, corpse);
            if (cit == ce)
                break;
            const QVector<LVL_Player *>::iterator e = players.end(), it = std::remove(players.begin() + (cit - players.cbegin()), e, corpse);
            players.erase(it, e);
            break;
        }
        #endif
        luaEngine.destoryLuaPlayer(corpse);

        switch(reason)
        {
        case LVL_Player::deathReason::DEAD_burn:
        case LVL_Player::deathReason::DEAD_fall:
        case LVL_Player::deathReason::DEAD_killed:
            if(players.size() > 0)
                PGE_Audio::playSoundByRole(obj_sound_role::PlayerDied);
            else
            {
                Mix_HaltChannel(-1);
                PGE_Audio::playSoundByRole(obj_sound_role::LevelFailed);
            }
            break;
        }
        if(reason==LVL_Player::deathReason::DEAD_burn)
            PGE_Audio::playSoundByRole(obj_sound_role::NpcLavaBurn);
    }
    dead_players.append(stillVizible);

    if(players.isEmpty())
    {
        PGE_MusPlayer::MUS_stopMusic();
        setExiting(4000, LvlExit::EXIT_PlayerDeath);
    }
}
コード例 #23
0
void SDLSoundManager::play(SoundManager::SoundID sid, std::string channel, FPoint pos, bool loop) {

	SoundMapIterator it;
	VirtualChannelMapIterator vcit = channels.end();

	if (!sid || !AUDIO || !SOUND_VOLUME)
		return;

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

	/* create playback object and start playback of sound chunk */
	Playback p;
	p.sid = sid;
	p.location = pos;
	p.virtual_channel = channel;
	p.loop = loop;
	p.finished = false;

	if (p.virtual_channel != GLOBAL_VIRTUAL_CHANNEL) {

		/* if playback exists, stop it befor playin next sound */
		vcit = channels.find(p.virtual_channel);
		if (vcit != channels.end())
			Mix_HaltChannel(vcit->second);

		vcit = channels.insert(std::pair<std::string, int>(p.virtual_channel, -1)).first;
	}

	// Let playback own a reference to prevent unloading playbacked sound.
	if (!loop)
		it->second->refCnt++;

	Mix_ChannelFinished(&channel_finished);
	int c = Mix_PlayChannel(-1, it->second->chunk, (loop ? -1 : 0));

	if (c == -1)
		logError("SoundManager: Failed to play sound, no more channels available.");

	// precalculate mixing volume if sound has a location
	Uint8 d = 0;
	if (p.location.x != 0 || p.location.y != 0) {
		float v = 255.0f * (calcDist(lastPos, p.location) / (SOUND_FALLOFF));
		clamp(v, 0.f, 255.f);
		d = Uint8(v);
	}

	Mix_SetPosition(c, 0, d);

	if (vcit != channels.end())
		vcit->second = c;

	playback.insert(std::pair<int, Playback>(c, p));
}
コード例 #24
0
void ChannelInternalState::Halt() {
  if (IsStream()) {
#ifdef PINDROP_MULTISTREAM
    Mix_HaltMusicCh(channel_id_);
#else
    Mix_HaltMusic();
#endif  // PINDROP_MULTISTREAM
  } else {
    Mix_HaltChannel(channel_id_);
  }
}
コード例 #25
0
ファイル: audio.cpp プロジェクト: 120pulsations/SMC
void cAudio_Sound :: Stop( void )
{
	// if not loaded or not playing
	if( !m_data || m_channel < 0 )
	{
		return;
	}
	
	Mix_HaltChannel( m_channel );
	m_channel = -1;
}
コード例 #26
0
ファイル: sound.c プロジェクト: GreatEmerald/Arcomage-Clone
void Sound_Quit()
{
    int i;
    if (SoundEnabled)
    {
        Mix_HaltChannel(-1);
        for (i=0; i<SFX_CNT; i++)
            Mix_FreeChunk(SfxData[i]);
        Mix_CloseAudio();
    }
}
コード例 #27
0
ファイル: i_sdlsound.c プロジェクト: Clever-Boy/doomretro
static void I_SDL_StopSound(int handle)
{
    if (!sound_initialized)
        return;

    Mix_HaltChannel(handle);

    // Sound data is no longer needed; release the
    // sound data being used for this channel
    ReleaseSoundOnChannel(handle);
}
コード例 #28
0
ファイル: SDLMixerBackend.cpp プロジェクト: nornagon/openc2e
void SDLMixerSource::stop() {
	if (channel == -1) return;

	// TODO
	bool oldfollow = followview;
	setFollowingView(false);          // unregister in backend
	followview = oldfollow;

	Mix_HaltChannel(channel);
	channel = -1;
}
コード例 #29
0
ファイル: mixer.c プロジェクト: iaco79/IrrGameDemo
/* Halt playing of a particular group of channels */
int Mix_HaltGroup(int tag)
{
	int i;

	for ( i=0; i<num_channels; ++i ) {
		if( mix_channel[i].tag == tag ) {
			Mix_HaltChannel(i);
		}
	}
	return(0);
}
コード例 #30
0
SoundEffect::~SoundEffect()
{
   if (channel != -1)
      Mix_HaltChannel(channel);

   if (enabled)
      Mix_FreeChunk(sound);
   
   if (--loadCount == 0)
      Mix_CloseAudio();
}