|
From: Peque <ms...@us...> - 2010-01-08 17:52:09
|
Module: performous
Branch: master
Commit: d33ab240a5c05db78060e775c86da68ffb3f2707
Author: Miguel Sánchez de León Peque <peq...@ho...>
Date: Fri Jan 8 18:51:34 2010 +0100
Preview starts at 5 secs from the beginning.
---
game/screen_songs.cc | 3 ++-
game/song.cc | 1 +
game/song.hh | 1 +
game/songparser-ini.cc | 2 ++
game/songparser-sm.cc | 1 +
game/songparser-txt.cc | 1 +
lang/es.po | 4 ++--
7 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/game/screen_songs.cc b/game/screen_songs.cc
index a91785f..b47283e 100644
--- a/game/screen_songs.cc
+++ b/game/screen_songs.cc
@@ -150,7 +150,8 @@ void ScreenSongs::stopMultimedia(ScreenSharedInfo& info) {
// Play/stop preview playback (if it is the time)
if (info.music != m_playing && m_playTimer.get() > 0.3) {
m_songbg.reset(); m_video.reset();
- if (info.music.empty()) m_audio.fadeout(1.0); else m_audio.playMusic(info.music, true, 2.0);
+ if (m_songs.current().preview_start > 5.0) m_songs.current().preview_start = 5.0; ///< this line is for performance (don't touch it unless you implement better seeking method in songs)
+ if (info.music.empty()) m_audio.fadeout(1.0); else m_audio.playMusic(info.music, true, 2.0, (m_songs.current().preview_start ? m_songs.current().preview_start : 5.0));
if (!info.songbg.empty()) try { m_songbg.reset(new Surface(info.songbg)); } catch (std::exception const&) {}
if (!info.video.empty() && config["graphic/video"].b()) m_video.reset(new Video(info.video, info.videoGap));
m_playing = info.music;
diff --git a/game/song.cc b/game/song.cc
index 5135535..54665d7 100644
--- a/game/song.cc
+++ b/game/song.cc
@@ -28,6 +28,7 @@ void Song::reload(bool errorIgnore) {
noteMax = std::numeric_limits<int>::min();
videoGap = 0.0;
start = 0.0;
+ preview_start = 0.0;
beginTime = endTime = getNaN();
m_scoreFactor = 0.0;
try { SongParser(*this); } catch (...) { if (!errorIgnore) throw; }
diff --git a/game/song.hh b/game/song.hh
index 199d882..9228433 100644
--- a/game/song.hh
+++ b/game/song.hh
@@ -71,6 +71,7 @@ class Song: boost::noncopyable {
static std::string collate(std::string const& str);
double videoGap; ///< gap with video
double start; ///< start of song
+ double preview_start; ///< starting time for the preview
MusicalScale scale; ///< scale in which song is sung
std::vector<double> timePitchGraph; ///< time of pitch graph
std::vector<double> pitchPitchGraph; ///< pitch of pitch graph
diff --git a/game/songparser-ini.cc b/game/songparser-ini.cc
index 6b6a048..caa00d2 100644
--- a/game/songparser-ini.cc
+++ b/game/songparser-ini.cc
@@ -47,10 +47,12 @@ void SongParser::iniParse() {
if (key == "name") s.title = value;
else if (key == "artist") s.artist = value;
// These are added features (not part of FoF, though video is supported in FoFiX SVN)
+ // TODO these tags need to be checked/discussed with FoFiX developers
else if (key == "cover") s.cover = value;
else if (key == "background") s.background = value;
else if (key == "video") s.video = value;
else if (key == "video_start_time") { assign(s.videoGap, value); s.videoGap/=1000.0; }
+ else if (key == "prev_start_time") { assign(s.preview_start, value); s.preview_start/=1000.0; }
// End of added features
}
if (s.title.empty() || s.artist.empty()) throw std::runtime_error("Required header fields missing");
diff --git a/game/songparser-sm.cc b/game/songparser-sm.cc
index e7b8b76..477893e 100644
--- a/game/songparser-sm.cc
+++ b/game/songparser-sm.cc
@@ -139,6 +139,7 @@ bool SongParser::smParseField(std::string line) {
else if (key == "MUSIC") m_song.music["background"] = m_song.path + value;
else if (key == "BACKGROUND") m_song.background = value;
else if (key == "OFFSET") { assign(m_gap, value); m_gap *= -1; }
+ else if (key == "SAMPLESTART") assign(m_song.preview_start, value);
else if (key == "BPMS"){
std::istringstream iss(value);
double ts, bpm;
diff --git a/game/songparser-txt.cc b/game/songparser-txt.cc
index 5612551..25f6b8b 100644
--- a/game/songparser-txt.cc
+++ b/game/songparser-txt.cc
@@ -66,6 +66,7 @@ bool SongParser::txtParseField(std::string const& line) {
else if (key == "BACKGROUND") m_song.background = value;
else if (key == "START") assign(m_song.start, value);
else if (key == "VIDEOGAP") assign(m_song.videoGap, value);
+ else if (key == "PREVIEWSTART") assign(m_song.preview_start, value);
else if (key == "RELATIVE") assign(m_relative, value);
else if (key == "GAP") { assign(m_gap, value); m_gap *= 1e-3; }
else if (key == "BPM") assign(m_bpm, value);
diff --git a/lang/es.po b/lang/es.po
index c198bf8..cf6a472 100644
--- a/lang/es.po
+++ b/lang/es.po
@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Performous\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2010-01-08 12:20+0100\n"
+"POT-Creation-Date: 2010-01-08 12:36+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Miguel Sánchez de León Peque <msd...@gm...>\n"
"Language-Team: \n"
@@ -135,7 +135,7 @@ msgstr "ordenadas por idioma"
#: ../game/screen_sing.cc:338
msgid " ENTER to skip instrumental break"
-msgstr " ENTER para pasar la parte instrumental"
+msgstr " \"ENTER\" para pasar la parte instrumental"
#: ../game/screen_sing.cc:339
msgid " Remember to wait for grading!"
|