Beispiel #1
0
void ALContextManager::loopSound(int id) throw (SoundNotFoundError)
{
    try {
        ALSoundBuffer* sound = findSoundById(id);
        ALContextChanger cc(m_my_context);
        sound->setLoop(true);
    } catch (SoundNotFoundError&) {
        throw;
    }
}
bool ALContextManager::playSound(int id, float volume)
{
    ALSoundBuffer* sound = findSoundById(id);
    try
    {
        ALContextChanger cc(m_my_context);
        sound->play(volume);
        return true;
    }
    catch(ALSoundBuffer::SoundPlayingError& ex)
    {
        std::stringstream stream;
        stream << "Sound number " << id << " failed to play with message: "
               << ex.what();
        throw SoundPlayError(stream.str());
    }
}
bool ALContextManager::isPlayingSound(int id)
{
    ALSoundBuffer* sound = findSoundById(id);
    ALContextChanger cc(m_my_context);
    return sound->isPlaying();
}
void ALContextManager::unLoopSound(int id)
{
    ALSoundBuffer* sound = findSoundById(id);
    ALContextChanger cc(m_my_context);
    sound->setLoop(false);
}
void ALContextManager::rewindSound(int id)
{
    ALSoundBuffer* sound = findSoundById(id);
    ALContextChanger cc(m_my_context);
    sound->rewind();
}