void CSoundManager::RemoveSound(TSTRING szReference, bool isMusic, int ID)
{
	CSGD_XAudio2* pXA = CSGD_XAudio2::GetInstance();
	
	int newID = ID;
	if( newID == -1 )
	{
		for( unsigned int i = 0; i < m_vSoundIDs.size(); i++ )
		{
			if( m_vSoundIDs[i].first == szReference )
			{
				newID = m_vSoundIDs[i].second;
				break;
			}
		}
	}

	if( isMusic )
	{
		pXA->MusicStopSong(newID);
		pXA->MusicUnloadSong(newID);
	}
	else
	{
		pXA->SFXStopSound(newID);
		pXA->SFXUnloadSound(newID);
	}
}
void CSoundManager::Stop( int ID, bool isMusic )
{
	CSGD_XAudio2* pXA = CSGD_XAudio2::GetInstance();
	if( ID == -1 )
		return;

	if( isMusic )
		pXA->MusicStopSong(ID);
	else
		pXA->SFXStopSound(ID);
}
void CSoundManager::LoadSound( TSTRING szFilename, TSTRING szReference, bool isMusic )
{
	CSGD_XAudio2* pXA = CSGD_XAudio2::GetInstance();
	int newID;
	if( isMusic )
		newID = pXA->MusicLoadSong(szFilename.c_str());
	else
		newID = pXA->SFXLoadSound(szFilename.c_str());

	SoundID newSoundID;
	newSoundID.first = szReference;
	newSoundID.second = newID;

	m_vSoundIDs.push_back(newSoundID);
}
void CSoundManager::Play( int ID, bool isLooping, bool isMusic )
{
	CSGD_XAudio2* pXA = CSGD_XAudio2::GetInstance();
	if( ID == -1 )
		return;

	if( isMusic )
	{
		if( pXA->MusicIsSongPlaying(ID) )
			pXA->MusicStopSong(ID);
		pXA->MusicPlaySong(ID,isLooping);
	}
	else
	{
		if( pXA->SFXIsSoundPlaying(ID) )
			pXA->SFXStopSound(ID);
		pXA->SFXPlaySound(ID, isLooping);
	}
}
Exemplo n.º 5
0
        void Client::playSpellSFX(SpellType _type)
        {
                CSGD_XAudio2* xAudio = CSGD_XAudio2::GetInstance();
                switch(_type)
                {
                case Spell_Fireball:
                        xAudio->SFXPlaySound(fireballSFX);   
                        break;
                case Spell_Phoenix:
                        xAudio->SFXPlaySound(phoenixSFX);
                        break;
                case Spell_Diablo:
                        xAudio->SFXPlaySound(diabloSFX);
                        break;
                case Spell_IceBall:
                        xAudio->SFXPlaySound(iceballSFX);
                        break;
                case Spell_FrostBite:
                        xAudio->SFXPlaySound(frostbiteSFX);
                        break;
                case Spell_GlacialSpike:
                        xAudio->SFXPlaySound(glacialSpikeSFX);
                        break;
                case Spell_LightningBolt:
                        xAudio->SFXPlaySound(lightningBoltSFX);
                        break;
                case Spell_LightningStrike:
                        xAudio->SFXPlaySound(lightningStrikeSFX);
                        break;
                case Spell_Valkyrie:
                        xAudio->SFXPlaySound(valkyrieSFX);
                        break;
                case Spell_Heal:
                case Spell_SelectedHeal:
                case Spell_GroupHeal:
                        xAudio->SFXPlaySound(healSFX);
                        break;

                default :
                         xAudio->SFXPlaySound(aoeFireballSFX);
                        return;

                }


        }
void CSoundManager::Shutdown(void)
{
	CSGD_XAudio2* pXA = CSGD_XAudio2::GetInstance();
	pXA->ShutdownXAudio2();
}