|
From: Yoda-JM <yo...@us...> - 2009-07-15 18:26:23
|
Module: performous
Branch: master
Commit: bd465edd28089bfbc50cc8c63a5a115ed33506c0
Author: Vincent Le Ligeour <yo...@us...>
Date: Wed Jul 15 20:25:18 2009 +0200
Changed the behavior of sliding notes
Tried to fixed sync (worse than without sync, please do not enable)
---
game/audio.cc | 9 ++++-----
game/audio.hh | 2 ++
game/songparser-ini.cc | 19 ++++++++++++++++++-
3 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/game/audio.cc b/game/audio.cc
index 0773c59..3ce352d 100644
--- a/game/audio.cc
+++ b/game/audio.cc
@@ -34,18 +34,17 @@ void Audio::operator()(da::pcm_data& areas, da::settings const&) {
std::fill(areas.m_buf, areas.m_buf + samples, 0.0f);
if (!m_paused) {
if(m_need_resync) {
- /*
std::cout << "Audio need to be synched here" << std::endl;
+ /*
// do a fast forward sync
double position = 0.0;
- for (Streams::iterator it = m_streams.begin(); it != m_streams.end();) {
+ for (Streams::iterator it = m_streams.begin(); it != m_streams.end(); ++it) {
+ if( it->fadingout() ) continue;
double tmp = it->mpeg.position();
if( tmp > position ) position = tmp;
- ++it;
}
- for (Streams::iterator it = m_streams.begin(); it != m_streams.end();) {
+ for (Streams::iterator it = m_streams.begin(); it != m_streams.end(); ++it) {
it->mpeg.seek(position);
- ++it;
}
*/
m_need_resync = false;
diff --git a/game/audio.hh b/game/audio.hh
index cabfe30..ca9a3b6 100644
--- a/game/audio.hh
+++ b/game/audio.hh
@@ -85,6 +85,8 @@ struct Stream {
void fadein(double time) { fade = fadeSpeed = 1.0 / (time * srate); }
/// fades stream out
void fadeout(double time) { fadeSpeed = - 1.0 / (time * srate); }
+ /// is the stream fading out
+ bool fadingout() {return fadeSpeed < 0;}
/// crossfades songs
template <typename RndIt> void playmix(RndIt outbuf, unsigned int maxSamples) {
if (prebuffering && mpeg.audioQueue.percentage() > 0.9) prebuffering = false;
diff --git a/game/songparser-ini.cc b/game/songparser-ini.cc
index 82d50cb..caeadaf 100644
--- a/game/songparser-ini.cc
+++ b/game/songparser-ini.cc
@@ -80,7 +80,24 @@ void SongParser::iniParse() {
while (prev != s.notes.rend() && prev->type == Note::SLEEP) ++prev;
if (prev == s.notes.rend()) throw std::runtime_error("The song begins with a slide note");
eraseLast(prev->syllable); // Erase the space if there is any
- n.notePrev = prev->note;
+ {
+ // insert new sliding note
+ Note inter;
+ inter.begin = prev->end;
+ inter.end = n.begin;
+ inter.notePrev = prev->note;
+ inter.note = n.note;
+ inter.type = Note::SLIDE;
+ inter.syllable = std::string("~");
+ m_maxScore += inter.maxScore();
+ s.noteMin = std::min(s.noteMin, inter.note);
+ s.noteMax = std::max(s.noteMax,inter.note);
+ s.notes.push_back(inter);
+ }
+ {
+ // modifying current note to be normal again
+ n.type = Note::NORMAL;
+ }
}
m_maxScore += n.maxScore();
s.noteMin = std::min(s.noteMin, n.note);
|