Beispiel #1
0
SoundID ResourceManagerImpl::new_sound_with_alias(const unicode& alias, bool garbage_collect) {
    SoundID s = new_sound(garbage_collect);
    try {
        SoundManager::manager_store_alias(alias, s);
    } catch(...) {
        delete_sound(s);
        throw;
    }
    return s;
}
Beispiel #2
0
 void SoundChannel::AddBuffer(const Foundation::SoundServiceInterface::SoundBuffer& buffer)
 {
     // Construct a sound from the buffer
     SoundPtr new_sound(new Sound("buffer"));
     new_sound->LoadFromBuffer(buffer);
     // If failed for some reason (out of memory?), bail out
     if (!new_sound->GetHandle())
         return;
     
     pending_sounds_.push_back(new_sound);
     
     // Buffered mode should not loop
     SetLooped(false);
     
     // Start actual playback on next update
     if (state_ == Foundation::SoundServiceInterface::Stopped)
         state_ = Foundation::SoundServiceInterface::Pending;
     buffered_mode_ = true;
 }
Beispiel #3
0
SoundID ResourceManagerImpl::new_sound_from_file(const unicode& path) {
    //Load the sound
    SoundPtr snd = sound(new_sound()).lock();
    window().loader_for(path.encode())->into(*snd);
    return snd->id();
}
Beispiel #4
0
SoundID ResourceManagerImpl::new_sound_from_file(const unicode& path, bool garbage_collect) {
    //Load the sound
    auto snd = sound(new_sound(garbage_collect));
    window->loader_for(path.encode())->into(snd);
    return snd->id();
}