buffer = load_file_into_buffer(*file);
buffers.insert(std::make_pair(filename, buffer));
} else {
- std::unique_ptr<StreamSoundSource> source(new StreamSoundSource);
- source->set_sound_file(std::move(file));
- return std::move(source);
+ std::unique_ptr<StreamSoundSource> source_(new StreamSoundSource);
+ source_->set_sound_file(std::move(file));
+ return std::move(source_);
}
log_debug << "Uncached sound \"" << filename << "\" requested to be played" << std::endl;
if( *i == sss ){
i = update_list.erase(i);
} else {
- i++;
+ ++i;
}
}
}
}
void
+SoundManager::pause_music(float fadetime)
+{
+ if(music_source == NULL)
+ return;
+
+ if(fadetime > 0) {
+ if(music_source
+ && music_source->get_fade_state() != StreamSoundSource::FadingPause)
+ music_source->set_fading(StreamSoundSource::FadingPause, fadetime);
+ } else {
+ music_source->pause();
+ }
+}
+
+void
+SoundManager::resume_music(float fadetime)
+{
+ if(music_source == NULL)
+ return;
+
+ if(fadetime > 0) {
+ if(music_source
+ && music_source->get_fade_state() != StreamSoundSource::FadingResume)
+ music_source->set_fading(StreamSoundSource::FadingResume, fadetime);
+ } else {
+ music_source->resume();
+ }
+}
+
+void
SoundManager::set_listener_position(const Vector& pos)
{
static Uint32 lastticks = SDL_GetTicks();
StreamSoundSources::iterator s = update_list.begin();
while( s != update_list.end() ){
(*s)->update();
- s++;
+ ++s;
}
}