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: Tapio V. <aa...@us...> - 2011-02-24 11:38:15
|
Author: Tapio Vierros <tap...@gm...>
Date: Thu Feb 24 13:31:13 2011 +0200
Switch to 16-bit sample format in synth (fixes Windows).
---
editorapp.cc | 7 -------
synth.hh | 15 +++++++++------
2 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/editorapp.cc b/editorapp.cc
index 57b18a5..625c3df 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -124,13 +124,6 @@ EditorApp::EditorApp(QWidget *parent)
handleTips(ui.tabGeneral);
handleTips(ui.tabSong);
- // FIXME: Remove these after rc release
- //ui.actionFoFMIDI->setEnabled(false);
-#ifdef WIN32
- //ui.chkSynth->setEnabled(false);
-#endif
- ////
-
QSettings settings;
if (settings.value("showhelp", true).toBool())
on_actionGettingStarted_triggered();
diff --git a/synth.hh b/synth.hh
index b914f33..6462cf0 100644
--- a/synth.hh
+++ b/synth.hh
@@ -119,9 +119,10 @@ private:
/// Creates the sound
void createBuffer(int note, double length) {
- // This is simple beep, so we use mono, low sample rate and only 8 bits resolution
- // --> quick to create and small memory foot print
- std::string header = writeWavHeader(8, 1, sampleRate, length * sampleRate);
+ // This is simple beep, so we use mono and lowish sample rate
+ // --> quick to create and small memory footprint
+ // Going to 8 bits seems to create weird samples on Windows though
+ std::string header = writeWavHeader(16, 1, sampleRate, length * sampleRate);
m_soundData[m_curBuffer] = QByteArray(header.c_str(), header.size());
double d = (note + 1) / 13.0;
double freq = MusicalScale().getNoteFreq(note + 12);
@@ -131,9 +132,11 @@ private:
float fvalue = d * 0.2 * std::sin(phase) + 0.2 * std::sin(2 * phase) + (1.0 - d) * 0.2 * std::sin(4 * phase);
phase += 2.0 * M_PI * freq / sampleRate;
- // 8-bit
- quint8 value = (fvalue + 1) * 0.5 * 255;
- m_soundData[m_curBuffer].push_back(value);
+ // Convert float to 16-bit integer and push to buffer
+ qint16 svalue = fvalue * 32768;
+ char* value = reinterpret_cast<char*>(&svalue);
+ m_soundData[m_curBuffer].push_back(value[0]);
+ m_soundData[m_curBuffer].push_back(value[1]);
}
//std::ofstream of("/tmp/wavdump.wav");
|
|
From: Tapio V. <aa...@us...> - 2011-02-24 11:38:09
|
Author: Tapio Vierros <tap...@gm...>
Date: Thu Feb 24 13:10:38 2011 +0200
Synth work.
* Remove Windows QSound hack
* Use alternative BufferPlayer strategy (not constantly creating new ones)
* Now kind of works on Windows, but the sounds are wrong sometimes :S
---
editorapp.cc | 14 +++++++-------
editorapp.hh | 2 ++
synth.hh | 44 +++++++++++++++-----------------------------
3 files changed, 24 insertions(+), 36 deletions(-)
diff --git a/editorapp.cc b/editorapp.cc
index f8009a6..57b18a5 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -46,7 +46,7 @@ namespace {
EditorApp::EditorApp(QWidget *parent)
: QMainWindow(parent), gettingStarted(), noteGraph(), player(), audioOutput(), video(), synth(), statusbarProgress(),
- projectFileName(), latestPath(QDir::homePath())
+ projectFileName(), latestPath(QDir::homePath()), currentBufferPlayer()
{
ui.setupUi(this);
readSettings();
@@ -96,6 +96,9 @@ EditorApp::EditorApp(QWidget *parent)
audioOutput = new Phonon::AudioOutput(this);
player->setTickInterval(100);
Phonon::createPath(player, audioOutput);
+ bufferPlayers[0] = new BufferPlayer(this);
+ bufferPlayers[1] = new BufferPlayer(this);
+
// Audio signals
connect(player, SIGNAL(tick(qint64)), this, SLOT(audioTick(qint64)));
connect(player, SIGNAL(stateChanged(Phonon::State,Phonon::State)), this, SLOT(playerStateChanged(Phonon::State,Phonon::State)));
@@ -771,11 +774,7 @@ void EditorApp::on_chkSynth_clicked(bool checked)
if (checked && player && player->state() == Phonon::PlayingState) {
synth.reset(new Synth);
connect(synth.data(), SIGNAL(playBuffer(QByteArray)), this, SLOT(playBuffer(QByteArray)));
-#ifdef Q_OS_WIN
- if (audioOutput) audioOutput->setVolume(0.25);
-#else
- if (audioOutput) audioOutput->setVolume(0.75);
-#endif
+ if (audioOutput) audioOutput->setVolume(0.66);
} else if (!checked) {
synth.reset();
if (audioOutput) audioOutput->setVolume(1.0);
@@ -833,7 +832,8 @@ void EditorApp::playerStateChanged(Phonon::State newstate, Phonon::State oldstat
void EditorApp::playBuffer(const QByteArray& buffer)
{
- new BufferPlayer(buffer, this);
+ if (bufferPlayers[currentBufferPlayer]->play(buffer))
+ currentBufferPlayer = (currentBufferPlayer+1) % 2;
}
diff --git a/editorapp.hh b/editorapp.hh
index 91c512c..91df56e 100644
--- a/editorapp.hh
+++ b/editorapp.hh
@@ -139,10 +139,12 @@ private:
Phonon::MediaObject *player;
Phonon::AudioOutput *audioOutput;
Phonon::VideoPlayer *video;
+ BufferPlayer *bufferPlayers[2];
QScopedPointer<Synth> synth;
Piano *piano;
QProgressBar *statusbarProgress;
QPushButton *statusbarButton;
QString projectFileName;
QString latestPath;
+ int currentBufferPlayer;
};
diff --git a/synth.hh b/synth.hh
index 141c354..b914f33 100644
--- a/synth.hh
+++ b/synth.hh
@@ -13,10 +13,6 @@
#include "notes.hh"
#include "notegraphwidget.hh"
#include "notelabel.hh"
-#ifdef Q_OS_WIN
-#include <QTemporaryFile>
-#include <QSound>
-#endif
#ifndef M_PI
@@ -165,7 +161,7 @@ private:
return out.str();
}
- static const int sampleRate = 8000; ///< Sample rate
+ static const int sampleRate = 22050; ///< Sample rate
SynthNotes m_notes; ///< Notes to synthesize
double m_delay; ///< How many seconds until the next sound must be played
@@ -184,41 +180,31 @@ class BufferPlayer: public QObject
Q_OBJECT
Q_DISABLE_COPY(BufferPlayer);
public:
- BufferPlayer(const QByteArray& ba, QObject *parent): QObject(parent) {
-#ifdef Q_OS_WIN
- QTemporaryFile wavfile;
- if (wavfile.open()) {
- QDataStream stream(&wavfile);
- stream.writeRawData(ba.data(), ba.size());
- QSound::play(wavfile.fileName());
- }
- deleteLater();
-#else
- m_data = ba;
+ BufferPlayer(QObject *parent): QObject(parent) {
m_player = Phonon::createPlayer(Phonon::MusicCategory);
m_player->setParent(this);
- m_buffer = new QBuffer(&m_data, this);
- m_player->setCurrentSource(m_buffer);
+ m_buffer = new QBuffer(this);
connect(m_player, SIGNAL(finished()), this, SLOT(finished()));
- m_player->play();
-#endif
+ }
+
+ bool play(const QByteArray& ba) {
+ if (m_player->state() != Phonon::PlayingState) {
+ m_player->clear();
+ m_buffer->close();
+ m_buffer->setData(ba);
+ m_player->setCurrentSource(m_buffer);
+ m_player->play();
+ return true;
+ }
+ return false;
}
public slots:
void finished() {
m_player->clear();
- {
- // This seems a bit strange, but looks like it is the best
- // way to release the resources without an occasional crash.
- QObject deleter;
- m_player->setParent(&deleter);
- m_buffer->setParent(&deleter);
- }
- deleteLater();
}
private:
- QByteArray m_data;
QBuffer *m_buffer;
Phonon::MediaObject *m_player;
};
|
|
From: Tapio V. <aa...@us...> - 2011-02-24 11:38:02
|
Author: Tapio Vierros <tap...@gm...>
Date: Thu Feb 24 12:24:25 2011 +0200
Fixes synth hanging at last note and some other tweaks.
---
synth.hh | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/synth.hh b/synth.hh
index 5418acb..141c354 100644
--- a/synth.hh
+++ b/synth.hh
@@ -51,6 +51,7 @@ public:
QMutexLocker locker(&m_mutex);
m_pos = pos / 1000.0;
m_notes = notes;
+ if (m_notes.isEmpty()) m_quit = true;
if (isRunning()) m_condition.wakeOne();
else start();
@@ -105,7 +106,7 @@ private:
QMutexLocker locker(&m_mutex);
SynthNotes::const_iterator it = m_notes.begin();
while (it != m_notes.end() && it->begin < m_pos) ++it;
- if (it == m_notes.end()) { m_delay = ULONG_MAX / 1000.0; return; }
+ if (it == m_notes.end()) { m_delay = 1000.0; return; }
n = *it;
}
@@ -183,7 +184,7 @@ class BufferPlayer: public QObject
Q_OBJECT
Q_DISABLE_COPY(BufferPlayer);
public:
- BufferPlayer(const QByteArray& ba, QObject *parent): QObject(parent), m_data(ba) {
+ BufferPlayer(const QByteArray& ba, QObject *parent): QObject(parent) {
#ifdef Q_OS_WIN
QTemporaryFile wavfile;
if (wavfile.open()) {
@@ -191,8 +192,9 @@ public:
stream.writeRawData(ba.data(), ba.size());
QSound::play(wavfile.fileName());
}
-
+ deleteLater();
#else
+ m_data = ba;
m_player = Phonon::createPlayer(Phonon::MusicCategory);
m_player->setParent(this);
m_buffer = new QBuffer(&m_data, this);
|
|
From: Tapio V. <aa...@us...> - 2011-02-24 11:37:56
|
Author: Tapio Vierros <tap...@gm...>
Date: Thu Feb 24 11:45:31 2011 +0200
Hack-of-the-Year to get some synth on Windows.
---
editorapp.cc | 8 +++++++-
synth.hh | 14 ++++++++++++++
2 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/editorapp.cc b/editorapp.cc
index 0018282..f8009a6 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -762,7 +762,7 @@ void EditorApp::playButton()
} else {
ui.cmdPlay->setText(tr("Play"));
ui.cmdPlay->setIcon(QIcon::fromTheme("media-playback-start", QIcon(":/icons/media-playback-start.png")));
- synth.reset();
+ on_chkSynth_clicked(false);
}
}
@@ -771,8 +771,14 @@ void EditorApp::on_chkSynth_clicked(bool checked)
if (checked && player && player->state() == Phonon::PlayingState) {
synth.reset(new Synth);
connect(synth.data(), SIGNAL(playBuffer(QByteArray)), this, SLOT(playBuffer(QByteArray)));
+#ifdef Q_OS_WIN
+ if (audioOutput) audioOutput->setVolume(0.25);
+#else
+ if (audioOutput) audioOutput->setVolume(0.75);
+#endif
} else if (!checked) {
synth.reset();
+ if (audioOutput) audioOutput->setVolume(1.0);
}
}
diff --git a/synth.hh b/synth.hh
index 5408bc1..5418acb 100644
--- a/synth.hh
+++ b/synth.hh
@@ -13,6 +13,10 @@
#include "notes.hh"
#include "notegraphwidget.hh"
#include "notelabel.hh"
+#ifdef Q_OS_WIN
+#include <QTemporaryFile>
+#include <QSound>
+#endif
#ifndef M_PI
@@ -180,12 +184,22 @@ class BufferPlayer: public QObject
Q_DISABLE_COPY(BufferPlayer);
public:
BufferPlayer(const QByteArray& ba, QObject *parent): QObject(parent), m_data(ba) {
+#ifdef Q_OS_WIN
+ QTemporaryFile wavfile;
+ if (wavfile.open()) {
+ QDataStream stream(&wavfile);
+ stream.writeRawData(ba.data(), ba.size());
+ QSound::play(wavfile.fileName());
+ }
+
+#else
m_player = Phonon::createPlayer(Phonon::MusicCategory);
m_player->setParent(this);
m_buffer = new QBuffer(&m_data, this);
m_player->setCurrentSource(m_buffer);
connect(m_player, SIGNAL(finished()), this, SLOT(finished()));
m_player->play();
+#endif
}
public slots:
|
|
From: Tapio V. <aa...@us...> - 2011-02-24 11:37:49
|
Author: Tapio Vierros <tap...@gm...>
Date: Wed Feb 23 15:13:06 2011 +0200
For archival purposes: Synth V3 (defunct)
Threaded buffer creation, playback in main thread (queued connections).
Strange issues, especially on Windows. :(
---
editorapp.cc | 7 +++++
editorapp.hh | 1 +
synth.hh | 70 +++++++++++++++++++++++++++++++++++----------------------
3 files changed, 51 insertions(+), 27 deletions(-)
diff --git a/editorapp.cc b/editorapp.cc
index ec3d7db..0018282 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -770,6 +770,7 @@ void EditorApp::on_chkSynth_clicked(bool checked)
{
if (checked && player && player->state() == Phonon::PlayingState) {
synth.reset(new Synth);
+ connect(synth.data(), SIGNAL(playBuffer(QByteArray)), this, SLOT(playBuffer(QByteArray)));
} else if (!checked) {
synth.reset();
}
@@ -824,6 +825,12 @@ void EditorApp::playerStateChanged(Phonon::State newstate, Phonon::State oldstat
}
}
+void EditorApp::playBuffer(const QByteArray& buffer)
+{
+ new BufferPlayer(buffer, this);
+}
+
+
void EditorApp::on_txtTitle_editingFinished() { updateSongMeta(); }
void EditorApp::on_txtArtist_editingFinished() { updateSongMeta(); }
void EditorApp::on_txtGenre_editingFinished() { updateSongMeta(); }
diff --git a/editorapp.hh b/editorapp.hh
index 1f8437d..91c512c 100644
--- a/editorapp.hh
+++ b/editorapp.hh
@@ -69,6 +69,7 @@ public slots:
void metaDataChanged();
void audioTick(qint64 time);
void playerStateChanged(Phonon::State newstate, Phonon::State olstate);
+ void playBuffer(const QByteArray& buffer);
void statusBarMessage(const QString& message);
void updatePiano(int y);
void clearLabelHighlights();
diff --git a/synth.hh b/synth.hh
index ea568ca..5408bc1 100644
--- a/synth.hh
+++ b/synth.hh
@@ -37,9 +37,7 @@ class Synth: public QThread
public:
Synth(QObject *parent = NULL) : QThread(parent), m_delay(), m_pos(), m_noteBegin(), m_curBuffer(), m_quit()
{
- // Apparantly we need to register some types
- qRegisterMetaType<Phonon::MediaSource>("MediaSource");
- qRegisterMetaType<QMultiMap<QString,QString> >("QMultiMap<QString,QString>");
+ qRegisterMetaType<QByteArray>("QByteArray"); // Register type for use with queued connections
}
~Synth() { stop(); wait(); }
@@ -60,18 +58,12 @@ public:
m_condition.wakeOne();
}
+signals:
+ void playBuffer(const QByteArray&);
+
protected:
/// Thread runs here
void run() {
- // Initialize players & buffers (must be done here so that they are in the right thread).
- // There is two so that one can play sound while other loads the next one.
- QObject playerParent; // Dummy object that will handle deleting the players
- for (int i = 0; i < 2; ++i) {
- m_player[i] = Phonon::createPlayer(Phonon::MusicCategory);
- m_player[i]->setParent(&playerParent);
- m_soundData[i] = new QBuffer(&playerParent);
- }
-
calcNext();
while (!m_quit) {
m_mutex.lock();
@@ -86,9 +78,8 @@ protected:
// Time-out: time to play the music
m_mutex.unlock();
if (m_quit) break;
- m_player[m_curBuffer]->play();
+ emit playBuffer(m_soundData[m_curBuffer]);
m_curBuffer = (m_curBuffer+1) % 2;
- m_player[m_curBuffer]->clear();
// Slightly hacky stuff follows:
// We advance the time a bit to make sure we are over the note beginning.
// Then cache the next note, but put longer delay (which will be corrected
@@ -99,9 +90,6 @@ protected:
m_delay = std::max(m_delay, 1.0);
}
}
-
- m_player[0]->clear();
- m_player[1]->clear();
}
private:
@@ -121,9 +109,7 @@ private:
if (n.begin != m_noteBegin) {
// Need to create a new buffer
m_noteBegin = n.begin;
- m_player[m_curBuffer]->clear();
- createBuffer(n.note, n.length);
- m_player[m_curBuffer]->setCurrentSource(m_soundData[m_curBuffer]);
+ createBuffer(n.note % 12, n.length);
}
// Compensate for the time spent in this function
m_delay -= timer.elapsed() / 1000.0;
@@ -135,7 +121,7 @@ private:
// This is simple beep, so we use mono, low sample rate and only 8 bits resolution
// --> quick to create and small memory foot print
std::string header = writeWavHeader(8, 1, sampleRate, length * sampleRate);
- QByteArray buf(header.c_str(), header.size());
+ m_soundData[m_curBuffer] = QByteArray(header.c_str(), header.size());
double d = (note + 1) / 13.0;
double freq = MusicalScale().getNoteFreq(note + 12);
double phase = 0;
@@ -146,12 +132,9 @@ private:
// 8-bit
quint8 value = (fvalue + 1) * 0.5 * 255;
- buf.push_back(value);
+ m_soundData[m_curBuffer].push_back(value);
}
- m_soundData[m_curBuffer]->close();
- m_soundData[m_curBuffer]->setData(buf);
-
//std::ofstream of("/tmp/wavdump.wav");
//of.write(buf.data(), buf.size());
}
@@ -183,10 +166,43 @@ private:
double m_delay; ///< How many seconds until the next sound must be played
double m_pos; ///< Position where we are now
double m_noteBegin; ///< Position of the next note
- Phonon::MediaObject *m_player[2];
- QBuffer *m_soundData[2];
+ QByteArray m_soundData[2];
int m_curBuffer;
bool m_quit;
QMutex m_mutex;
QWaitCondition m_condition;
};
+
+
+class BufferPlayer: public QObject
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(BufferPlayer);
+public:
+ BufferPlayer(const QByteArray& ba, QObject *parent): QObject(parent), m_data(ba) {
+ m_player = Phonon::createPlayer(Phonon::MusicCategory);
+ m_player->setParent(this);
+ m_buffer = new QBuffer(&m_data, this);
+ m_player->setCurrentSource(m_buffer);
+ connect(m_player, SIGNAL(finished()), this, SLOT(finished()));
+ m_player->play();
+ }
+
+public slots:
+ void finished() {
+ m_player->clear();
+ {
+ // This seems a bit strange, but looks like it is the best
+ // way to release the resources without an occasional crash.
+ QObject deleter;
+ m_player->setParent(&deleter);
+ m_buffer->setParent(&deleter);
+ }
+ deleteLater();
+ }
+
+private:
+ QByteArray m_data;
+ QBuffer *m_buffer;
+ Phonon::MediaObject *m_player;
+};
|
|
From: Yoda-JM <yo...@us...> - 2011-02-24 10:46:24
|
Author: Vincent Le Ligeour <yo...@us...>
Date: Thu Feb 24 11:50:09 2011 +0100
Fixed typo in comment
---
game/glshader.hh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/game/glshader.hh b/game/glshader.hh
index 6e7eeff..496dd6c 100644
--- a/game/glshader.hh
+++ b/game/glshader.hh
@@ -99,7 +99,7 @@ struct UseShader {
};
namespace glutil {
- // Note: if you reorder or otherwise change the contents of this, VertexShader::Draw() must be modified accordingly
+ // Note: if you reorder or otherwise change the contents of this, VertexArray::Draw() must be modified accordingly
struct VertexInfo {
glmath::Vec4 position;
glmath::Vec4 texCoord;
|
|
From: Yoda-JM <yo...@us...> - 2011-02-24 10:41:08
|
Author: Vincent Le Ligeour <yo...@us...>
Date: Thu Feb 24 11:45:01 2011 +0100
Fixed some whitespace typo
---
data/shaders/dancenote.vert | 2 +-
game/fbo.hh | 2 +-
game/glmath.hh | 8 ++++----
game/glshader.hh | 4 ++--
game/surface.hh | 6 +++---
5 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/data/shaders/dancenote.vert b/data/shaders/dancenote.vert
index 4919a05..4499620 100644
--- a/data/shaders/dancenote.vert
+++ b/data/shaders/dancenote.vert
@@ -49,7 +49,7 @@ void main() {
vTexCoord = texCoord = vertTexCoord;
vNormal = normal = normalize(gl_NormalMatrix * vertNormal);
vColor = color = vertColor;
-
+
mat4 trans = scaleMat(scale);
// Cursor arrows
diff --git a/game/fbo.hh b/game/fbo.hh
index f980faa..f3773bd 100644
--- a/game/fbo.hh
+++ b/game/fbo.hh
@@ -34,7 +34,7 @@ class FBO: boost::noncopyable {
return m_texture;
}
/// Bind the FBO into use
- void bind() {
+ void bind() {
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo);
}
/// Unbind any FBO
diff --git a/game/glmath.hh b/game/glmath.hh
index 6987b15..b95f784 100644
--- a/game/glmath.hh
+++ b/game/glmath.hh
@@ -25,14 +25,14 @@ namespace glmath {
};
static inline Vec3 operator*(float k, Vec3 const& v) { return Vec3(k * v.x, k * v.y, k * v.z); }
-
+
static inline float dot(Vec3 const& a, Vec3 const& b) {
return a.x * b.x + a.y * b.y + a.z * b.z;
- }
+ }
static inline float len(Vec3 const& v) { return std::sqrt(dot(v, v)); }
static inline Vec3 normalize(Vec3 const& v) { return (1 / len(v)) * v; }
-
+
struct Matrix {
static Matrix zero() {
Matrix ret;
@@ -150,6 +150,6 @@ namespace glmath {
ret(2,3) = 2 * f * n / d;
ret(3,3) = 0.0;
return ret;
- }
+ }
}
diff --git a/game/glshader.hh b/game/glshader.hh
index 4a2ae25..6e7eeff 100644
--- a/game/glshader.hh
+++ b/game/glshader.hh
@@ -73,7 +73,7 @@ private:
int gl_response; ///< save last return state
std::string defs;
-
+
typedef std::vector<GLuint> ShaderObjects;
ShaderObjects shader_ids;
@@ -123,7 +123,7 @@ namespace glutil {
VertexArray& Vertex(float x, float y, float z = 0.0f) {
return Vertex(glmath::Vec4(x, y, z, 1.0f));
}
-
+
VertexArray& Vertex(glmath::Vec4 const& v) {
m_vert.position = v;
m_vertices.push_back(m_vert);
diff --git a/game/surface.hh b/game/surface.hh
index adb394e..72e7fac 100644
--- a/game/surface.hh
+++ b/game/surface.hh
@@ -132,7 +132,7 @@ class UseTexture: boost::noncopyable {
/// constructor
template <GLenum Type> UseTexture(OpenGLTexture<Type> const& tex):
m_shader(/* hack of the year */ (glutil::GLErrorChecker("UseTexture"), glActiveTexture(GL_TEXTURE0), glBindTexture(Type, tex.id()), tex.shader())) {}
-
+
private:
UseShader m_shader;
};
@@ -187,8 +187,8 @@ class Texture: public OpenGLTexture<GL_TEXTURE_2D> {
class Surface {
public:
/// dimensions
- Dimensions dimensions;
- /// texture coordinates
+ Dimensions dimensions;
+ /// texture coordinates
TexCoords tex;
Surface(): m_width(0), m_height(0) {}
/// creates surface from cairo surface
|
|
From: Yoda-JM <yo...@us...> - 2011-02-24 10:34:26
|
Author: Vincent Le Ligeour <yo...@us...>
Date: Thu Feb 24 11:36:59 2011 +0100
Fixed typo (import from opengl2 branch)
---
themes/CMakeLists.txt | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/themes/CMakeLists.txt b/themes/CMakeLists.txt
index 5636f21..71b931d 100644
--- a/themes/CMakeLists.txt
+++ b/themes/CMakeLists.txt
@@ -1,4 +1,4 @@
FILE(GLOB THEME_FILES "default/*.ogg" "default/*.svg" "default/*.png" "default/*.bmp" "default/*.obj")
-install( FILES ${THEME_FILES} DESTINATION ${SHARE_INSTALL}/themes/default/)
+install(FILES ${THEME_FILES} DESTINATION ${SHARE_INSTALL}/themes/default/)
|
|
From: Yoda-JM <yo...@us...> - 2011-02-24 10:34:20
|
Author: Lasse Kärkkäinen <tronic+ndrm at trn.iki.fi> Date: Mon Feb 7 02:43:57 2011 +0100 Fix delete vs. g_malloc mismatch. --- game/unicode.cc | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/game/unicode.cc b/game/unicode.cc index 31d2cf2..b0c4016 100644 --- a/game/unicode.cc +++ b/game/unicode.cc @@ -18,8 +18,9 @@ namespace { 0, &bytes_written, &gerror); if (gerror) throw std::runtime_error("Conversion error"); // Throw on error - - return std::string(boost::scoped_ptr<char>(buf).get(), bytes_written); + std::string ret(buf, bytes_written); + g_free(buf); + return ret; } } |
|
From: Yoda-JM <yo...@us...> - 2011-02-24 10:34:13
|
Author: Lasse Kärkkäinen <tronic+ndrm at trn.iki.fi> Date: Thu Feb 24 03:47:10 2011 +0100 Disable mipmapping for Intel as a temporary fix (either generation of them or rendering is b0rked). --- game/surface.cc | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/game/surface.cc b/game/surface.cc index ec2004e..17900ff 100644 --- a/game/surface.cc +++ b/game/surface.cc @@ -87,12 +87,11 @@ void Texture::load(unsigned int width, unsigned int height, pix::Format format, // The texture wraps over at the edges (repeat) glTexParameterf(type(), GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameterf(type(), GL_TEXTURE_WRAP_T, GL_REPEAT); - //glTexParameterf(type(), GL_TEXTURE_MAX_LEVEL, 1); + glTexParameterf(type(), GL_TEXTURE_MAX_LEVEL, GLEW_VERSION_3_0 ? 4 : 0); // Mipmaps currently b0rked on Intel, so disable them... glerror.check("glTexParameterf"); // Anisotropy is potential trouble maker - if (GLEW_EXT_texture_filter_anisotropic) - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16.0f); + if (GLEW_EXT_texture_filter_anisotropic) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16.0f); glerror.check("MAX_ANISOTROPY_EXT"); glTexParameteri(type(), GL_GENERATE_MIPMAP, GL_TRUE); |
|
From: Yoda-JM <yo...@us...> - 2011-02-24 10:34:07
|
Author: Vincent Le Ligeour <yo...@us...>
Date: Thu Feb 24 11:33:14 2011 +0100
RAII GLErrorChecker and better diagnostics.
Conflicts:
game/glshader.cc
game/glutil.hh
game/guitargraph.cc
game/video_driver.cc
---
game/glutil.hh | 31 +++++++++++++++++++------------
game/guitargraph.cc | 3 ++-
game/main.cc | 4 ++--
game/surface.cc | 10 ++++------
game/video_driver.cc | 5 ++---
5 files changed, 29 insertions(+), 24 deletions(-)
diff --git a/game/glutil.hh b/game/glutil.hh
index c7f81a8..5df2080 100644
--- a/game/glutil.hh
+++ b/game/glutil.hh
@@ -106,18 +106,25 @@ namespace glutil {
/// Checks for OpenGL error and displays it with given location info
struct GLErrorChecker {
- GLErrorChecker(std::string info = "") {
- GLenum err;
- if ((err = glGetError()) != GL_NO_ERROR) {
- if (!info.empty()) info = " (" + info +")";
- switch(err) {
- case GL_INVALID_ENUM: std::cerr << "OpenGL error: invalid enum" << info << std::endl; break;
- case GL_INVALID_VALUE: std::cerr << "OpenGL error: invalid value" << info << std::endl; break;
- case GL_INVALID_OPERATION: std::cerr << "OpenGL error: invalid operation" << info << std::endl; break;
- case GL_STACK_OVERFLOW: std::cerr << "OpenGL error: stack overflow" << info << std::endl; break;
- case GL_STACK_UNDERFLOW: std::cerr << "OpenGL error: stack underflow" << info << std::endl; break;
- case GL_OUT_OF_MEMORY: std::cerr << "OpenGL error: out of memory" << info << std::endl; break;
- }
+ std::string info;
+ GLErrorChecker(std::string const& info): info(info) { check("precondition"); }
+ ~GLErrorChecker() { check("postcondition"); }
+ void check(std::string const& what = "check()") {
+ GLenum err = glGetError();
+ if (err == GL_NO_ERROR) return;
+ std::clog << "opengl/error: " << msg(err) << " in " << info << " " << what << std::endl;
+ }
+ static void reset() { glGetError(); }
+ static std::string msg(GLenum err) {
+ switch(err) {
+ case GL_NO_ERROR: return std::string();
+ case GL_INVALID_ENUM: return "Invalid enum";
+ case GL_INVALID_VALUE: return "Invalid value";
+ case GL_INVALID_OPERATION: return "Invalid operation";
+ case GL_STACK_OVERFLOW: return "Stack overflow";
+ case GL_STACK_UNDERFLOW: return "Stack underflow";
+ case GL_OUT_OF_MEMORY: return "Out of memory";
+ default: return "Unknown error";
}
}
};
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 51cd3d2..ea4010a 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -787,6 +787,7 @@ namespace {
/// Main drawing function (projection, neck, cursor...)
void GuitarGraph::draw(double time) {
+ // FIXME: There are errors here... glutil::GLErrorChecker ec("GuitarGraph::draw");
Dimensions dimensions(1.0); // FIXME: bogus aspect ratio (is this fixable?)
dimensions.screenBottom().middle(m_cx.get()).fixedWidth(std::min(m_width.get(),0.5));
double offsetX = 0.5 * (dimensions.x1() + dimensions.x2());
@@ -940,7 +941,7 @@ void GuitarGraph::draw(double time) {
}
}
}
- } //< disable lighting
+ } //< disable depth test
// Draw flames
for (int fret = 0; fret < m_pads; ++fret) { // Loop through the frets
if (m_drums && fret == input::KICK_BUTTON) { // Skip bass drum
diff --git a/game/main.cc b/game/main.cc
index 51596f0..a5fba08 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -105,8 +105,6 @@ static void checkEvents_SDL(ScreenManager& sm) {
// This is needed to allow navigation (quiting the song) to function even then
input::SDL::pushEvent(event);
sm.getCurrentScreen()->manageEvent(event);
- // Check for OpenGL errors
- glutil::GLErrorChecker glerror;
}
if (config["graphic/fullscreen"].b() != sm.window().getFullscreen()) {
sm.window().setFullscreen(config["graphic/fullscreen"].b());
@@ -162,6 +160,7 @@ void mainLoop(std::string const& songlist) {
// Main loop
boost::xtime time = now();
unsigned frames = 0;
+ glutil::GLErrorChecker glerror("mainloop");
while (!sm.isFinished()) {
Profiler prof("mainloop");
if( g_take_screenshot ) {
@@ -207,6 +206,7 @@ void mainLoop(std::string const& songlist) {
std::cerr << "ERROR: " << e.what() << std::endl;
sm.flashMessage(std::string("ERROR: ") + e.what());
}
+ glerror.check("frame");
}
} catch (std::exception& e) {
// This should use ScreenManager fatalError, but it cannot
diff --git a/game/surface.cc b/game/surface.cc
index d95e0e9..ec2004e 100644
--- a/game/surface.cc
+++ b/game/surface.cc
@@ -77,6 +77,7 @@ namespace {
}
void Texture::load(unsigned int width, unsigned int height, pix::Format format, unsigned char const* buffer, float ar) {
+ glutil::GLErrorChecker glerror("Texture::load");
m_ar = ar ? ar : double(width) / height;
UseTexture texture(*this);
// When texture area is small, bilinear filter the closest mipmap
@@ -87,12 +88,12 @@ void Texture::load(unsigned int width, unsigned int height, pix::Format format,
glTexParameterf(type(), GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(type(), GL_TEXTURE_WRAP_T, GL_REPEAT);
//glTexParameterf(type(), GL_TEXTURE_MAX_LEVEL, 1);
- glutil::GLErrorChecker glerror1("Texture::load - glTexParameterf");
+ glerror.check("glTexParameterf");
// Anisotropy is potential trouble maker
if (GLEW_EXT_texture_filter_anisotropic)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16.0f);
- glutil::GLErrorChecker glerror2("Texture::load - MAX_ANISOTROPY_EXT");
+ glerror.check("MAX_ANISOTROPY_EXT");
glTexParameteri(type(), GL_GENERATE_MIPMAP, GL_TRUE);
PixFmt const& f = getPixFmt(format);
@@ -112,11 +113,10 @@ void Texture::load(unsigned int width, unsigned int height, pix::Format format,
// Just don't do it in Surface class, thanks. -Tronic
glTexImage2D(type(), 0, GL_RGBA, newWidth, newHeight, 0, f.format, f.type, &outBuf[0]);
}
- // Check for OpenGL errors
- glutil::GLErrorChecker glerror3("Texture::load");
}
void Surface::load(unsigned int width, unsigned int height, pix::Format format, unsigned char const* buffer, float ar) {
+ glutil::GLErrorChecker glerror("Surface::load");
using namespace pix;
// Initialize dimensions
m_width = width; m_height = height;
@@ -126,8 +126,6 @@ void Surface::load(unsigned int width, unsigned int height, pix::Format format,
PixFmt const& f = getPixFmt(format);
glPixelStorei(GL_UNPACK_SWAP_BYTES, f.swap);
glTexImage2D(m_texture.type(), 0, GL_RGBA, width, height, 0, f.format, f.type, buffer);
- // Check for OpenGL errors
- glutil::GLErrorChecker glerror("Surface::load");
}
void Surface::draw() const {
diff --git a/game/video_driver.cc b/game/video_driver.cc
index 4ad9d69..26d16af 100644
--- a/game/video_driver.cc
+++ b/game/video_driver.cc
@@ -91,6 +91,7 @@ void Window::screenshot() {
void Window::resize() {
+ glutil::GLErrorChecker glerror("Window::resize");
unsigned width = m_fullscreen ? m_fsW : m_windowW;
unsigned height = m_fullscreen ? m_fsH : m_windowH;
{ // Setup GL attributes for context creation
@@ -109,7 +110,7 @@ void Window::resize() {
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());
}
-
+ glerror.check("SetVideoMode");
s_width = screen->w;
s_height = screen->h;
if (!m_fullscreen) {
@@ -140,7 +141,5 @@ void Window::resize() {
const float f = 0.9f; // Avoid texture surface being exactly at the near plane (MacOSX fix)
glFrustum(-0.5f * f, 0.5f * f, 0.5f * h * f, -0.5f * h * f, f * near_, far_);
glTranslatef(0.0f, 0.0f, -near_); // So that z = 0.0f is still on monitor surface
- // Check for OpenGL errors
- glutil::GLErrorChecker glerror("Window::resize");
}
|
|
From: Yoda-JM <yo...@us...> - 2011-02-24 10:34:01
|
Author: Vincent Le Ligeour <yo...@us...> Date: Thu Feb 24 11:25:59 2011 +0100 Fixed compilation error due to opengl2 branch import --- game/screen.hh | 7 +++ game/screen_intro.cc | 1 + game/screen_sing.cc | 3 + game/screen_songs.cc | 1 + game/screenmanager.cc | 17 ++++++- themes/default/configuration_bg.svg | 17 +------ themes/default/intro_bg.svg | 17 +------ themes/default/logo.svg | 90 +++++++++++++++++++++++++++++++++++ themes/default/practice_bg.svg | 17 +------ themes/default/songs_bg.svg | 29 ++---------- 10 files changed, 127 insertions(+), 72 deletions(-) |
|
From: Yoda-JM <yo...@us...> - 2011-02-24 10:33:54
|
Author: Lasse Kärkkäinen <tronic+ndrm at trn.iki.fi> Date: Sat Feb 5 16:30:14 2011 +0100 Allow choosing profilers via logging system: profiler-name/info --- game/profiler.hh | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/game/profiler.hh b/game/profiler.hh index 7beec08..f56db2b 100644 --- a/game/profiler.hh +++ b/game/profiler.hh @@ -11,8 +11,8 @@ class Profiler { 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 << "Profiler/info: " << m_oss.str() << std::endl; } + Profiler(std::string const& name): m_time(now()) { m_oss << "profiler-" << name << "/info: "; } + ~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(); |
|
From: Yoda-JM <yo...@us...> - 2011-02-24 10:33:47
|
Author: Vincent Le Ligeour <yo...@us...>
Date: Thu Feb 24 11:08:16 2011 +0100
Imported part of opengl2 commit abe0b19d
---
game/fs.cc | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/game/fs.cc b/game/fs.cc
index 83f48d5..e34a784 100644
--- a/game/fs.cc
+++ b/game/fs.cc
@@ -120,13 +120,10 @@ std::string getThemePath(std::string const& filename) {
std::string theme = config["game/theme"].s();
static const std::string defaultTheme = "default";
if (theme.empty()) theme = defaultTheme;
- // Try current theme and if that fails, try default theme.
- try {
- return getPath(fs::path("themes") / theme / filename);
- } catch (std::runtime_error&) {
- if (theme == defaultTheme) throw;
- return getPath(fs::path("themes") / defaultTheme / filename);
- }
+ // Try current theme and if that fails, try default theme and finally data dir
+ try { return getPath(fs::path("themes") / theme / filename); } catch (std::runtime_error&) {}
+ if (theme == defaultTheme) try { return getPath(fs::path("themes") / defaultTheme / filename); } catch (std::runtime_error&) {}
+ return getPath(filename);
}
bool isThemeResource(fs::path filename){
|
|
From: Yoda-JM <yo...@us...> - 2011-02-24 10:33:41
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Mon Jan 24 00:46:05 2011 +0100
Add 3D to message dialogs
---
game/dialog.hh | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/game/dialog.hh b/game/dialog.hh
index 65b7d8e..b3e63a8 100644
--- a/game/dialog.hh
+++ b/game/dialog.hh
@@ -18,6 +18,8 @@ class Dialog {
}
/// draws dialogue
void draw() {
+ glutil::PushMatrix pm;
+ glTranslatef(0.0f, 0.0f, 0.1f); // Raise a bit in 3D
m_dialog.draw();
m_svgText.draw(m_text);
}
|
|
From: Yoda-JM <yo...@us...> - 2011-02-24 10:33:35
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Sun Feb 6 16:17:12 2011 +0100
Build fix to allow proper linkage of pthreads
---
game/CMakeLists.txt | 17 +++++++----------
1 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt
index ccf5faf..3a34f6b 100644
--- a/game/CMakeLists.txt
+++ b/game/CMakeLists.txt
@@ -117,18 +117,15 @@ else()
endif()
-# Set default compile flags for GCC
-if(CMAKE_COMPILER_IS_GNUCXX)
- message(STATUS "GCC detected, adding compile flags")
- # -pedantic cannot be used because ffmpeg headers are b0rked
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-missing-field-initializers")
- # -pthread is unrecognized on Windows and ansi standard causes errors
- if(NOT WIN32)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98 -pthread")
- endif(NOT WIN32)
+if(APPLE)
# Needed for ffmpeg.cc to compile cleanly on OSX (it's a (unsigned long) long story)
add_definitions("-D__STDC_CONSTANT_MACROS")
-endif(CMAKE_COMPILER_IS_GNUCXX)
+endif(APPLE)
+
+if(UNIX)
+ list(APPEND CMAKE_CXX_FLAGS -pthread)
+ list(APPEND CMAKE_EXE_LINKER_FLAGS -pthread)
+endif(UNIX)
if(MSVC)
set(SUBSYSTEM_WIN32 WIN32)
|
|
From: Tapio V. <aa...@us...> - 2011-02-24 09:16:50
|
Author: Tapio Vierros <tap...@gm...>
Date: Thu Feb 24 11:16:02 2011 +0200
NoteLabel tip handling tweaks.
---
notelabel.cc | 14 ++++++++------
notelabel.hh | 2 ++
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/notelabel.cc b/notelabel.cc
index 7292613..cc5f79e 100644
--- a/notelabel.cc
+++ b/notelabel.cc
@@ -75,8 +75,7 @@ void NoteLabel::createPixmap()
}
setPixmap(QPixmap::fromImage(image));
-
- setStatusTip(tr("Lyric: ") + lyric());
+ updateTips();
}
void NoteLabel::setSelected(bool state) {
@@ -89,10 +88,9 @@ void NoteLabel::setSelected(bool state) {
}
}
-void NoteLabel::resizeEvent(QResizeEvent *)
-{
- createPixmap();
-}
+void NoteLabel::resizeEvent(QResizeEvent *) { createPixmap(); }
+
+void NoteLabel::moveEvent(QMoveEvent *) { updateTips(); }
void NoteLabel::mouseMoveEvent(QMouseEvent *event)
{
@@ -164,6 +162,10 @@ void NoteLabel::updateLabel()
resize(ngw->s2px(m_note.length()), height());
move(ngw->s2px(m_note.begin), ngw->n2px(m_note.note) - height() / 2);
}
+}
+
+void NoteLabel::updateTips()
+{
setToolTip(description(true));
setStatusTip(description(false));
setWhatsThis(description(true));
diff --git a/notelabel.hh b/notelabel.hh
index ff86e7d..7f4a139 100644
--- a/notelabel.hh
+++ b/notelabel.hh
@@ -26,6 +26,7 @@ public:
Note& note() { return m_note; }
Note note() const { return m_note; }
void updateLabel();
+ void updateTips();
bool isFloating() const { return m_floating; }
void setFloating(bool state) { m_floating = state; createPixmap(); }
@@ -43,6 +44,7 @@ public:
protected:
void resizeEvent(QResizeEvent *event);
+ void moveEvent(QMoveEvent *event);
void mouseMoveEvent(QMouseEvent *event);
private:
|
|
From: Tapio V. <aa...@us...> - 2011-02-24 09:16:43
|
Author: Tapio Vierros <tap...@gm...> Date: Thu Feb 24 11:15:41 2011 +0200 Fixed QPainter errors when zoomed out. --- notelabel.cc | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/notelabel.cc b/notelabel.cc index e218386..7292613 100644 --- a/notelabel.cc +++ b/notelabel.cc @@ -34,6 +34,8 @@ void NoteLabel::createPixmap() QSize size(100, metric.size(Qt::TextSingleLine, lyric()).height() + 2 * text_margin); if (ngw) size.setWidth(ngw->s2px(m_note.length())); + if (size.isEmpty()) return; + QImage image(size.width(), size.height(), QImage::Format_ARGB32_Premultiplied); image.fill(qRgba(0, 0, 0, 0)); |
|
From: Tapio V. <aa...@us...> - 2011-02-24 08:32:42
|
Author: Tapio Vierros <tap...@gm...>
Date: Thu Feb 24 10:31:13 2011 +0200
Guard playbackTimer killing to avoid runtime warnings on Windows.
---
notegraphwidget.cc | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 6349ba4..47cc182 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -287,16 +287,17 @@ void NoteGraphWidget::updateMusicPos(qint64 time, bool smoothing)
{
m_playbackPos = time;
int x = s2px(m_playbackPos / 1000.0) - m_seekHandle.width() / 2;
- killTimer(m_playbackTimer);
+ if (m_playbackTimer) killTimer(m_playbackTimer);
m_seekHandle.move(x, 0);
- if (smoothing)
- m_playbackTimer = startTimer(20); // Hope for 50 fps
+ if (smoothing) m_playbackTimer = startTimer(20); // Hope for 50 fps
+ else m_playbackTimer = 0;
m_playbackInterval.restart();
}
void NoteGraphWidget::stopMusic()
{
- killTimer(m_playbackTimer);
+ if (m_playbackTimer) killTimer(m_playbackTimer);
+ m_playbackTimer = 0;
}
void NoteGraphWidget::seek(int x)
|
|
From: Tapio V. <aa...@us...> - 2011-02-24 08:04:46
|
Author: Tapio Vierros <tap...@gm...>
Date: Thu Feb 24 10:03:21 2011 +0200
GettingStarted dialog now highlights some labels for a while.
---
editor.ui | 8 ++++----
editorapp.cc | 31 +++++++++++++++++++++++++++++++
editorapp.hh | 3 ++-
gettingstarted.hh | 8 +++-----
4 files changed, 40 insertions(+), 10 deletions(-)
diff --git a/editor.ui b/editor.ui
index 2267501..8153983 100644
--- a/editor.ui
+++ b/editor.ui
@@ -89,28 +89,28 @@
</attribute>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
- <widget class="QLabel" name="label_11">
+ <widget class="QLabel" name="lblPlayback">
<property name="text">
<string>Playback</string>
</property>
</widget>
</item>
<item row="0" column="1">
- <widget class="QLabel" name="label_12">
+ <widget class="QLabel" name="lblTiming">
<property name="text">
<string>Timing</string>
</property>
</widget>
</item>
<item row="0" column="2">
- <widget class="QLabel" name="label_3">
+ <widget class="QLabel" name="lblTools">
<property name="text">
<string>Tools</string>
</property>
</widget>
</item>
<item row="0" column="3">
- <widget class="QLabel" name="label_4">
+ <widget class="QLabel" name="lblNoteProperties">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
diff --git a/editorapp.cc b/editorapp.cc
index e7d35b9..ec3d7db 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -11,6 +11,7 @@
#include <QCloseEvent>
#include <QPainter>
#include <QSettings>
+#include <QTimer>
#include <phonon/AudioOutput>
#include <phonon/VideoPlayer>
#include <iostream>
@@ -853,6 +854,36 @@ void EditorApp::on_chkLineBreak_clicked(bool checked)
if (noteGraph) noteGraph->setLineBreak(noteGraph->selectedNote(), checked);
}
+void EditorApp::highlightLabel(QString id)
+{
+ const QString style = "background-color: #f00; font-weight: bold";
+ clearLabelHighlights();
+
+ // Set correct tab
+ if (id == "SONG") ui.tabWidget->setCurrentIndex(1);
+ else ui.tabWidget->setCurrentIndex(0);
+
+ // Color the labels
+ if (id == "TIMING") {
+ ui.lblPlayback->setStyleSheet(style);
+ ui.lblTiming->setStyleSheet(style);
+ } else if (id == "TUNING") {
+ ui.lblTools->setStyleSheet(style);
+ ui.lblNoteProperties->setStyleSheet(style);
+ }
+
+ // Clear highlights after a while
+ QTimer::singleShot(4000, this, SLOT(clearLabelHighlights()));
+}
+
+void EditorApp::clearLabelHighlights()
+{
+ ui.lblPlayback->setStyleSheet("");
+ ui.lblTiming->setStyleSheet("");
+ ui.lblTools->setStyleSheet("");
+ ui.lblNoteProperties->setStyleSheet("");
+}
+
void EditorApp::closeEvent(QCloseEvent *event)
{
if (promptSaving()) event->accept();
diff --git a/editorapp.hh b/editorapp.hh
index 66e273c..1f8437d 100644
--- a/editorapp.hh
+++ b/editorapp.hh
@@ -48,7 +48,7 @@ public:
void updateSongMeta(bool readFromSongToUI = false);
void updateMenuStates();
void updateTitle();
- void showTab(int tab) { ui.tabWidget->setCurrentIndex(tab); }
+ void highlightLabel(QString id);
void showExportMenu() { ui.menuExport->exec(pos() + QPoint(0, ui.menubar->height())); }
private:
@@ -71,6 +71,7 @@ public slots:
void playerStateChanged(Phonon::State newstate, Phonon::State olstate);
void statusBarMessage(const QString& message);
void updatePiano(int y);
+ void clearLabelHighlights();
// Automatic slots
diff --git a/gettingstarted.hh b/gettingstarted.hh
index dd71a9d..7cb7762 100644
--- a/gettingstarted.hh
+++ b/gettingstarted.hh
@@ -39,17 +39,15 @@ public slots:
}
void on_cmdTimeLyrics_clicked(bool) {
- // TODO: Add some coloring to labels or something
- m_editorApp->showTab(0);
+ m_editorApp->highlightLabel("TIMING");
}
void on_cmdFineTuneLyrics_clicked(bool) {
- // TODO: Add some coloring to labels or something
- m_editorApp->showTab(0);
+ m_editorApp->highlightLabel("TUNING");
}
void on_cmdMetadata_clicked(bool) {
- m_editorApp->showTab(1);
+ m_editorApp->highlightLabel("SONG");
}
void on_cmdExport_clicked(bool) {
|
|
From: Tapio V. <aa...@us...> - 2011-02-24 07:28:06
|
Author: Tapio Vierros <tap...@gm...>
Date: Thu Feb 24 09:27:28 2011 +0200
Tweak current phrase display.
---
editor.ui | 2 +-
editorapp.cc | 3 ++-
notegraphwidget.cc | 15 +++++++++++----
3 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/editor.ui b/editor.ui
index 3894a64..2267501 100644
--- a/editor.ui
+++ b/editor.ui
@@ -211,7 +211,7 @@
</property>
</spacer>
</item>
- <item row="4" column="0">
+ <item row="4" column="0" colspan="4">
<widget class="QLabel" name="lblCurrentSentence">
<property name="text">
<string>Current phrase:</string>
diff --git a/editorapp.cc b/editorapp.cc
index 9a0c55f..e7d35b9 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -267,7 +267,8 @@ void EditorApp::updateNoteInfo(NoteLabel *note)
// These are only available for single note selections
ui.cmdSplit->setEnabled(true);
ui.cmdInsert->setEnabled(true);
- ui.lblCurrentSentence->setText(tr("Current phrase:") + " <b>" + noteGraph->getCurrentSentence() + "</b>");
+ ui.lblCurrentSentence->setText(tr("Current phrase: ")
+ + "<small>" + noteGraph->getPrevSentence() + "</small> <b>" + noteGraph->getCurrentSentence() + "</b>");
}
// The next ones are available also for multi-note selections
ui.cmbNoteType->setEnabled(true);
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index b2af794..6349ba4 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -650,6 +650,10 @@ QString NoteGraphWidget::getCurrentSentence() const
QString lyrics;
if (!m_notes.isEmpty() && selectedNote()) {
int id = getNoteLabelId(selectedNote());
+ // Get to phrase beginning
+ while (id >= 0 && !m_notes[id]->note().lineBreak) --id;
+ if (id < 0) return "";
+ // Now loop the phrase
for (int i = id; i < m_notes.size(); ++i) {
if (i != id && m_notes[i]->note().lineBreak) break;
// Selected notes are highlighted with different color
@@ -668,12 +672,15 @@ QString NoteGraphWidget::getPrevSentence() const
QString lyrics;
if (!m_notes.isEmpty() && selectedNote()) {
// First find the previous start
- int id = getNoteLabelId(selectedNote()), i = id-1;
- for (; i >= 0 && !m_notes[i]->note().lineBreak; --i) ;
- if (i < 0) return "";
+ int id = getNoteLabelId(selectedNote());
+ while (id >= 0 && !m_notes[id]->note().lineBreak) --id;
+ if (id < 0) return "";
+ --id;
+ while (id >= 0 && !m_notes[id]->note().lineBreak) --id;
+ if (id < 0) return "";
// Now get the sentence
- for (id = i; i < m_notes.size(); ++i) {
+ for (int i = id; i < m_notes.size(); ++i) {
if (i != id && m_notes[i]->note().lineBreak) break;
lyrics += m_notes[i]->lyric() + " ";
}
|
|
From: Tapio V. <aa...@us...> - 2011-02-24 07:14:45
|
Author: Tapio Vierros <tap...@gm...>
Date: Thu Feb 24 09:14:07 2011 +0200
Improve NoteLabel tooltip.
---
notelabel.cc | 16 +++++++++++++---
notelabel.hh | 1 +
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/notelabel.cc b/notelabel.cc
index d551e5d..e218386 100644
--- a/notelabel.cc
+++ b/notelabel.cc
@@ -162,13 +162,23 @@ void NoteLabel::updateLabel()
resize(ngw->s2px(m_note.length()), height());
move(ngw->s2px(m_note.begin), ngw->n2px(m_note.note) - height() / 2);
}
+ setToolTip(description(true));
+ setStatusTip(description(false));
+ setWhatsThis(description(true));
+}
+
+QString NoteLabel::description(bool multiline) const
+{
MusicalScale ms;
- setToolTip(QString("\"%1\"\n%2\n%3\n%4 s - %5 s")
+ return QString("Syllable: \"%2\"%1Type: %3%1Note: %4 (%5)%1%6 s - %7 s (= %8 s)")
+ .arg(multiline ? "\n" : ", ")
.arg(lyric())
.arg(m_note.typeString())
.arg(ms.getNoteStr(ms.getNoteFreq(m_note.note)))
- .arg(QString::number(m_note.begin, 'f', 3))
- .arg(QString::number(m_note.end, 'f', 3))
+ .arg(m_note.note)
+ .arg(QString::number(m_note.begin, 'f', 4))
+ .arg(QString::number(m_note.end, 'f', 4))
+ .arg(QString::number(m_note.length(), 'f', 4)
);
}
diff --git a/notelabel.hh b/notelabel.hh
index d60824b..ff86e7d 100644
--- a/notelabel.hh
+++ b/notelabel.hh
@@ -18,6 +18,7 @@ public:
void createPixmap();
QString lyric() const { return m_note.syllable; }
void setLyric(const QString &text) { m_note.syllable = text; createPixmap(); }
+ QString description(bool multiline) const;
bool isSelected() const { return m_selected; }
void setSelected(bool state = true);
|
|
From: Tapio V. <aa...@us...> - 2011-02-24 06:53:24
|
Author: Tapio Vierros <tap...@gm...> Date: Thu Feb 24 08:52:32 2011 +0200 Unite Note properties and Tools tabs. --- editor.ui | 333 ++++++++++++++++++---------------------------------- editorapp.cc | 15 +-- gettingstarted.hh | 4 +- notegraphwidget.cc | 7 +- 4 files changed, 127 insertions(+), 232 deletions(-) |
|
From: Lasse Kärkkäi. <tr...@us...> - 2011-02-24 02:48:36
|
Author: Lasse Kärkkäinen <tronic+ndrm at trn.iki.fi> Date: Thu Feb 24 03:47:10 2011 +0100 Disable mipmapping for Intel as a temporary fix (either generation of them or rendering is b0rked). --- game/surface.cc | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/game/surface.cc b/game/surface.cc index 674cf22..d24ca16 100644 --- a/game/surface.cc +++ b/game/surface.cc @@ -92,12 +92,11 @@ void Texture::load(unsigned int width, unsigned int height, pix::Format format, // The texture wraps over at the edges (repeat) glTexParameterf(type(), GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameterf(type(), GL_TEXTURE_WRAP_T, GL_REPEAT); - //glTexParameterf(type(), GL_TEXTURE_MAX_LEVEL, 1); + glTexParameterf(type(), GL_TEXTURE_MAX_LEVEL, GLEW_VERSION_3_0 ? 4 : 0); // Mipmaps currently b0rked on Intel, so disable them... glerror.check("glTexParameterf"); // Anisotropy is potential trouble maker - if (GLEW_EXT_texture_filter_anisotropic) - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16.0f); + if (GLEW_EXT_texture_filter_anisotropic) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16.0f); glerror.check("MAX_ANISOTROPY_EXT"); PixFmt const& f = getPixFmt(format); |
|
From: Lasse Kärkkäi. <tr...@us...> - 2011-02-24 02:48:29
|
Author: Lasse Kärkkäinen <tronic+ndrm at trn.iki.fi> Date: Thu Feb 24 03:42:34 2011 +0100 Fix shader compilation settings etc. --- game/video_driver.cc | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/game/video_driver.cc b/game/video_driver.cc index b47ffb0..79d5e80 100644 --- a/game/video_driver.cc +++ b/game/video_driver.cc @@ -90,7 +90,7 @@ Window::Window(unsigned int width, unsigned int height, bool fs): m_windowW(widt .bind() .setUniformMatrix("colorMatrix", glmath::Matrix()); shader("surface") - .setDefines("#define ENABLE_TEXTURING 1\n#define ENABLE_VERTEX_COLOR\n") + .setDefines("#define ENABLE_TEXTURING 1\n") .compileFile(getThemePath("shaders/core.vert")) .compileFile(getThemePath("shaders/core.frag")) .link() @@ -107,17 +107,17 @@ Window::Window(unsigned int width, unsigned int height, bool fs): m_windowW(widt .setDefines("#define ENABLE_LIGHTING\n") .compileFile(getThemePath("shaders/core.vert")) .compileFile(getThemePath("shaders/core.frag")) - .link(); + .link() + .bind() + .setUniformMatrix("colorMatrix", glmath::Matrix()); shader("dancenote") .setDefines("#define ENABLE_TEXTURING 2\n#define ENABLE_VERTEX_COLOR\n") .compileFile(getThemePath("shaders/dancenote.vert")) .compileFile(getThemePath("shaders/core.frag")) - .link(); - double vx = 0.5f * (screen->w - s_width); - double vy = 0.5f * (screen->h - s_height); - double vw = s_width, vh = s_height; - glViewport(vx, vy, vw, vh); // Drawable area of the window (excluding black bars) - view(0); + .link() + .bind() + .setUniformMatrix("colorMatrix", glmath::Matrix()); + view(0); // For loading screens } Window::~Window() { } |