Changeset View
Changeset View
Standalone View
Standalone View
source/soundmanager/items/CSoundBase.cpp
Show All 38 Lines | |||||
void CSoundBase::ReleaseOpenAL() | void CSoundBase::ReleaseOpenAL() | ||||
{ | { | ||||
if (m_ALSource != 0) | if (m_ALSource != 0) | ||||
{ | { | ||||
AL_CHECK; | AL_CHECK; | ||||
alSourcei(m_ALSource, AL_BUFFER, 0L); | alSourcei(m_ALSource, AL_BUFFER, 0L); | ||||
AL_CHECK; | AL_CHECK; | ||||
((CSoundManager*)g_SoundManager)->ReleaseALSource(m_ALSource); | ((CSoundManager*)ISoundManager::GetSoundManager())->ReleaseALSource(m_ALSource); | ||||
AL_CHECK; | AL_CHECK; | ||||
m_ALSource = 0; | m_ALSource = 0; | ||||
} | } | ||||
if (m_SoundData != 0) | if (m_SoundData != 0) | ||||
{ | { | ||||
AL_CHECK; | AL_CHECK; | ||||
CSoundData::ReleaseSoundData(m_SoundData); | CSoundData::ReleaseSoundData(m_SoundData); | ||||
AL_CHECK; | AL_CHECK; | ||||
Show All 33 Lines | |||||
bool CSoundBase::Finished() | bool CSoundBase::Finished() | ||||
{ | { | ||||
return !m_ShouldBePlaying && !IsPlaying(); | return !m_ShouldBePlaying && !IsPlaying(); | ||||
} | } | ||||
bool CSoundBase::InitOpenAL() | bool CSoundBase::InitOpenAL() | ||||
{ | { | ||||
alGetError(); /* clear error */ | alGetError(); /* clear error */ | ||||
m_ALSource = ((CSoundManager*)g_SoundManager)->GetALSource( this ); | m_ALSource = ((CSoundManager*)ISoundManager::GetSoundManager())->GetALSource( this ); | ||||
AL_CHECK; | AL_CHECK; | ||||
if ( m_ALSource ) | if ( m_ALSource ) | ||||
{ | { | ||||
alSourcef(m_ALSource,AL_PITCH,1.0f); | alSourcef(m_ALSource,AL_PITCH,1.0f); | ||||
AL_CHECK; | AL_CHECK; | ||||
alSourcef(m_ALSource,AL_GAIN,1.0f); | alSourcef(m_ALSource,AL_GAIN,1.0f); | ||||
▲ Show 20 Lines • Show All 175 Lines • ▼ Show 20 Lines | void CSoundBase::Play() | ||||
AL_CHECK; | AL_CHECK; | ||||
if (m_ALSource != 0) | if (m_ALSource != 0) | ||||
{ | { | ||||
alSourcePlay(m_ALSource); | alSourcePlay(m_ALSource); | ||||
ALenum err = alGetError(); | ALenum err = alGetError(); | ||||
if (err != AL_NO_ERROR) | if (err != AL_NO_ERROR) | ||||
{ | { | ||||
if (err == AL_INVALID) | if (err == AL_INVALID) | ||||
((CSoundManager*)g_SoundManager)->SetDistressThroughError(); | ((CSoundManager*)ISoundManager::GetSoundManager())->SetDistressThroughError(); | ||||
else | else | ||||
((CSoundManager*)g_SoundManager)->al_ReportError(err, __func__, __LINE__); | ((CSoundManager*)ISoundManager::GetSoundManager())->al_ReportError(err, __func__, __LINE__); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
void CSoundBase::PlayAndDelete() | void CSoundBase::PlayAndDelete() | ||||
{ | { | ||||
SetLastPlay(true); | SetLastPlay(true); | ||||
Play(); | Play(); | ||||
▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator