Added ResourceRef (Automatic resource reference)

Former-commit-id: 97a0b2732f4dc443b8e1676e68b33b1b53ddf4fb
This commit is contained in:
Lynix
2013-03-15 03:09:58 +01:00
parent 4ee6ca05ed
commit 6c2fb1eb89
29 changed files with 344 additions and 299 deletions

View File

@@ -25,9 +25,6 @@ NzSoundEmitter(sound)
NzSound::~NzSound()
{
Stop();
if (m_buffer)
m_buffer->RemoveResourceReference();
}
void NzSound::EnableLooping(bool loop)
@@ -155,16 +152,10 @@ void NzSound::SetBuffer(const NzSoundBuffer* buffer)
Stop();
if (m_buffer)
m_buffer->RemoveResourceReference();
m_buffer = buffer;
if (m_buffer)
{
m_buffer->AddResourceReference();
alSourcei(m_source, AL_BUFFER, m_buffer->GetOpenALBuffer());
}
else
alSourcei(m_source, AL_BUFFER, AL_NONE);
}