コード例 #1
0
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);
	}
}
コード例 #2
0
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);
}
コード例 #3
0
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);
	}
}