automatically [un]pause SDL audio from AV
git-svn-id: svn://anubis/anaglym/trunk@281 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
parent
d376d7a5b0
commit
a7ce3ff6b9
5
AV.cc
5
AV.cc
@ -135,6 +135,7 @@ refptr<AV::Sound> AV::createSound()
|
|||||||
void AV::playSound(AV::Sound * s)
|
void AV::playSound(AV::Sound * s)
|
||||||
{
|
{
|
||||||
m_active_sounds.insert(s);
|
m_active_sounds.insert(s);
|
||||||
|
SDL_PauseAudio(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AV::playCallback(Uint8 * stream, int len)
|
void AV::playCallback(Uint8 * stream, int len)
|
||||||
@ -149,6 +150,10 @@ void AV::playCallback(Uint8 * stream, int len)
|
|||||||
m_active_sounds.erase(it);
|
m_active_sounds.erase(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (m_active_sounds.size() == 0)
|
||||||
|
{
|
||||||
|
SDL_PauseAudio(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AV::Sound::Sound(AV & av)
|
AV::Sound::Sound(AV & av)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user