You can subscribe to this list here.
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(25) |
Jul
(288) |
Aug
(119) |
Sep
(31) |
Oct
(59) |
Nov
(458) |
Dec
(359) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2010 |
Jan
(268) |
Feb
(26) |
Mar
(36) |
Apr
(48) |
May
(119) |
Jun
(37) |
Jul
(173) |
Aug
(429) |
Sep
(137) |
Oct
(156) |
Nov
(59) |
Dec
(45) |
| 2011 |
Jan
(398) |
Feb
(257) |
Mar
(49) |
Apr
(5) |
May
(34) |
Jun
(11) |
Jul
(38) |
Aug
(12) |
Sep
(1) |
Oct
(49) |
Nov
(5) |
Dec
(10) |
| 2012 |
Jan
(21) |
Feb
(32) |
Mar
(20) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(173) |
Aug
|
Sep
(25) |
Oct
(6) |
Nov
(44) |
Dec
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2009-07-20 12:43:00
|
Module: performous
Branch: master
Commit: f01424f583799d8006471ee9e592383b2f5711f2
Author: Lasse Karkkainen <tro...@tr...>
Date: Mon Jul 20 15:42:24 2009 +0300
Move guitar sideways, has funny perspective now :/
---
game/guitargraph.cc | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 17c8c5d..9d08de3 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -15,9 +15,9 @@ GuitarGraph::GuitarGraph(Song const& song): m_song(song), m_neck("guitarneck.svg
void GuitarGraph::draw(double time) {
if (m_song.tracks.empty()) return; // Can't render without tracks (FIXME: actually screen_song should choose a track for us)
Dimensions dimensions(1.0); // FIXME: bogus aspect ratio (is this fixable?)
- dimensions.screenBottom().fixedWidth(0.5f);
+ dimensions.screenBottom().fixedWidth(0.5f).left(-0.5f);
glutil::PushMatrix pmb;
- glTranslatef(0.0f, dimensions.y2(), 0.0f);
+ glTranslatef(0.5 * (dimensions.x1() + dimensions.x2()), dimensions.y2(), 0.0f);
glRotatef(80.0f, 1.0f, 0.0f, 0.0f);
{ float s = dimensions.w() / 5.0f; glScalef(s, s, s); }
// Draw the neck
|
|
From: Yoda-JM <yo...@us...> - 2009-07-20 10:11:32
|
Module: performous Branch: master Commit: d782e0ae3d665849ded282a1ce56ed13762b9d5f Author: Vincent Le Ligeour <v.l...@am...> Date: Mon Jul 20 12:10:49 2009 +0200 Moved lyrics rendering to layouts (still things to do) --- game/layout_singer.cc | 49 +++++++++++++++++++++++++++++++++++++++++ game/layout_singer.hh | 58 +++++++++++++++++++++++++++++++++++++++++++++++++ game/screen_sing.cc | 54 +++++++++++--------------------------------- game/screen_sing.hh | 47 +++------------------------------------ 4 files changed, 125 insertions(+), 83 deletions(-) |
|
From: Lasse Kärkkäi. <tr...@us...> - 2009-07-20 01:38:29
|
Module: performous
Branch: master
Commit: bbc2571920ccae2df3184beb9102395866303f2c
Author: Lasse Karkkainen <tro...@tr...>
Date: Mon Jul 20 04:27:08 2009 +0300
Make application terminate on Alt+F4.
---
game/main.cc | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/game/main.cc b/game/main.cc
index 29e4b36..3b2bae9 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -59,6 +59,10 @@ static void checkEvents_SDL(ScreenManager& sm, Window& window) {
config["graphic/fullscreen"].b() = !config["graphic/fullscreen"].b();
continue; // Already handled here...
}
+ if (keypressed == SDLK_F4 && modifier & KMOD_ALT) {
+ sm.finished();
+ continue; // Already handled here...
+ }
break;
}
sm.getCurrentScreen()->manageEvent(event);
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2009-07-20 01:28:02
|
Module: performous
Branch: 0.3
Commit: bda5b869ade63096930b7bd7913a18e857c241d2
Author: Lasse Karkkainen <tro...@tr...>
Date: Mon Jul 20 04:27:08 2009 +0300
Make application terminate on Alt+F4.
---
game/main.cc | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/game/main.cc b/game/main.cc
index 29e4b36..3b2bae9 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -59,6 +59,10 @@ static void checkEvents_SDL(ScreenManager& sm, Window& window) {
config["graphic/fullscreen"].b() = !config["graphic/fullscreen"].b();
continue; // Already handled here...
}
+ if (keypressed == SDLK_F4 && modifier & KMOD_ALT) {
+ sm.finished();
+ continue; // Already handled here...
+ }
break;
}
sm.getCurrentScreen()->manageEvent(event);
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2009-07-20 01:12:13
|
Module: performous
Branch: master
Commit: f43435b526301abcc191bd0399e4c323a65c3eeb
Author: Lasse Karkkainen <tro...@tr...>
Date: Mon Jul 20 04:11:25 2009 +0300
Add the last beat that sometimes is missing.
---
game/songparser-ini.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/game/songparser-ini.cc b/game/songparser-ini.cc
index 5dc2160..c651b7c 100644
--- a/game/songparser-ini.cc
+++ b/game/songparser-ini.cc
@@ -42,7 +42,7 @@ void SongParser::iniParse() {
testAndAdd(s, "drums.ogg");
testAndAdd(s, "vocals.ogg");
MidiFileParser midi(s.path + "/notes.mid");
- for (uint32_t ts = 0; ts <= midi.ts_last; ts += midi.division) s.beats.push_back(midi.get_seconds(ts));
+ for (uint32_t ts = 0, end = midi.ts_last + midi.division; ts < end; ts += midi.division) s.beats.push_back(midi.get_seconds(ts));
for (MidiFileParser::Tracks::const_iterator it = midi.tracks.begin(); it != midi.tracks.end(); ++it) {
// Figure out the track name
std::string name = it->name;
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2009-07-20 00:40:37
|
Module: performous
Branch: master
Commit: 4f90a6fc10aafa827dd065f6e8fb8f9894de9368
Author: Lasse Karkkainen <tro...@tr...>
Date: Mon Jul 20 03:39:52 2009 +0300
A quick hack to add startup timer to singing screen.
---
game/screen_sing.cc | 19 +++++++++++++++----
game/screen_sing.hh | 1 +
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index e43dd19..098cf83 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -16,6 +16,7 @@ namespace {
void ScreenSing::enter() {
Song& song = m_songs.current();
m_audio.playMusic(song.music);
+ m_audio.togglePause(); // Pause it for startup countdown
theme.reset(new ThemeSing());
if (!song.background.empty()) {
try {
@@ -37,6 +38,8 @@ void ScreenSing::enter() {
m_engine.reset(new Engine(m_audio, m_songs.current(), analyzers.begin(), analyzers.end()));
m_noteGraph.reset(new NoteGraph(song));
if (song.music.size() > 1) m_guitarGraph.reset(new GuitarGraph(song));
+ m_startTimer.setTarget(0.0);
+ m_startTimer.setValue(3.0);
}
void ScreenSing::exit() {
@@ -119,8 +122,15 @@ void ScreenSing::draw() {
Song& song = m_songs.current();
// Get the time in the song
double length = m_audio.getLength();
- double time = clamp(m_audio.getPosition() - config["audio/video_delay"].f(), 0.0, length);
- double songPercent = time / length;
+ double time = -m_startTimer.get();
+ if (time == 0.0 || !m_audio.isPaused()) {
+ if (m_audio.isPaused()) m_audio.togglePause();
+ m_startTimer.setTarget(-1.0);
+ m_startTimer.setValue(-1.0);
+ }
+ if (time >= 0.0) time = m_audio.getPosition();
+ time -= config["audio/video_delay"].f();
+ double songPercent = clamp(time / length);
// Rendering starts
{
@@ -173,8 +183,9 @@ void ScreenSing::draw() {
// Compute and draw the timer and the progressbar
{
+ unsigned t = clamp(time, 0.0, length);
m_progress->draw(songPercent);
- std::string statustxt = (boost::format("%02u:%02u") % (unsigned(time) / 60) % (unsigned(time) % 60)).str();
+ std::string statustxt = (boost::format("%02u:%02u") % (t / 60) % (t % 60)).str();
if (!m_score_window.get()) {
if (status == Song::INSTRUMENTAL_BREAK) statustxt += " ENTER to skip instrumental break";
if (status == Song::FINISHED && !config["game/karaoke_mode"].b()) statustxt += " Remember to wait for grading!";
@@ -197,7 +208,7 @@ void ScreenSing::draw() {
}
}
- if (m_audio.isPaused()) {
+ if (time > 0.0 && m_audio.isPaused()) {
m_pause_icon->dimensions.middle().center().fixedWidth(.25);
m_pause_icon->draw();
}
diff --git a/game/screen_sing.hh b/game/screen_sing.hh
index bcac4f0..d6c67c3 100644
--- a/game/screen_sing.hh
+++ b/game/screen_sing.hh
@@ -102,5 +102,6 @@ class ScreenSing: public Screen {
Notes::const_iterator m_lyricit;
std::deque<LyricRow> m_lyrics;
AnimValue m_quitTimer;
+ AnimValue m_startTimer;
};
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2009-07-20 00:40:33
|
Module: performous
Branch: master
Commit: 979c781f3b86a62081764d51bbdc3a5ae15c052a
Author: Lasse Karkkainen <tro...@tr...>
Date: Mon Jul 20 02:32:52 2009 +0300
Proper BPM handling for guitar loading and render.
---
game/guitargraph.cc | 38 ++++++++++++++++++++++++++------------
game/midifile.cc | 3 ++-
game/midifile.hh | 1 +
game/song.cc | 1 +
game/song.hh | 2 ++
game/songparser-ini.cc | 2 +-
6 files changed, 33 insertions(+), 14 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 2578334..17c8c5d 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -4,6 +4,7 @@ namespace {
const float past = -0.3f;
const float future = 3.0f;
const float timescale = 30.0f;
+ const float texCoordStep = -0.5f; // Two beat lines per neck texture => 0.5 tex units per beat
// Note: t is difference from playback time so it must be in range [past, future]
float time2y(float t) { return -timescale * (t - past) / (future - past); }
float time2a(float t) { return 1.0f - t / future; } // Note: we want 1.0 alpha already at zero t.
@@ -19,22 +20,25 @@ void GuitarGraph::draw(double time) {
glTranslatef(0.0f, dimensions.y2(), 0.0f);
glRotatef(80.0f, 1.0f, 0.0f, 0.0f);
{ float s = dimensions.w() / 5.0f; glScalef(s, s, s); }
+ // Draw the neck
{
UseTexture tex(m_neck);
glutil::Begin block(GL_TRIANGLE_STRIP);
- glTexCoord2f(0.0f, -(time + future)); glColor4f(1.0f, 1.0f, 1.0f, 0.0f); glVertex2f(-2.5f, time2y(future));
- glTexCoord2f(1.0f, -(time + future)); glColor4f(1.0f, 1.0f, 1.0f, 0.0f); glVertex2f(2.5f, time2y(future));
- glTexCoord2f(0.0f, -(time + past)); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glVertex2f(-2.5f, time2y(past));
- glTexCoord2f(1.0f, -(time + past)); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glVertex2f(2.5f, time2y(past));
+ float texCoord = 0.0f;
+ float tBeg = 0.0f, tEnd;
+ for (Song::Beats::const_iterator it = m_song.beats.begin(); it != m_song.beats.end() && tBeg < future; ++it, texCoord += texCoordStep, tBeg = tEnd) {
+ tEnd = *it - time;
+ //if (tEnd < past) continue;
+ if (tEnd > future) {
+ // Crop the end off
+ texCoord -= texCoordStep * (tEnd - future) / (tEnd - tBeg);
+ tEnd = future;
+ }
+ glColor4f(1.0f, 1.0f, 1.0f, time2a(tEnd));
+ glTexCoord2f(0.0f, texCoord); glVertex2f(-2.5f, time2y(tEnd));
+ glTexCoord2f(1.0f, texCoord); glVertex2f(2.5f, time2y(tEnd));
+ }
}
- {
- glutil::Begin block(GL_TRIANGLE_STRIP);
- glColor3f(1.0f, 1.0f, 1.0f);
- glVertex2f(-2.5f, time2y(0.01f));
- glVertex2f(2.5f, time2y(0.01f));
- glVertex2f(-2.5f, time2y(-0.01f));
- glVertex2f(2.5f, time2y(-0.01f));
- }
enum Difficulty {
DIFFICULTY_SUPAEASY,
DIFFICULTY_EASY,
@@ -59,6 +63,7 @@ void GuitarGraph::draw(double time) {
glutil::Color(0.0f, 0.0f, 1.0f),
glutil::Color(1.0f, 0.5f, 0.0f)
};
+ // Draw the notes
NoteMap const& nm = m_song.tracks.begin()->second;
for (int fret = 0; fret < 5; ++fret) {
float x = -2.0f + fret;
@@ -89,4 +94,13 @@ void GuitarGraph::draw(double time) {
}
}
glColor3f(1.0f, 1.0f, 1.0f);
+ // Draw the cursor
+ {
+ glutil::Begin block(GL_TRIANGLE_STRIP);
+ glVertex2f(-2.5f, time2y(0.01f));
+ glVertex2f(2.5f, time2y(0.01f));
+ glVertex2f(-2.5f, time2y(-0.01f));
+ glVertex2f(2.5f, time2y(-0.01f));
+ }
}
+
diff --git a/game/midifile.cc b/game/midifile.cc
index 939fe99..a1f4a0b 100644
--- a/game/midifile.cc
+++ b/game/midifile.cc
@@ -117,7 +117,7 @@ void MidiStream::Riff::seek_back(size_t o) {
MidiFileParser::MidiFileParser(std::string name):
- format(0), division(0)
+ format(0), division(0), ts_last(0)
{
MidiStream stream(name.c_str());
size_t ntracks = parse_header(stream);
@@ -213,6 +213,7 @@ MidiFileParser::Track MidiFileParser::read_track(MidiStream& stream) {
process_midi_event(track, event >> 4, arg1, arg2, miditime);
}
}
+ if (miditime > ts_last) ts_last = miditime;
return track;
}
diff --git a/game/midifile.hh b/game/midifile.hh
index f80162c..2ce9c46 100644
--- a/game/midifile.hh
+++ b/game/midifile.hh
@@ -86,6 +86,7 @@ class MidiFileParser{
/** Ticks per beat == number of divisions per every quarter note **/
uint16_t division;
+ uint32_t ts_last;
private:
std::string m_lyric;
};
diff --git a/game/song.cc b/game/song.cc
index 7bcac8b..31de0c2 100644
--- a/game/song.cc
+++ b/game/song.cc
@@ -6,6 +6,7 @@
void Song::reload(bool errorIgnore) {
notes.clear();
tracks.clear();
+ beats.clear();
category.clear();
genre.clear();
edition.clear();
diff --git a/game/song.hh b/game/song.hh
index 9975662..39e58d1 100644
--- a/game/song.hh
+++ b/game/song.hh
@@ -38,6 +38,8 @@ class Song: boost::noncopyable {
int randomIdx; ///< sorting index used for random order
Notes notes; ///< notes for song (only used for singing)
Tracks tracks; ///< guitar etc. notes for this song
+ typedef std::vector<double> Beats;
+ Beats beats;
int noteMin, ///< lowest note
noteMax; ///< highest note
std::string path; ///< path of songfile
diff --git a/game/songparser-ini.cc b/game/songparser-ini.cc
index 71bb0f6..5dc2160 100644
--- a/game/songparser-ini.cc
+++ b/game/songparser-ini.cc
@@ -42,7 +42,7 @@ void SongParser::iniParse() {
testAndAdd(s, "drums.ogg");
testAndAdd(s, "vocals.ogg");
MidiFileParser midi(s.path + "/notes.mid");
- for (MidiFileParser::TempoChanges::const_iterator it = midi.tempochanges.begin(); it != midi.tempochanges.end(); ++it) addBPM(it->miditime * 4, it->value);
+ for (uint32_t ts = 0; ts <= midi.ts_last; ts += midi.division) s.beats.push_back(midi.get_seconds(ts));
for (MidiFileParser::Tracks::const_iterator it = midi.tracks.begin(); it != midi.tracks.end(); ++it) {
// Figure out the track name
std::string name = it->name;
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2009-07-19 22:14:21
|
Module: performous
Branch: master
Commit: 84659f0403c8456e034f6614f3491ffc6f058a0f
Author: Lasse Karkkainen <tro...@tr...>
Date: Mon Jul 20 01:13:49 2009 +0300
Guitar note fixes.
---
game/guitargraph.cc | 26 +++++++++++++++++---------
game/songparser-ini.cc | 4 +++-
2 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index d7a27e7..2578334 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -21,19 +21,19 @@ void GuitarGraph::draw(double time) {
{ float s = dimensions.w() / 5.0f; glScalef(s, s, s); }
{
UseTexture tex(m_neck);
- glutil::Begin block(GL_QUADS);
+ glutil::Begin block(GL_TRIANGLE_STRIP);
glTexCoord2f(0.0f, -(time + future)); glColor4f(1.0f, 1.0f, 1.0f, 0.0f); glVertex2f(-2.5f, time2y(future));
glTexCoord2f(1.0f, -(time + future)); glColor4f(1.0f, 1.0f, 1.0f, 0.0f); glVertex2f(2.5f, time2y(future));
- glTexCoord2f(1.0f, -(time + past)); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glVertex2f(2.5f, time2y(past));
glTexCoord2f(0.0f, -(time + past)); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glVertex2f(-2.5f, time2y(past));
+ glTexCoord2f(1.0f, -(time + past)); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glVertex2f(2.5f, time2y(past));
}
{
- glutil::Begin block(GL_QUADS);
+ glutil::Begin block(GL_TRIANGLE_STRIP);
glColor3f(1.0f, 1.0f, 1.0f);
glVertex2f(-2.5f, time2y(0.01f));
glVertex2f(2.5f, time2y(0.01f));
- glVertex2f(2.5f, time2y(-0.01f));
glVertex2f(-2.5f, time2y(-0.01f));
+ glVertex2f(2.5f, time2y(-0.01f));
}
enum Difficulty {
DIFFICULTY_SUPAEASY,
@@ -67,17 +67,25 @@ void GuitarGraph::draw(double time) {
NoteMap::const_iterator it = nm.find(basepitch + fret);
if (it == nm.end()) continue;
Durations const& durs = it->second;
- glutil::Begin block(GL_QUADS);
for (Durations::const_iterator it2 = durs.begin(); it2 != durs.end(); ++it2) {
float tBeg = it2->begin - time;
float tEnd = it2->end - time;
+ if (tEnd < past) continue;
if (tBeg > future) break;
+ float wEnd = 0.5f * w;
+ if (tEnd > future) {
+ // Crop the end off
+ float f = (future - tBeg) / (tEnd - tBeg);
+ wEnd = f * wEnd + (1.0f - f) * w; // Balanced average
+ tEnd = future;
+ }
+ glutil::Begin block(GL_TRIANGLE_STRIP);
+ c.a = time2a(tEnd); glColor4fv(c);
+ glVertex2f(x - wEnd, time2y(tEnd));
+ glVertex2f(x + wEnd, time2y(tEnd));
c.a = time2a(tBeg); glColor4fv(c);
- glVertex2f(x - 0.5f * w, time2y(tEnd));
- glVertex2f(x + 0.5f * w, time2y(tEnd));
- c.a = time2a(tBeg); glColor4fv(c);
- glVertex2f(x + w, time2y(tBeg));
glVertex2f(x - w, time2y(tBeg));
+ glVertex2f(x + w, time2y(tBeg));
}
}
glColor3f(1.0f, 1.0f, 1.0f);
diff --git a/game/songparser-ini.cc b/game/songparser-ini.cc
index 5ef4d12..71bb0f6 100644
--- a/game/songparser-ini.cc
+++ b/game/songparser-ini.cc
@@ -57,7 +57,9 @@ void SongParser::iniParse() {
Durations& dur = nm[it2->first];
MidiFileParser::Notes const& notes = it2->second;
for (MidiFileParser::Notes::const_iterator it3 = notes.begin(); it3 != notes.end(); ++it3) {
- dur.push_back(Duration(midi.get_seconds(it3->begin), midi.get_seconds(it3->end)));
+ double beg = midi.get_seconds(it3->begin);
+ double end = midi.get_seconds(it3->end);
+ if (beg < end) dur.push_back(Duration(beg, end));
}
}
continue;
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2009-07-19 21:32:02
|
Module: performous Branch: master Commit: 2e5f8ad0f1e575679255ee4bd59ecdc2c869d88d Author: Lasse Karkkainen <tro...@tr...> Date: Mon Jul 20 00:31:24 2009 +0300 Merge branch 'master' of ssh://tronic@performous.git.sourceforge.net/gitroot/performous --- |
|
From: Lasse Kärkkäi. <tr...@us...> - 2009-07-19 21:32:00
|
Module: performous
Branch: master
Commit: e4d69bf121ef6604477c332210413df277797222
Author: Lasse Karkkainen <tro...@tr...>
Date: Mon Jul 20 00:29:37 2009 +0300
Find guitar track from some older format MIDI files too.
Guitar graph improvements and cleanup.
---
game/guitargraph.cc | 61 ++++++++++++++++++++++++++++++-----------------
game/songparser-ini.cc | 3 +-
2 files changed, 41 insertions(+), 23 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 79872fc..d7a27e7 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -1,31 +1,47 @@
#include "guitargraph.hh"
+namespace {
+ const float past = -0.3f;
+ const float future = 3.0f;
+ const float timescale = 30.0f;
+ // Note: t is difference from playback time so it must be in range [past, future]
+ float time2y(float t) { return -timescale * (t - past) / (future - past); }
+ float time2a(float t) { return 1.0f - t / future; } // Note: we want 1.0 alpha already at zero t.
+}
+
GuitarGraph::GuitarGraph(Song const& song): m_song(song), m_neck("guitarneck.svg") {}
void GuitarGraph::draw(double time) {
if (m_song.tracks.empty()) return; // Can't render without tracks (FIXME: actually screen_song should choose a track for us)
+ Dimensions dimensions(1.0); // FIXME: bogus aspect ratio (is this fixable?)
+ dimensions.screenBottom().fixedWidth(0.5f);
glutil::PushMatrix pmb;
- glTranslatef(0.0f, 0.3f, 0.0f);
+ glTranslatef(0.0f, dimensions.y2(), 0.0f);
glRotatef(80.0f, 1.0f, 0.0f, 0.0f);
- glScalef(0.1f, 0.1f, 0.1f);
- float ts = 12.0f;
- float future = 3.0f;
+ { float s = dimensions.w() / 5.0f; glScalef(s, s, s); }
{
UseTexture tex(m_neck);
glutil::Begin block(GL_QUADS);
- glTexCoord2f(0.0f, -(time + future)); glColor4f(1.0f, 1.0f, 1.0f, 0.0f); glVertex2f(-2.5f, -future * ts);
- glTexCoord2f(1.0f, -(time + future)); glColor4f(1.0f, 1.0f, 1.0f, 0.0f); glVertex2f(2.5f, -future * ts);
- glTexCoord2f(1.0f, -(time + 0.0f)); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glVertex2f(2.5f, 0.0f * ts);
- glTexCoord2f(0.0f, -(time + 0.0f)); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glVertex2f(-2.5f, 0.0f * ts);
- glColor3f(1.0f, 1.0f, 1.0f);
+ glTexCoord2f(0.0f, -(time + future)); glColor4f(1.0f, 1.0f, 1.0f, 0.0f); glVertex2f(-2.5f, time2y(future));
+ glTexCoord2f(1.0f, -(time + future)); glColor4f(1.0f, 1.0f, 1.0f, 0.0f); glVertex2f(2.5f, time2y(future));
+ glTexCoord2f(1.0f, -(time + past)); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glVertex2f(2.5f, time2y(past));
+ glTexCoord2f(0.0f, -(time + past)); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glVertex2f(-2.5f, time2y(past));
}
+ {
+ glutil::Begin block(GL_QUADS);
+ glColor3f(1.0f, 1.0f, 1.0f);
+ glVertex2f(-2.5f, time2y(0.01f));
+ glVertex2f(2.5f, time2y(0.01f));
+ glVertex2f(2.5f, time2y(-0.01f));
+ glVertex2f(-2.5f, time2y(-0.01f));
+ }
enum Difficulty {
DIFFICULTY_SUPAEASY,
DIFFICULTY_EASY,
DIFFICULTY_MEDIUM,
DIFFICULTY_AMAZING,
DIFFICULTYCOUNT
- } level = DIFFICULTY_MEDIUM;
+ } level = DIFFICULTY_AMAZING;
int basepitch;
switch (level) {
@@ -45,23 +61,24 @@ void GuitarGraph::draw(double time) {
};
NoteMap const& nm = m_song.tracks.begin()->second;
for (int fret = 0; fret < 5; ++fret) {
+ float x = -2.0f + fret;
+ float w = 0.5f;
+ glutil::Color c = fretColors[fret];
NoteMap::const_iterator it = nm.find(basepitch + fret);
if (it == nm.end()) continue;
Durations const& durs = it->second;
+ glutil::Begin block(GL_QUADS);
for (Durations::const_iterator it2 = durs.begin(); it2 != durs.end(); ++it2) {
- glutil::Begin block(GL_QUADS);
- float tBeg = -(time - it2->begin);
- float tEnd = -(time - it2->end);
+ float tBeg = it2->begin - time;
+ float tEnd = it2->end - time;
if (tBeg > future) break;
- float x = -2.0f + fret;
- float w = 0.25f;
- glutil::Color c = fretColors[fret];
- c.a = 1.0f - tEnd / future; glColor4fv(c);
- glVertex2f(x - w, -tEnd * ts);
- glVertex2f(x + w, -tEnd * ts);
- c.a = 1.0f - tBeg / future; glColor4fv(c);
- glVertex2f(x + w, -tBeg * ts);
- glVertex2f(x - w, -tBeg * ts);
+ c.a = time2a(tBeg); glColor4fv(c);
+ glVertex2f(x - 0.5f * w, time2y(tEnd));
+ glVertex2f(x + 0.5f * w, time2y(tEnd));
+ c.a = time2a(tBeg); glColor4fv(c);
+ glVertex2f(x + w, time2y(tBeg));
+ glVertex2f(x - w, time2y(tBeg));
}
}
+ glColor3f(1.0f, 1.0f, 1.0f);
}
diff --git a/game/songparser-ini.cc b/game/songparser-ini.cc
index 15bcad5..c309689 100644
--- a/game/songparser-ini.cc
+++ b/game/songparser-ini.cc
@@ -45,7 +45,8 @@ void SongParser::iniParse() {
for (MidiFileParser::Tracks::const_iterator it = midi.tracks.begin(); it != midi.tracks.end(); ++it) {
// Figure out the track name
std::string name = it->name;
- if (midi.tracks.size() == 1) name = "GUITAR";
+ if (midi.tracks.size() == 1) name = "GUITAR"; // Original (old) FoF songs only have one track
+ else if (name == "T1 GEMS") name = "GUITAR"; // Some old MIDI files have a track named T1 GEMS
else if (name.substr(0, 5) != "PART ") continue;
else name.erase(0, 5);
// Process non-vocal tracks
|
|
From: knittl <kn...@us...> - 2009-07-19 18:33:22
|
Module: performous
Branch: master
Commit: f38f1dbe91f8ed52a956f351d3e27fd8bc99fdc3
Author: knittl <knittl@kbook.(none)>
Date: Sun Jul 19 20:28:40 2009 +0200
doxygen update
midifile.hh still missing documentation. probably not needed, as there
is a commented private label
---
game/audio.hh | 2 ++
game/glutil.hh | 14 ++++++++++++--
game/joystick.hh | 6 ++++++
game/midifile.cc | 1 +
game/notes.hh | 9 ++++++++-
game/profiler.hh | 3 +++
game/songparser-ini.cc | 3 ++-
game/songparser-txt.cc | 3 ++-
8 files changed, 36 insertions(+), 5 deletions(-)
diff --git a/game/audio.hh b/game/audio.hh
index ca4da4c..93d5917 100644
--- a/game/audio.hh
+++ b/game/audio.hh
@@ -87,6 +87,7 @@ struct Stream {
void fadeout(double time) { fadeSpeed = - 1.0 / (time * srate); }
/// is the stream fading out
bool fadingout() {return fadeSpeed < 0;}
+ /// consume duration seconds of stream
bool consume(double duration) {
std::vector<int16_t> buf;
unsigned int samples = srate * duration;
@@ -132,6 +133,7 @@ class Audio {
* @param startPos starting position
*/
void playMusic(std::string const& filename, bool preview = false, double fadeTime = 0.1, double startPos = 0.0);
+ /// 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
diff --git a/game/glutil.hh b/game/glutil.hh
index e84093a..90a1b09 100644
--- a/game/glutil.hh
+++ b/game/glutil.hh
@@ -3,20 +3,30 @@
#include <GL/glew.h>
namespace glutil {
+ /// wrapper struct for RAII
struct PushMatrix {
PushMatrix() { glPushMatrix(); }
~PushMatrix() { glPopMatrix(); }
};
+ /// wrapper struct for RAII
struct Begin {
+ /// call glBegin with given mode
Begin(GLint mode) { glBegin(mode); }
~Begin() { glEnd(); }
};
-
+
+ /// struct to store color information
struct Color {
- float r, g, b, a;
+ float r, ///< red component
+ g, ///< green
+ b, ///< blue
+ a; ///< alpha value
+ /// create nec Color object with given channels
Color(float r_, float g_, float b_, float a_ = 1.0): r(r_), g(g_), b(b_), a(a_) {}
+ /// overload float cast
operator float*() { return reinterpret_cast<float*>(this); }
+ /// overload float const cast
operator float const*() const { return reinterpret_cast<float const*>(this); }
};
}
diff --git a/game/joystick.hh b/game/joystick.hh
index 8ec4f61..ea1f4a4 100644
--- a/game/joystick.hh
+++ b/game/joystick.hh
@@ -12,14 +12,20 @@
void joysticks_init();
+/// joystick class used for dealing with ps3 drumsets
class Joystick {
public:
Joystick() {};
+ /// create joystick object with given id
Joystick(unsigned int _id);
~Joystick();
+ /// get name of joystick
std::string getName() const;
+ /// get longer description of joystick
std::string getDescription() const;
+ /// returns true if the button with _button_id is pressed
bool buttonState(unsigned char _button_id) const;
+ /// hi-hat
unsigned char hat(unsigned char _hat_id) const;
short axe(unsigned char _axe_id) const;
std::pair<int, int> ball(int _ball_id) const;
diff --git a/game/midifile.cc b/game/midifile.cc
index c6eabb7..939fe99 100644
--- a/game/midifile.cc
+++ b/game/midifile.cc
@@ -32,6 +32,7 @@ class MidiStream {
f.exceptions(std::ios::failbit);
}
+ /// read bytes
std::string read_bytes(size_t bytes);
class Riff {
diff --git a/game/notes.hh b/game/notes.hh
index a7ace84..84a81c3 100644
--- a/game/notes.hh
+++ b/game/notes.hh
@@ -29,11 +29,16 @@ class MusicalScale {
double getNoteOffset(double freq) const;
};
+/// stores duration of a note
struct Duration {
- double begin, end; ///< Beginning and ending timestamps is seconds
+ double begin, ///< beginning timestamp in seconds
+ end; ///< ending timestamp in seconds
Duration();
+ /// create a new Duration object and initialize begin and end
Duration(double b, double e): begin(b), end(e) {}
+ /// compares begin timestamps of two Duration structs
static bool ltBegin(Duration const& a, Duration const& b) { return a.begin < b.begin; }
+ /// compares end timestamps of two Duration structs
static bool ltEnd(Duration const& a, Duration const& b) { return a.end < b.end; }
};
@@ -64,7 +69,9 @@ struct Note {
double maxScore() const;
/// score when singing
double score(double freq, double b, double e) const;
+ /// compares begin of two notes
static bool ltBegin(Note const& a, Note const& b) { return a.begin < b.begin; }
+ /// compares end of two notes
static bool ltEnd(Note const& a, Note const& b) { return a.end < b.end; }
private:
double scoreMultiplier(double error) const;
diff --git a/game/profiler.hh b/game/profiler.hh
index 256a2fc..a93f191 100644
--- a/game/profiler.hh
+++ b/game/profiler.hh
@@ -5,12 +5,15 @@
#include <sstream>
#include <string>
+/// easy access for profiling code
class Profiler {
std::ostringstream m_oss;
boost::xtime m_time;
public:
+ /// create a new profiler with a given name
Profiler(std::string const& name): m_time(now()) { m_oss << name << ": "; }
~Profiler() { std::clog << m_oss.str() << std::endl; }
+ /// calling the object as a function will return the time since the start
void operator()(std::string const& tag) {
boost::xtime n = now();
std::swap(n, m_time);
diff --git a/game/songparser-ini.cc b/game/songparser-ini.cc
index 15bcad5..e16c343 100644
--- a/game/songparser-ini.cc
+++ b/game/songparser-ini.cc
@@ -3,7 +3,8 @@
#include <boost/filesystem.hpp>
#include "midifile.hh"
-/// @file Functions used for parsing the UltraStar TXT song format
+/// @file
+/// Functions used for parsing the UltraStar TXT song format
bool SongParser::iniCheck(std::vector<char> const& data) {
static const std::string header = "[song]";
diff --git a/game/songparser-txt.cc b/game/songparser-txt.cc
index 27fe608..3c83b58 100644
--- a/game/songparser-txt.cc
+++ b/game/songparser-txt.cc
@@ -1,6 +1,7 @@
#include "songparser.hh"
-/// @file Functions used for parsing the UltraStar TXT song format
+/// @file
+/// Functions used for parsing the UltraStar TXT song format
namespace {
void assign(int& var, std::string const& str) {
|
|
From: Yoda-JM <yo...@us...> - 2009-07-18 20:04:55
|
Module: performous
Branch: master
Commit: c8892b11a258b989974d3b40c8528265faa56439
Author: Vincent Le Ligeour <yo...@us...>
Date: Sat Jul 18 22:04:13 2009 +0200
Fixed stream consume when no frame need to be consumed
---
game/audio.hh | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/game/audio.hh b/game/audio.hh
index 876ca3c..ca4da4c 100644
--- a/game/audio.hh
+++ b/game/audio.hh
@@ -90,12 +90,10 @@ struct Stream {
bool consume(double duration) {
std::vector<int16_t> buf;
unsigned int samples = srate * duration;
+ if( samples == 0 ) return true;
mpeg.audioQueue.tryPop(buf, samples);
- if( buf.size() == samples ) {
- return true;
- } else {
- return false;
- }
+ if( buf.size() == samples ) return true;
+ return false;
}
/// crossfades songs
template <typename RndIt> void playmix(RndIt outbuf, unsigned int maxSamples) {
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2009-07-18 18:53:30
|
Module: performous
Branch: master
Commit: a3c44133b1b9a2c5430a9d4fdff4204fb3500794
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Jul 18 21:46:46 2009 +0300
Add comments and make it works with old format single-track MIDI too.
---
game/songparser-ini.cc | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/game/songparser-ini.cc b/game/songparser-ini.cc
index cfc993d..15bcad5 100644
--- a/game/songparser-ini.cc
+++ b/game/songparser-ini.cc
@@ -43,8 +43,12 @@ void SongParser::iniParse() {
MidiFileParser midi(s.path + "/notes.mid");
for (MidiFileParser::TempoChanges::const_iterator it = midi.tempochanges.begin(); it != midi.tempochanges.end(); ++it) addBPM(it->miditime * 4, it->value);
for (MidiFileParser::Tracks::const_iterator it = midi.tracks.begin(); it != midi.tracks.end(); ++it) {
- if (it->name.substr(0, 5) != "PART ") continue;
- std::string name = it->name.substr(5);
+ // Figure out the track name
+ std::string name = it->name;
+ if (midi.tracks.size() == 1) name = "GUITAR";
+ else if (name.substr(0, 5) != "PART ") continue;
+ else name.erase(0, 5);
+ // Process non-vocal tracks
if (name != "VOCALS") {
NoteMap& nm = s.tracks[name];
for (MidiFileParser::NoteMap::const_iterator it2 = it->notes.begin(); it2 != it->notes.end(); ++it2) {
@@ -54,7 +58,9 @@ void SongParser::iniParse() {
dur.push_back(Duration(midi.get_seconds(it3->begin), midi.get_seconds(it3->end)));
}
}
+ continue;
}
+ // Process vocal tracks
for (MidiFileParser::Lyrics::const_iterator it2 = it->lyrics.begin(); it2 != it->lyrics.end(); ++it2) {
Note n;
n.begin = midi.get_seconds(it2->begin);
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2009-07-18 18:35:35
|
Module: performous
Branch: master
Commit: 9b19d01eda805464b1889ac43be1afd43c3dd36b
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Jul 18 20:59:44 2009 +0300
Very hacky guitar note drawing.
---
game/glutil.hh | 7 +++++
game/guitargraph.cc | 62 +++++++++++++++++++++++++++++++++++++++++++++-----
2 files changed, 62 insertions(+), 7 deletions(-)
diff --git a/game/glutil.hh b/game/glutil.hh
index 96c9541..e84093a 100644
--- a/game/glutil.hh
+++ b/game/glutil.hh
@@ -12,5 +12,12 @@ namespace glutil {
Begin(GLint mode) { glBegin(mode); }
~Begin() { glEnd(); }
};
+
+ struct Color {
+ float r, g, b, a;
+ Color(float r_, float g_, float b_, float a_ = 1.0): r(r_), g(g_), b(b_), a(a_) {}
+ operator float*() { return reinterpret_cast<float*>(this); }
+ operator float const*() const { return reinterpret_cast<float const*>(this); }
+ };
}
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 86a2273..79872fc 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -3,17 +3,65 @@
GuitarGraph::GuitarGraph(Song const& song): m_song(song), m_neck("guitarneck.svg") {}
void GuitarGraph::draw(double time) {
- UseTexture tex(m_neck);
+ if (m_song.tracks.empty()) return; // Can't render without tracks (FIXME: actually screen_song should choose a track for us)
glutil::PushMatrix pmb;
glTranslatef(0.0f, 0.3f, 0.0f);
glRotatef(80.0f, 1.0f, 0.0f, 0.0f);
glScalef(0.1f, 0.1f, 0.1f);
float ts = 12.0f;
float future = 3.0f;
- glutil::Begin block(GL_QUADS);
- glTexCoord2f(0.0f, -(time + future)); glColor4f(1.0f, 1.0f, 1.0f, 0.0f); glVertex2f(-2.5f, -future * ts);
- glTexCoord2f(1.0f, -(time + future)); glColor4f(1.0f, 1.0f, 1.0f, 0.0f); glVertex2f(2.5f, -future * ts);
- glTexCoord2f(1.0f, -(time + 0.0f)); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glVertex2f(2.5f, 0.0f * ts);
- glTexCoord2f(0.0f, -(time + 0.0f)); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glVertex2f(-2.5f, 0.0f * ts);
- glColor3f(1.0f, 1.0f, 1.0f);
+ {
+ UseTexture tex(m_neck);
+ glutil::Begin block(GL_QUADS);
+ glTexCoord2f(0.0f, -(time + future)); glColor4f(1.0f, 1.0f, 1.0f, 0.0f); glVertex2f(-2.5f, -future * ts);
+ glTexCoord2f(1.0f, -(time + future)); glColor4f(1.0f, 1.0f, 1.0f, 0.0f); glVertex2f(2.5f, -future * ts);
+ glTexCoord2f(1.0f, -(time + 0.0f)); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glVertex2f(2.5f, 0.0f * ts);
+ glTexCoord2f(0.0f, -(time + 0.0f)); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glVertex2f(-2.5f, 0.0f * ts);
+ glColor3f(1.0f, 1.0f, 1.0f);
+ }
+ enum Difficulty {
+ DIFFICULTY_SUPAEASY,
+ DIFFICULTY_EASY,
+ DIFFICULTY_MEDIUM,
+ DIFFICULTY_AMAZING,
+ DIFFICULTYCOUNT
+ } level = DIFFICULTY_MEDIUM;
+
+ int basepitch;
+ switch (level) {
+ case DIFFICULTY_SUPAEASY: basepitch = 0x3c; break;
+ case DIFFICULTY_EASY: basepitch = 0x48; break;
+ case DIFFICULTY_MEDIUM: basepitch = 0x54; break;
+ case DIFFICULTY_AMAZING: basepitch = 0x60; break;
+ default: throw std::logic_error("Invalid difficulty level");
+ }
+
+ static glutil::Color fretColors[5] = {
+ glutil::Color(0.0f, 1.0f, 0.0f),
+ glutil::Color(1.0f, 0.0f, 0.0f),
+ glutil::Color(1.0f, 1.0f, 0.0f),
+ glutil::Color(0.0f, 0.0f, 1.0f),
+ glutil::Color(1.0f, 0.5f, 0.0f)
+ };
+ NoteMap const& nm = m_song.tracks.begin()->second;
+ for (int fret = 0; fret < 5; ++fret) {
+ NoteMap::const_iterator it = nm.find(basepitch + fret);
+ if (it == nm.end()) continue;
+ Durations const& durs = it->second;
+ for (Durations::const_iterator it2 = durs.begin(); it2 != durs.end(); ++it2) {
+ glutil::Begin block(GL_QUADS);
+ float tBeg = -(time - it2->begin);
+ float tEnd = -(time - it2->end);
+ if (tBeg > future) break;
+ float x = -2.0f + fret;
+ float w = 0.25f;
+ glutil::Color c = fretColors[fret];
+ c.a = 1.0f - tEnd / future; glColor4fv(c);
+ glVertex2f(x - w, -tEnd * ts);
+ glVertex2f(x + w, -tEnd * ts);
+ c.a = 1.0f - tBeg / future; glColor4fv(c);
+ glVertex2f(x + w, -tBeg * ts);
+ glVertex2f(x - w, -tBeg * ts);
+ }
+ }
}
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2009-07-18 16:53:24
|
Module: performous
Branch: master
Commit: b5ec66c163ae29189ceaeb71a6f2c8d88e0198eb
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Jul 18 19:50:57 2009 +0300
Convert notes from MidiFileParser into tracks in Song.
---
game/notes.cc | 2 ++
game/notes.hh | 15 +++++++++++++++
game/song.cc | 1 +
game/song.hh | 3 ++-
game/songparser-ini.cc | 13 ++++++++++++-
5 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/game/notes.cc b/game/notes.cc
index 90b1594..49664e0 100644
--- a/game/notes.cc
+++ b/game/notes.cc
@@ -78,3 +78,5 @@ double Note::scoreMultiplier(double error) const {
return accuracy * max;
}
+Duration::Duration(): begin(getNaN()), end(getNaN()) {}
+
diff --git a/game/notes.hh b/game/notes.hh
index 7a486d4..a7ace84 100644
--- a/game/notes.hh
+++ b/game/notes.hh
@@ -1,5 +1,6 @@
#pragma once
+#include <map>
#include <string>
#include <vector>
@@ -28,6 +29,20 @@ class MusicalScale {
double getNoteOffset(double freq) const;
};
+struct Duration {
+ double begin, end; ///< Beginning and ending timestamps is seconds
+ Duration();
+ Duration(double b, double e): begin(b), end(e) {}
+ static bool ltBegin(Duration const& a, Duration const& b) { return a.begin < b.begin; }
+ static bool ltEnd(Duration const& a, Duration const& b) { return a.end < b.end; }
+};
+
+typedef std::vector<Duration> Durations;
+typedef std::map<int, Durations> NoteMap;
+typedef std::map<std::string, NoteMap> Tracks;
+
+// TODO: Make Note use Duration
+
/// note read from songfile
struct Note {
Note();
diff --git a/game/song.cc b/game/song.cc
index afdb8d5..7bcac8b 100644
--- a/game/song.cc
+++ b/game/song.cc
@@ -5,6 +5,7 @@
void Song::reload(bool errorIgnore) {
notes.clear();
+ tracks.clear();
category.clear();
genre.clear();
edition.clear();
diff --git a/game/song.hh b/game/song.hh
index 6f7ec6c..9975662 100644
--- a/game/song.hh
+++ b/game/song.hh
@@ -36,7 +36,8 @@ class Song: boost::noncopyable {
/** Get the song status at a given timestamp **/
Status status(double time) const;
int randomIdx; ///< sorting index used for random order
- Notes notes; ///< notes for song
+ Notes notes; ///< notes for song (only used for singing)
+ Tracks tracks; ///< guitar etc. notes for this song
int noteMin, ///< lowest note
noteMax; ///< highest note
std::string path; ///< path of songfile
diff --git a/game/songparser-ini.cc b/game/songparser-ini.cc
index caeadaf..cfc993d 100644
--- a/game/songparser-ini.cc
+++ b/game/songparser-ini.cc
@@ -43,7 +43,18 @@ void SongParser::iniParse() {
MidiFileParser midi(s.path + "/notes.mid");
for (MidiFileParser::TempoChanges::const_iterator it = midi.tempochanges.begin(); it != midi.tempochanges.end(); ++it) addBPM(it->miditime * 4, it->value);
for (MidiFileParser::Tracks::const_iterator it = midi.tracks.begin(); it != midi.tracks.end(); ++it) {
- if (it->name != "PART VOCALS") continue;
+ if (it->name.substr(0, 5) != "PART ") continue;
+ std::string name = it->name.substr(5);
+ if (name != "VOCALS") {
+ NoteMap& nm = s.tracks[name];
+ for (MidiFileParser::NoteMap::const_iterator it2 = it->notes.begin(); it2 != it->notes.end(); ++it2) {
+ Durations& dur = nm[it2->first];
+ MidiFileParser::Notes const& notes = it2->second;
+ for (MidiFileParser::Notes::const_iterator it3 = notes.begin(); it3 != notes.end(); ++it3) {
+ dur.push_back(Duration(midi.get_seconds(it3->begin), midi.get_seconds(it3->end)));
+ }
+ }
+ }
for (MidiFileParser::Lyrics::const_iterator it2 = it->lyrics.begin(); it2 != it->lyrics.end(); ++it2) {
Note n;
n.begin = midi.get_seconds(it2->begin);
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2009-07-18 16:50:17
|
Module: performous
Branch: master
Commit: 58311481bb1e69390d9a93a3c8c1de0b9cdc51a1
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Jul 18 19:49:17 2009 +0300
Lift the restriction that songs always need to have (vocal) notes.
---
game/notegraph.cc | 3 ++-
game/songparser.hh | 1 -
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/game/notegraph.cc b/game/notegraph.cc
index d82dc91..31fdd5a 100644
--- a/game/notegraph.cc
+++ b/game/notegraph.cc
@@ -167,6 +167,7 @@ namespace {
}
void NoteGraph::drawWaves(std::list<Player> const& players) {
+ if (m_song.notes.empty()) return; // Cannot draw without notes
UseTexture tblock(m_wave);
//glBlendFunc(GL_SRC_ALPHA, GL_ONE);
for (std::list<Player>::const_iterator p = players.begin(); p != players.end(); ++p) {
@@ -196,7 +197,7 @@ void NoteGraph::drawWaves(std::list<Player> const& players) {
Notes::const_iterator notePrev = noteIt;
while (notePrev != m_song.notes.begin() && (notePrev->type == Note::SLEEP || t < notePrev->begin)) --notePrev;
bool hasNote = (noteIt != m_song.notes.end());
- bool hasPrev = (notePrev->type != Note::SLEEP && t >= notePrev->begin);
+ bool hasPrev = notePrev->type != Note::SLEEP && t >= notePrev->begin;
double val;
if (hasNote && hasPrev) val = 0.5 * (noteIt->note + notePrev->note);
else if (hasNote) val = noteIt->note;
diff --git a/game/songparser.hh b/game/songparser.hh
index 3714064..56e939f 100644
--- a/game/songparser.hh
+++ b/game/songparser.hh
@@ -46,7 +46,6 @@ class SongParser {
} catch (std::runtime_error& e) {
throw SongParserException(e.what(), m_linenum);
}
- if (s.notes.empty()) throw SongParserException("No notes", m_linenum);
// Adjust negative notes
if (m_song.noteMin <= 0) {
unsigned int shift = (1 - m_song.noteMin / 12) * 12;
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2009-07-18 13:05:09
|
Module: performous
Branch: master
Commit: 9a1bcda64fb373ba459b52f401d32f6d811c8b92
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Jul 18 16:04:02 2009 +0300
Video driver cleanup/optimization.
---
game/video_driver.cc | 61 ++++++++++++++++++++++++++-----------------------
game/video_driver.hh | 4 +--
2 files changed, 33 insertions(+), 32 deletions(-)
diff --git a/game/video_driver.cc b/game/video_driver.cc
index 63fcd71..c93b955 100644
--- a/game/video_driver.cc
+++ b/game/video_driver.cc
@@ -7,8 +7,10 @@
#include "joystick.hh"
#include <SDL.h>
-unsigned s_width;
-unsigned s_height;
+namespace {
+ unsigned s_width;
+ unsigned s_height;
+}
unsigned int screenW() { return s_width; }
unsigned int screenH() { return s_height; }
@@ -35,34 +37,7 @@ Window::~Window() {
}
void Window::blank() {
- glClearColor (0.0f, 0.0f, 0.0f, 1.0f);
- glDisable (GL_DEPTH_TEST);
- glDisable(GL_CULL_FACE);
- glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable (GL_BLEND);
- s_width = screen->w;
- s_height = screen->h;
- if (s_height < 0.56f * s_width) s_width = round(s_height / 0.56f);
- if (s_height > 0.8f * s_width) s_height = round(0.8f * s_width);
- glViewport(0.5f * (screen->w - s_width), 0.5f * (screen->h - s_height), s_width, s_height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- float h = virtH();
- const float near = 1.5f; // This determines FOV: the value is your distance from the monitor (the unit being the width of the Performous window)
- const float far = 100.0f; // How far away can things be seen
- glFrustum(-0.5f, 0.5f, 0.5f * h, -0.5f * h, near, far);
glClear(GL_COLOR_BUFFER_BIT);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0.0f, 0.0f, -near); // So that z = 0.0f is still on monitor surface
- /*
- glFogi(GL_FOG_MODE, GL_LINEAR);
- glFogf(GL_FOG_START, near);
- glFogf(GL_FOG_END, far);
- GLfloat color[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
- glFogfv(GL_FOG_COLOR, color);
- glEnable(GL_FOG);
- */
}
void Window::swap() {
@@ -95,5 +70,33 @@ void Window::resize() {
SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE, 0);
screen = SDL_SetVideoMode(width, height, 0, SDL_OPENGL | SDL_RESIZABLE | (m_fullscreen ? SDL_FULLSCREEN : 0));
if (!screen) throw std::runtime_error(std::string("SDL_SetVideoMode failed: ") + SDL_GetError());
+
+ s_width = screen->w;
+ s_height = screen->h;
+ if (!m_fullscreen) {
+ config["graphic/window_width"].i() = s_width;
+ config["graphic/window_height"].i() = s_height;
+ }
+ if (s_height < 0.56f * s_width) s_width = round(s_height / 0.56f);
+ if (s_height > 0.8f * s_width) s_height = round(0.8f * s_width);
+ glViewport(0.5f * (screen->w - s_width), 0.5f * (screen->h - s_height), s_width, s_height);
+ // Set flags
+ glClearColor (0.0f, 0.0f, 0.0f, 1.0f);
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_CULL_FACE);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+ // Set projection
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ float h = virtH();
+ const float near = 1.5f; // This determines FOV: the value is your distance from the monitor (the unit being the width of the Performous window)
+ const float far = 100.0f; // How far away can things be seen
+ glFrustum(-0.5f, 0.5f, 0.5f * h, -0.5f * h, near, far);
+ // Set model-view matrix
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glTranslatef(0.0f, 0.0f, -near); // So that z = 0.0f is still on monitor surface
+
}
diff --git a/game/video_driver.hh b/game/video_driver.hh
index 50bd5f0..b8c90dc 100644
--- a/game/video_driver.hh
+++ b/game/video_driver.hh
@@ -1,5 +1,4 @@
-#ifndef __VIDEODRIVER_H__
-#define __VIDEODRIVER_H__
+#pragma once
#include "surface.hh"
#include <boost/ptr_container/ptr_vector.hpp>
@@ -47,4 +46,3 @@ class Window {
bool m_fullscreen;
};
-#endif
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2009-07-18 13:05:04
|
Module: performous Branch: master Commit: d3f53b5b4ed33eeb80c81011efd2e6a148f83ae9 Author: Lasse Karkkainen <tro...@tr...> Date: Sat Jul 18 16:04:44 2009 +0300 Merge branch 'master' of ssh://tronic@performous.git.sf.net/gitroot/performous --- |
|
From: Yoda-JM <yo...@us...> - 2009-07-18 12:23:43
|
Module: performous
Branch: master
Commit: 793433e92d6cb80bcc32bd7706040473a3191410
Author: Vincent Le Ligeour <yo...@us...>
Date: Sat Jul 18 14:23:03 2009 +0200
Added some code that sometimes works for audio sync
---
game/audio.cc | 15 +++++++++++++--
game/audio.hh | 10 ++++++++++
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/game/audio.cc b/game/audio.cc
index 3ce352d..b49e06f 100644
--- a/game/audio.cc
+++ b/game/audio.cc
@@ -43,8 +43,19 @@ void Audio::operator()(da::pcm_data& areas, da::settings const&) {
double tmp = it->mpeg.position();
if( tmp > position ) position = tmp;
}
- for (Streams::iterator it = m_streams.begin(); it != m_streams.end(); ++it) {
- it->mpeg.seek(position);
+ unsigned int i = 0;
+ for (Streams::iterator it = m_streams.begin(); it != m_streams.end(); ++it,++i) {
+ if( it->fadingout() ) continue;
+ double shift = position - it->mpeg.position();
+ if( shift != 0 ) {
+ std::cout << "Moving stream " << i << " " << shift << "s forward";
+ if( it->consume(shift) ) {
+ std::cout << " SUCCESS" << std::endl;
+ } else {
+ // here we should say that this stream still need to be synched with one of the sucess one
+ std::cout << " FAIL (not enough data)" << std::endl;
+ }
+ }
}
*/
m_need_resync = false;
diff --git a/game/audio.hh b/game/audio.hh
index ca9a3b6..876ca3c 100644
--- a/game/audio.hh
+++ b/game/audio.hh
@@ -87,6 +87,16 @@ struct Stream {
void fadeout(double time) { fadeSpeed = - 1.0 / (time * srate); }
/// is the stream fading out
bool fadingout() {return fadeSpeed < 0;}
+ bool consume(double duration) {
+ std::vector<int16_t> buf;
+ unsigned int samples = srate * duration;
+ mpeg.audioQueue.tryPop(buf, samples);
+ if( buf.size() == samples ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
/// crossfades songs
template <typename RndIt> void playmix(RndIt outbuf, unsigned int maxSamples) {
if (prebuffering && mpeg.audioQueue.percentage() > 0.9) prebuffering = false;
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2009-07-18 12:05:21
|
Module: performous
Branch: master
Commit: 0eaa864cb73e57b2b9f5e3887c8b7524f7170b28
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Jul 18 15:02:45 2009 +0300
Add profiling class that can be used for performance measurements.
Usage:
Profiler prof("render"); // Description of what is profiled
foo();
prof("foo");
glStuff();
glFlush(); prof("gl"); // Remember to flush before measuring GL stuff
// When prof goes out of scope, it prints the results to std::cout
---
game/profiler.hh | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/game/profiler.hh b/game/profiler.hh
new file mode 100644
index 0000000..256a2fc
--- /dev/null
+++ b/game/profiler.hh
@@ -0,0 +1,21 @@
+#pragma once
+
+#include "xtime.hh"
+#include <iostream>
+#include <sstream>
+#include <string>
+
+class Profiler {
+ std::ostringstream m_oss;
+ boost::xtime m_time;
+ public:
+ Profiler(std::string const& name): m_time(now()) { m_oss << name << ": "; }
+ ~Profiler() { std::clog << m_oss.str() << std::endl; }
+ void operator()(std::string const& tag) {
+ boost::xtime n = now();
+ std::swap(n, m_time);
+ m_oss << unsigned((m_time - n) * 1000.0 + 0.5) << " ms (" << tag << ") ";
+ }
+};
+
+
|
|
From: Yoda-JM <yo...@us...> - 2009-07-17 20:42:34
|
Module: performous
Branch: master
Commit: 5eea9d70fc7f560eb934a780e6e181e68343035c
Author: Vincent Le Ligeour <yo...@us...>
Date: Fri Jul 17 22:42:11 2009 +0200
Revert "Added some guitar/bass/drums parsing"
This reverts commit f633cbf4fd5b695b138502798c377d89897b6532.
---
game/midifile.cc | 62 ++++++++++++++----------------------------------------
1 files changed, 16 insertions(+), 46 deletions(-)
diff --git a/game/midifile.cc b/game/midifile.cc
index ea5e74f..c6eabb7 100644
--- a/game/midifile.cc
+++ b/game/midifile.cc
@@ -259,58 +259,28 @@ void MidiFileParser::process_midi_event(Track& track, uint8_t t, uint8_t arg1, u
#if MIDI_DEBUG_LEVEL > 3
cout_midi_event(t, arg1, arg2, miditime);
#endif
- if (track.name == "PART VOCALS") {
- std::vector<Note>& pitch(track.notes[arg1]);
- if (t == 8 || (t == 9 && arg2 == 0)) {
- // Note off event or note on with velocity 0 => note ends
- if (pitch.empty() || pitch.back().end != 0) {
+ std::vector<Note>& pitch(track.notes[arg1]);
+ if (t == 8 || (t == 9 && arg2 == 0)) {
+ // Note off event or note on with velocity 0 => note ends
+ if (pitch.empty() || pitch.back().end != 0) {
#if MIDI_DEBUG_LEVEL > 0
- std::cout << "WARNING: Note end event with no corresponding beginning:" << std::endl;
- cout_midi_event(t, arg1, arg2, miditime);
+ std::cout << "WARNING: Note end event with no corresponding beginning:" << std::endl;
+ cout_midi_event(t, arg1, arg2, miditime);
#endif
- } else {
- if (!m_lyric.empty()) {
- pitch.back().end = miditime;
- track.lyrics.back().end = miditime;
- m_lyric.clear();
- }
+ } else {
+ pitch.back().end = miditime;
+ if (track.name == "PART VOCALS" && !m_lyric.empty()) {
+ if (track.lyrics.empty()) throw std::logic_error("Lyrics empty in MidiFileParser::process_midi_event");
+ track.lyrics.back().end = miditime;
+ m_lyric.clear();
}
- } else if (t == 9) {
- pitch.push_back(Note(miditime));
+ }
+ } else if (t == 9) {
+ pitch.push_back(Note(miditime));
+ if (track.name == "PART VOCALS") {
if (arg1 > 100) track.lyrics.push_back(LyricNote("", arg1, miditime, miditime));
else if (!m_lyric.empty()) track.lyrics.push_back(LyricNote(m_lyric, arg1, miditime));
}
- } else if (track.name == "PART GUITAR" || track.name == "PART BASS" || track.name == "PART DRUMS") {
- std::string difficulty;
- char button = 0;
- if( arg1 >= 0x60 && arg1 <= 0x64 ) {
- difficulty = "EXPERT";
- button = arg1-0x5f;
- } else if( arg1 >= 0x54 && arg1 <= 0x58 ) {
- difficulty = "HARD";
- button = arg1-0x53;
- } else if( arg1 >= 0x48 && arg1 <= 0x4c ) {
- difficulty = "MEDIUM";
- button = arg1-0x47;
- } else if( arg1 >= 0x3c && arg1 <= 0x40 ) {
- difficulty = "EASY";
- button = arg1-0x3b;
- }
-
- if( button != 0 ) {
- std::string type((t==9)?"DOWN":"UP");
-#if MIDI_DEBUG_LEVEL > 2
- std::cout << std::setiosflags(std::ios::left) << std::setw(7) << difficulty << " " << int(button) << " " << std::setw(5) <<type << std::fixed << std::setprecision(2) << std::setw(12) << get_seconds(miditime) << std::endl;
-#endif
- } else {
-#if MIDI_DEBUG_LEVEL > 2
- cout_midi_event(t, arg1, arg2, miditime);
-#endif
- }
- } else {
-#if MIDI_DEBUG_LEVEL > 3
- cout_midi_event(t, arg1, arg2, miditime);
-#endif
}
}
|
|
From: Yoda-JM <yo...@us...> - 2009-07-17 20:25:32
|
Module: performous
Branch: master
Commit: f633cbf4fd5b695b138502798c377d89897b6532
Author: Vincent Le Ligeour <yo...@us...>
Date: Fri Jul 17 22:24:52 2009 +0200
Added some guitar/bass/drums parsing
---
game/midifile.cc | 62 ++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 46 insertions(+), 16 deletions(-)
diff --git a/game/midifile.cc b/game/midifile.cc
index c6eabb7..ea5e74f 100644
--- a/game/midifile.cc
+++ b/game/midifile.cc
@@ -259,28 +259,58 @@ void MidiFileParser::process_midi_event(Track& track, uint8_t t, uint8_t arg1, u
#if MIDI_DEBUG_LEVEL > 3
cout_midi_event(t, arg1, arg2, miditime);
#endif
- std::vector<Note>& pitch(track.notes[arg1]);
- if (t == 8 || (t == 9 && arg2 == 0)) {
- // Note off event or note on with velocity 0 => note ends
- if (pitch.empty() || pitch.back().end != 0) {
+ if (track.name == "PART VOCALS") {
+ std::vector<Note>& pitch(track.notes[arg1]);
+ if (t == 8 || (t == 9 && arg2 == 0)) {
+ // Note off event or note on with velocity 0 => note ends
+ if (pitch.empty() || pitch.back().end != 0) {
#if MIDI_DEBUG_LEVEL > 0
- std::cout << "WARNING: Note end event with no corresponding beginning:" << std::endl;
- cout_midi_event(t, arg1, arg2, miditime);
+ std::cout << "WARNING: Note end event with no corresponding beginning:" << std::endl;
+ cout_midi_event(t, arg1, arg2, miditime);
#endif
- } else {
- pitch.back().end = miditime;
- if (track.name == "PART VOCALS" && !m_lyric.empty()) {
- if (track.lyrics.empty()) throw std::logic_error("Lyrics empty in MidiFileParser::process_midi_event");
- track.lyrics.back().end = miditime;
- m_lyric.clear();
+ } else {
+ if (!m_lyric.empty()) {
+ pitch.back().end = miditime;
+ track.lyrics.back().end = miditime;
+ m_lyric.clear();
+ }
}
- }
- } else if (t == 9) {
- pitch.push_back(Note(miditime));
- if (track.name == "PART VOCALS") {
+ } else if (t == 9) {
+ pitch.push_back(Note(miditime));
if (arg1 > 100) track.lyrics.push_back(LyricNote("", arg1, miditime, miditime));
else if (!m_lyric.empty()) track.lyrics.push_back(LyricNote(m_lyric, arg1, miditime));
}
+ } else if (track.name == "PART GUITAR" || track.name == "PART BASS" || track.name == "PART DRUMS") {
+ std::string difficulty;
+ char button = 0;
+ if( arg1 >= 0x60 && arg1 <= 0x64 ) {
+ difficulty = "EXPERT";
+ button = arg1-0x5f;
+ } else if( arg1 >= 0x54 && arg1 <= 0x58 ) {
+ difficulty = "HARD";
+ button = arg1-0x53;
+ } else if( arg1 >= 0x48 && arg1 <= 0x4c ) {
+ difficulty = "MEDIUM";
+ button = arg1-0x47;
+ } else if( arg1 >= 0x3c && arg1 <= 0x40 ) {
+ difficulty = "EASY";
+ button = arg1-0x3b;
+ }
+
+ if( button != 0 ) {
+ std::string type((t==9)?"DOWN":"UP");
+#if MIDI_DEBUG_LEVEL > 2
+ std::cout << std::setiosflags(std::ios::left) << std::setw(7) << difficulty << " " << int(button) << " " << std::setw(5) <<type << std::fixed << std::setprecision(2) << std::setw(12) << get_seconds(miditime) << std::endl;
+#endif
+ } else {
+#if MIDI_DEBUG_LEVEL > 2
+ cout_midi_event(t, arg1, arg2, miditime);
+#endif
+ }
+ } else {
+#if MIDI_DEBUG_LEVEL > 3
+ cout_midi_event(t, arg1, arg2, miditime);
+#endif
}
}
|
|
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);
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2009-07-15 15:57:02
|
Module: performous
Branch: master
Commit: 052efcdc120455467410bf0974ede3fe517d1aa4
Author: Lasse Karkkainen <tro...@tr...>
Date: Wed Jul 15 18:55:28 2009 +0300
Unicode conversions
- Convert lyrics from MIDI (per-syllable charset detection instead of per-song for now)
- Do not warn about non-UTF-8 if no filename is given to convertToUTF8
---
game/songparser-ini.cc | 6 +++++-
game/unicode.cc | 4 +---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/game/songparser-ini.cc b/game/songparser-ini.cc
index 05a495b..82d50cb 100644
--- a/game/songparser-ini.cc
+++ b/game/songparser-ini.cc
@@ -50,7 +50,11 @@ void SongParser::iniParse() {
n.end = midi.get_seconds(it2->end);
n.notePrev = n.note = it2->note;
n.type = n.note > 100 ? Note::SLEEP : Note::NORMAL;
- n.syllable = it2->lyric;
+ {
+ std::stringstream ss(it2->lyric);
+ convertToUTF8(ss);
+ n.syllable = ss.str();
+ }
std::string& syl = n.syllable;
if (n.type != Note::SLEEP) {
if (!syl.empty()) {
diff --git a/game/unicode.cc b/game/unicode.cc
index 3a852ea..8c2c73c 100644
--- a/game/unicode.cc
+++ b/game/unicode.cc
@@ -7,9 +7,7 @@ void convertToUTF8( std::stringstream &_stream, std::string _filename ) {
try {
Glib::convert(_stream.str(), "UTF-8", "UTF-8"); // Test if input is UTF-8
} catch(...) {
- if( _filename.empty() ) _filename = std::string("stream");
-
- std::cerr << "WARNING: " << _filename << " is not UTF-8.\n Assuming CP1252 for now. Use recode CP1252..UTF-8 */*.txt to convert your files." << std::endl;
+ if (!_filename.empty()) std::cerr << "WARNING: " << _filename << " is not UTF-8.\n Assuming CP1252 for now. Use recode CP1252..UTF-8 */*.txt to convert your files." << std::endl;
try {
_stream.str(Glib::convert(_stream.str(), "UTF-8", "CP1252")); // Convert from Microsoft CP1252
} catch (...) {
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2009-07-15 05:26:54
|
Module: performous
Branch: master
Commit: c03aecdb9be1a3f764e10a1982ba302388c3ea7f
Author: Lasse Karkkainen <tro...@tr...>
Date: Wed Jul 15 08:25:14 2009 +0300
Fix the TXT song parser, b0rked by the previous commit.
---
game/songparser-txt.cc | 1 +
game/songparser.hh | 5 ++++-
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/game/songparser-txt.cc b/game/songparser-txt.cc
index 0d89575..27fe608 100644
--- a/game/songparser-txt.cc
+++ b/game/songparser-txt.cc
@@ -87,6 +87,7 @@ bool SongParser::txtParseNote(std::string line) {
{
unsigned int length = 0;
if (!(iss >> ts >> length >> n.note)) throw std::runtime_error("Invalid note line format");
+ n.notePrev = n.note; // No slide notes in TXT yet.
if (m_relative) ts += m_relativeShift;
if (iss.get() == ' ') std::getline(iss, n.syllable);
n.end = tsTime(ts + length);
diff --git a/game/songparser.hh b/game/songparser.hh
index dde8302..3714064 100644
--- a/game/songparser.hh
+++ b/game/songparser.hh
@@ -52,7 +52,10 @@ class SongParser {
unsigned int shift = (1 - m_song.noteMin / 12) * 12;
m_song.noteMin += shift;
m_song.noteMax += shift;
- for (Notes::iterator it = s.notes.begin(); it != s.notes.end(); ++it) it->note += shift;
+ for (Notes::iterator it = s.notes.begin(); it != s.notes.end(); ++it) {
+ it->note += shift;
+ it->notePrev += shift;
+ }
}
m_song.m_scoreFactor = 1.0 / m_maxScore;
}
|