|
From: Lasse Kärkkäi. <tr...@us...> - 2009-07-24 03:18:32
|
Module: performous
Branch: master
Commit: ab6978ff0417e20972ddd1c9c93fbe68c2534fa6
Author: Lasse Karkkainen <tro...@tr...>
Date: Fri Jul 24 06:17:52 2009 +0300
A little bit of prebuffering time.
Remove separate playPreview.
---
game/audio.cc | 4 ++--
game/audio.hh | 9 ++-------
game/screen_songs.cc | 2 +-
3 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/game/audio.cc b/game/audio.cc
index 1ca9a5a..6a34d96 100644
--- a/game/audio.cc
+++ b/game/audio.cc
@@ -61,8 +61,8 @@ void Audio::playMusic(std::vector<std::string> const& filenames, bool preview, d
for(std::vector<std::string>::const_iterator it = filenames.begin() ; it != filenames.end() ; ++it ) {
try {
m_streams.push_back(boost::shared_ptr<Stream>(new Stream(*it, m_rs.rate(), preview ? config["audio/preview_volume"] : config["audio/music_volume"])));
- if (fadeTime > 0) m_streams.back()->fadein(fadeTime);
- if (startPos != 0.0) m_streams.back()->seek(startPos);
+ m_streams.back()->fadein(fadeTime);
+ m_streams.back()->seek(startPos);
} catch (std::runtime_error& e) {
std::cerr << "Error loading " << *it << " (" << e.what() << ")" << std::endl;
continue;
diff --git a/game/audio.hh b/game/audio.hh
index 4d1946a..b3125d3 100644
--- a/game/audio.hh
+++ b/game/audio.hh
@@ -123,14 +123,9 @@ class Audio {
* @param fadeTime time to fade
* @param startPos starting position
*/
- void playMusic(std::string const& filename, bool preview = false, double fadeTime = 0.1, double startPos = 0.0);
+ void playMusic(std::string const& filename, bool preview = false, double fadeTime = 0.1, double startPos = -0.1);
/// plays a list of songs
- void playMusic(std::vector<std::string> const& filenames, bool preview = false, double fadeTime = 0.1, double startPos = 0.0);
- /** Play a preview of the song, starting at startPos
- * @param filename the track filename
- * @param startPos starting position
- */
- void playPreview(std::string const& filename, double startPos) { playMusic(filename, true, 1.0, startPos); }
+ void playMusic(std::vector<std::string> const& filenames, bool preview = false, double fadeTime = 0.1, double startPos = -0.1);
/// get pause status
bool isPaused() { return m_paused; }
/// stops music
diff --git a/game/screen_songs.cc b/game/screen_songs.cc
index 80e0aa7..2909060 100644
--- a/game/screen_songs.cc
+++ b/game/screen_songs.cc
@@ -157,7 +157,7 @@ void ScreenSongs::draw() {
// Play/stop preview playback (if it is the time)
if (music != m_playing && m_playTimer.get() > 0.4) {
m_songbg.reset(); m_video.reset();
- if (music.empty()) m_audio.fadeout(); else m_audio.playPreview(music, m_jukebox ? 0.0 : 30.0);
+ if (music.empty()) m_audio.fadeout(); else m_audio.playMusic(music, m_jukebox ? 0.0 : 30.0, true, 0.5);
if (!songbg.empty()) try { m_songbg.reset(new Surface(songbg)); } catch (std::exception const&) {}
if (!video.empty() && config["graphic/video"].b()) m_video.reset(new Video(video, videoGap));
m_playing = music;
|