}
void
+OpenALSoundSource::pause()
+{
+ alSourcePause(source);
+ SoundManager::check_al_error("Couldn't pause audio source: ");
+}
+
+void
+OpenALSoundSource::resume()
+{
+ if( !this->paused() )
+ {
+ return;
+ }
+
+ this->play();
+}
+
+bool
+OpenALSoundSource::paused()
+{
+ ALint state = AL_PAUSED;
+ alGetSourcei(source, AL_SOURCE_STATE, &state);
+ return state == AL_PAUSED;
+}
+
+void
OpenALSoundSource::update()
{
}
virtual void play();
virtual void stop();
+ virtual void pause();
+ virtual void resume();
virtual bool playing();
+ virtual bool paused();
virtual void update();
}
void
+SoundManager::pause_music()
+{
+ if(music_source)
+ {
+ music_source->pause();
+ }
+}
+
+void
+SoundManager::resume_music()
+{
+ if(music_source)
+ {
+ music_source->resume();
+ }
+}
+
+void
SoundManager::set_listener_position(const Vector& pos)
{
static Uint32 lastticks = SDL_GetTicks();
void enable_music(bool music_enabled);
void play_music(const std::string& filename, bool fade = false);
+ void pause_music();
+ void resume_music();
void stop_music(float fadetime = 0);
bool is_music_enabled() { return music_enabled; }
speed_before_pause = ScreenManager::current()->get_speed();
ScreenManager::current()->set_speed(0);
MenuManager::instance().set_menu(MenuStorage::GAME_MENU);
+ SoundManager::current()->pause_music();
game_pause = true;
}
// Unpause the game if the menu has been closed
if (game_pause && !MenuManager::instance().is_active()) {
ScreenManager::current()->set_speed(speed_before_pause);
+ SoundManager::current()->resume_music();
game_pause = false;
}