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-04 08:01:47
|
Module: editor
Branch: master
Commit: d56d2b3198ff5517f514b5e74a481515572cf752
Author: Tapio Vierros <tap...@gm...>
Date: Fri Feb 4 10:00:04 2011 +0200
Fix "NEW" and "MOVE" to extract doubles from the Operation.
This makes undo work properly.
---
notelabelmanager.cc | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/notelabelmanager.cc b/notelabelmanager.cc
index a603017..4774957 100644
--- a/notelabelmanager.cc
+++ b/notelabelmanager.cc
@@ -190,8 +190,8 @@ void NoteLabelManager::doOperation(const Operation& op, Operation::OperationFlag
NoteLabel *newLabel = new NoteLabel(
Note(op.s(2)), // Note(lyric)
this, // parent
- QPoint(s2px(op.i(3)), n2px(op.i(5))), // x,y
- QSize(s2px(op.i(4) - op.i(3)), 2 * m_noteHalfHeight), // w,h
+ QPoint(s2px(op.d(3)), n2px(op.i(5))), // x,y
+ QSize(s2px(op.d(4) - op.d(3)), 2 * m_noteHalfHeight), // w,h
op.b(6) // floating
);
if (m_notes.isEmpty()) m_notes.push_back(newLabel);
@@ -203,7 +203,7 @@ void NoteLabelManager::doOperation(const Operation& op, Operation::OperationFlag
n->close();
m_notes.removeAt(op.i(1));
} else if (action == "MOVE") {
- n->setGeometry(s2px(op.i(2)), n2px(op.i(4)) - m_noteHalfHeight, s2px(op.i(3) - op.i(2)), 2 * m_noteHalfHeight);
+ n->setGeometry(s2px(op.d(2)), n2px(op.i(4)) - m_noteHalfHeight, s2px(op.d(3) - op.d(2)), 2 * m_noteHalfHeight);
n->setFloating(false);
} else if (action == "FLOATING") {
n->setFloating(op.b(2));
|
|
From: Tapio V. <aa...@us...> - 2011-02-04 08:01:44
|
Module: editor
Branch: master
Commit: 881d0166d4cda3bd022638f9dc2180169f4511a0
Author: Tapio Vierros <tap...@gm...>
Date: Fri Feb 4 09:54:16 2011 +0200
Operation "NEW" now also takes seconds and note id instead of pixels.
---
notegraphwidget.cc | 11 +++++------
notelabelmanager.cc | 13 +++++++------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 17a637c..08d6242 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -13,9 +13,9 @@
namespace {
- static Operation opFromNote(const NoteLabel& note, int id) {
+ static Operation opFromNote(const Note& note, int id, bool floating) {
Operation op("NEW");
- op << id << note.lyric() << note.x() << note.y() << note.width() << note.height() << note.isFloating();
+ op << id << note.syllable << note.begin << note.end << note.note << floating;
return op;
}
}
@@ -65,8 +65,8 @@ void NoteGraphWidget::setLyrics(QString lyrics)
QString word;
ts2 >> word;
if (!word.isEmpty()) {
- m_notes.push_back(new NoteLabel(Note(word), this, QPoint(0, n2px(24) - m_noteHalfHeight), QSize(), !firstNote));
- doOperation(opFromNote(*m_notes.back(), m_notes.size()-1), Operation::NO_EXEC);
+ Note note(word); note.note = 24;
+ doOperation(opFromNote(note, m_notes.size(), !firstNote));
if (sentenceStart) setLineBreak(m_notes.back(), true);
firstNote = false;
sentenceStart = false;
@@ -84,8 +84,7 @@ void NoteGraphWidget::setLyrics(const VocalTrack &track)
const Notes ¬es = track.notes;
for (Notes::const_iterator it = notes.begin(); it != notes.end(); ++it) {
if (it->type == Note::SLEEP) continue;
- m_notes.push_back(new NoteLabel(*it, this, QPoint(s2px(it->begin), n2px(it->note) - m_noteHalfHeight), QSize(s2px(it->length()), 0), false));
- doOperation(opFromNote(*m_notes.back(), m_notes.size()-1), Operation::NO_EXEC);
+ doOperation(opFromNote(*it, m_notes.size(), false));
}
updateNotes();
diff --git a/notelabelmanager.cc b/notelabelmanager.cc
index 2bc8556..a603017 100644
--- a/notelabelmanager.cc
+++ b/notelabelmanager.cc
@@ -75,13 +75,14 @@ void NoteLabelManager::split(NoteLabel *note, float ratio)
int cutpos = int(std::ceil(note->lyric().length() * ratio));
QString firstst = note->lyric().left(cutpos);
QString secondst = note->lyric().right(note->lyric().length() - cutpos);
- int w1 = ratio * note->width();
+
+ const Note& n = note->note();
// Create operations for adding the new labels and deleting the old one
int id = getNoteLabelId(note);
Operation new1("NEW"), new2("NEW");
- new1 << id << firstst << note->pos().x() << note->pos().y() << w1 << 0 << note->isFloating();
- new2 << id+1 << secondst << note->pos().x() + w1 << note->pos().y() << note->width() - w1 << 0 << note->isFloating();
+ new1 << id << firstst << n.begin << n.begin + n.length() * ratio << n.note << note->isFloating();
+ new2 << id+1 << secondst << n.begin + n.length() * ratio << n.end << n.note << note->isFloating();
Operation del("DEL"); del << id+2;
Operation combiner("COMBINER"); combiner << 3; // This will combine the previous ones to one undo action
doOperation(new1); doOperation(new2); doOperation(del); doOperation(combiner);
@@ -189,9 +190,9 @@ void NoteLabelManager::doOperation(const Operation& op, Operation::OperationFlag
NoteLabel *newLabel = new NoteLabel(
Note(op.s(2)), // Note(lyric)
this, // parent
- QPoint(op.i(3), op.i(4)), // x,y
- QSize(op.i(5), op.i(6)), // w,h
- op.b(7) // floating
+ QPoint(s2px(op.i(3)), n2px(op.i(5))), // x,y
+ QSize(s2px(op.i(4) - op.i(3)), 2 * m_noteHalfHeight), // w,h
+ op.b(6) // floating
);
if (m_notes.isEmpty()) m_notes.push_back(newLabel);
else m_notes.insert(op.i(1), newLabel);
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2011-02-03 19:47:13
|
Module: editor
Branch: master
Commit: f51ea5b2f3f870a5cfbe6e81a0d88ae9d231916f
Author: Lasse Karkkainen <tro...@tr...>
Date: Thu Feb 3 20:46:21 2011 +0100
Proper multichannel and samplerate handling for ffmpeg & pitchvis.
---
ffmpeg.cc | 1 +
ffmpeg.hh | 6 ++-
pitchvis.cc | 121 +++++++++++++++++++++++++++++++---------------------------
pitchvis.hh | 7 +++-
4 files changed, 77 insertions(+), 58 deletions(-)
diff --git a/ffmpeg.cc b/ffmpeg.cc
index c264b1d..84a14cf 100644
--- a/ffmpeg.cc
+++ b/ffmpeg.cc
@@ -74,6 +74,7 @@ void FFmpeg::open() {
if (audioStream == -1) throw std::runtime_error("No audio stream found");
AVCodecContext* cc = pFormatCtx->streams[audioStream]->codec;
pAudioCodec = avcodec_find_decoder(cc->codec_id);
+ audioQueue.setRateChannels(cc->sample_rate, cc->channels);
if (!pAudioCodec) throw std::runtime_error("Cannot find audio codec");
if (avcodec_open(cc, pAudioCodec) < 0) throw std::runtime_error("Cannot open audio codec");
pAudioCodecCtx = cc;
diff --git a/ffmpeg.hh b/ffmpeg.hh
index 8486db1..c904471 100644
--- a/ffmpeg.hh
+++ b/ffmpeg.hh
@@ -57,7 +57,10 @@ public:
m_needSpace.wakeOne();
return true;
}
- unsigned samplesPerSecond() const { return 44100; /* FIXME */ }
+ unsigned samplesPerSecond() const { return m_channels * m_rate; }
+ void setRateChannels(unsigned rate, unsigned channels) { m_rate = rate; m_channels = channels; }
+ unsigned getRate() { return m_rate; }
+ unsigned getChannels() { return m_channels; }
AudioQueue(unsigned capacity = (2 << 20)): m_ring(capacity), m_channels(), m_position(), m_size(), m_eof() {}
private:
@@ -65,6 +68,7 @@ private:
QWaitCondition m_needData, m_needSpace;
typedef std::vector<da::sample_t> Ring;
Ring m_ring;
+ unsigned m_rate;
unsigned m_channels;
unsigned m_position;
unsigned m_size;
diff --git a/pitchvis.cc b/pitchvis.cc
index 4220864..b275144 100644
--- a/pitchvis.cc
+++ b/pitchvis.cc
@@ -20,60 +20,67 @@ PitchVis::PitchVis(QString const& filename, QWidget *parent)
void PitchVis::run()
{
try {
- unsigned rate = 44100;
- Analyzer analyzer(rate, "");
- // Process the entire song
+ // Initialize FFmpeg decoding
+ FFmpeg mpeg(fileName.toStdString());
{
- // Initialize FFmpeg decoding
- FFmpeg mpeg(fileName.toStdString());
- {
- QMutexLocker locker(&mutex);
- paths.clear();
- position = 0.0;
- duration = mpeg.duration(); // Estimation
+ QMutexLocker locker(&mutex);
+ paths.clear();
+ position = 0.0;
+ duration = mpeg.duration(); // Estimation
+ }
+ unsigned channels = mpeg.audioQueue.getChannels();
+ if (channels == 0) throw std::runtime_error("No audio channels found");
+ std::vector<Analyzer> analyzers(channels, Analyzer(mpeg.audioQueue.getRate(), ""));
+ // Process the entire song
+ std::vector<float> data;
+ unsigned x = 0;
+ while (mpeg.audioQueue.output(data)) {
+ // Read until enough data is available
+ if (data.size() / channels - x < analyzers[0].processSize()) continue;
+ // Pitch detection
+ for (unsigned ch = 0; ch < channels; ++ch) {
+ analyzers[ch].process(da::step_iterator<float>(&data[x * channels + ch], channels));
}
- std::vector<float> data;
- unsigned x = 0;
- while (mpeg.audioQueue.output(data)) {
- // Read until enough data is available
- if (data.size() - x < analyzer.processSize()) continue;
- // Pitch detection
- analyzer.process(&data[x]);
- x += analyzer.processStep();
-
- QMutexLocker locker(&mutex);
- if (cancelled) return;
- Analyzer::Moments const& moments = analyzer.getMoments();
- if (!moments.empty()) {
- double t = moments.back().time();
- position = t;
- duration = std::max(duration, t + 0.01);
- }
+ x += analyzers[0].processStep();
+ // Update progress and check for quit flag
+ QMutexLocker locker(&mutex);
+ if (cancelled) return;
+ Analyzer::Moments const& moments = analyzers[0].getMoments();
+ if (!moments.empty()) {
+ double t = moments.back().time();
+ position = t;
+ duration = std::max(duration, t + 0.01);
}
}
// Filter the analyzer output data into QPainterPaths.
- Analyzer::Moments const& moments = analyzer.getMoments();
- if (moments.empty()) return;
- for (Analyzer::Moments::const_iterator it = moments.begin(), itend = moments.end(); it != itend; ++it) {
- Moment::Tones const& tones = it->m_tones;
- for (Moment::Tones::const_iterator it2 = tones.begin(), it2end = tones.end(); it2 != it2end; ++it2) {
- if (it2->prev) continue; // The tone doesn't begin at this moment, skip
- // Copy the linked list into vector for easier access and calculate max level
- std::vector<Tone const*> tones;
- for (Tone const* n = &*it2; n; n = n->next) { tones.push_back(n); }
- if (tones.size() < 3) continue; // Too short tone, ignored
- PitchPath path;
- Analyzer::Moments::const_iterator momit = it;
- // Render
- for (unsigned i = 0; i < tones.size(); ++i, ++momit) {
- float t = momit->m_time;
- float n = scale.getNote(tones[i]->freq);
- float level = level2dB(tones[i]->level);
- path.push_back(PitchFragment(t, n, level));
+ std::vector<Analyzer::Moments::const_iterator> mit(channels), mend(channels);
+ for (unsigned ch = 0; ch < channels; ++ch) {
+ Analyzer::Moments const& moments = analyzers[ch].getMoments();
+ mit[ch] = moments.begin();
+ mend[ch] = moments.end();
+ }
+ while (mit[0] != mend[0]) {
+ for (unsigned ch = 0; ch < channels; ++mit[ch++]) {
+ Moment::Tones const& tones = mit[ch]->m_tones; // Take tones then move forward the iterator
+ for (Moment::Tones::const_iterator it2 = tones.begin(), it2end = tones.end(); it2 != it2end; ++it2) {
+ if (it2->prev) continue; // The tone doesn't begin at this moment, skip
+ // Copy the linked list into vector for easier access and calculate max level
+ std::vector<Tone const*> tones;
+ for (Tone const* n = &*it2; n; n = n->next) { tones.push_back(n); }
+ if (tones.size() < 3) continue; // Too short tone, ignored
+ PitchPath path(ch);
+ Analyzer::Moments::const_iterator momit = mit[ch];
+ // Store path used for rendering
+ for (unsigned i = 0; i < tones.size(); ++i, ++momit) {
+ float t = momit->m_time;
+ float n = scale.getNote(tones[i]->freq);
+ float level = level2dB(tones[i]->level);
+ path.fragments.push_back(PitchFragment(t, n, level));
+ }
+ QMutexLocker locker(&mutex);
+ paths.push_back(path);
+ moreAvailable = true;
}
- QMutexLocker locker(&mutex);
- paths.push_back(path);
- moreAvailable = true;
}
}
@@ -97,17 +104,18 @@ void PitchVis::paint(NoteGraphWidget* widget, int x1, int x2) {
pen.setCapStyle(Qt::RoundCap);
PitchVis::Paths const& paths = getPaths();
for (PitchVis::Paths::const_iterator it = paths.begin(), itend = paths.end(); it != itend; ++it) {
+ PitchPath::Fragments const& fragments = it->fragments;
int oldx, oldy;
// Only render paths in view
- if (widget->s2px(it->back().time) < x1) continue;
- else if (widget->s2px(it->front().time) > x2) break;
+ if (widget->s2px(fragments.back().time) < x1) continue;
+ else if (widget->s2px(fragments.front().time) > x2) break;
// Iterate through the path points
- for (PitchPath::const_iterator it2 = it->begin(), it2end = it->end(); it2 != it2end; ++it2) {
+ for (PitchPath::Fragments::const_iterator it2 = fragments.begin(), it2end = fragments.end(); it2 != it2end; ++it2) {
int x = widget->s2px(it2->time);
int y = widget->n2px(it2->note);
- pen.setColor(QColor(32, clamp<int>(127 + it2->level, 32, 255), 32));
+ pen.setColor(QColor(32 + 64 * it->channel, clamp<int>(127 + it2->level, 32, 255), 32, 128));
painter.setPen(pen);
- if (it2 != it->begin()) painter.drawLine(oldx, oldy, x, y);
+ if (it2 != fragments.begin()) painter.drawLine(oldx, oldy, x, y);
oldx = x; oldy = y;
}
}
@@ -120,10 +128,11 @@ int PitchVis::guessNote(double begin, double end, int note) {
if (note >= 0 || note < 48) score[note] = 10.0; // Slightly prefer the current note
// Score against paths
for (PitchVis::Paths::const_iterator it = paths.begin(), itend = paths.end(); it != itend; ++it) {
+ PitchPath::Fragments const& fragments = it->fragments;
// Discard paths completely outside the window
- if (it->back().time < begin) continue;
- if (it->front().time > end) break;
- for (PitchPath::const_iterator it2 = it->begin(), it2end = it->end(); it2 != it2end; ++it2) {
+ if (fragments.back().time < begin) continue;
+ if (fragments.front().time > end) break;
+ for (PitchPath::Fragments::const_iterator it2 = fragments.begin(), it2end = fragments.end(); it2 != it2end; ++it2) {
// Discard path points outside the window
if (it2->time < begin) continue;
if (it2->time > end) break;
diff --git a/pitchvis.hh b/pitchvis.hh
index b62ffd7..3b0c993 100644
--- a/pitchvis.hh
+++ b/pitchvis.hh
@@ -15,7 +15,12 @@ struct PitchFragment {
PitchFragment(float time, float note, float level): time(time), note(note), level(level) {}
};
-typedef std::vector<PitchFragment> PitchPath;
+struct PitchPath {
+ typedef std::vector<PitchFragment> Fragments;
+ Fragments fragments;
+ unsigned channel;
+ PitchPath(unsigned channel): channel(channel) {}
+};
class NoteGraphWidget;
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2011-02-03 18:33:38
|
Module: editor
Branch: master
Commit: 8564cae09e6413aebc4fd10d17c387f7bd991960
Author: Lasse Karkkainen <tro...@tr...>
Date: Thu Feb 3 19:33:27 2011 +0100
Fix EOF handling, remove useless AAC hack.
---
ffmpeg.cc | 13 +------------
ffmpeg.hh | 1 +
2 files changed, 2 insertions(+), 12 deletions(-)
diff --git a/ffmpeg.cc b/ffmpeg.cc
index 9a06e36..c264b1d 100644
--- a/ffmpeg.cc
+++ b/ffmpeg.cc
@@ -74,18 +74,6 @@ void FFmpeg::open() {
if (audioStream == -1) throw std::runtime_error("No audio stream found");
AVCodecContext* cc = pFormatCtx->streams[audioStream]->codec;
pAudioCodec = avcodec_find_decoder(cc->codec_id);
- // Awesome HACK for AAC to work (unfortunately libavformat fails to decode this information from MPEG ADTS)
- if (pAudioCodec->name == std::string("aac") && cc->extradata_size == 0) {
- cc->extradata = static_cast<quint8*>(malloc(2));
- unsigned profile = 1; // 0 = MAIN, 1 = LC/LOW
- unsigned srate_idx = 3; // 3 = 48000 Hz
- unsigned channels = 2; // Just the number of channels
- cc->extradata[0] = ((profile + 1) << 3) | ((srate_idx & 0xE) >> 1);
- cc->extradata[1] = ((srate_idx & 0x1) << 7) | (channels << 3);
- cc->extradata_size = 2;
- cc->sample_rate = 48000;
- cc->channels = 2;
- }
if (!pAudioCodec) throw std::runtime_error("Cannot find audio codec");
if (avcodec_open(cc, pAudioCodec) < 0) throw std::runtime_error("Cannot open audio codec");
pAudioCodecCtx = cc;
@@ -100,6 +88,7 @@ void FFmpeg::run() {
m_eof = false;
errors = 0;
} catch (eof_error&) {
+ audioQueue.setEof();
m_eof = true;
msleep(100);
} catch (std::exception& e) {
diff --git a/ffmpeg.hh b/ffmpeg.hh
index 6bfafcc..8486db1 100644
--- a/ffmpeg.hh
+++ b/ffmpeg.hh
@@ -32,6 +32,7 @@ public:
void setEof(bool eof = true) {
QMutexLocker lock(&m_mutex);
m_eof = eof;
+ m_needData.wakeOne();
}
bool output(std::vector<da::sample_t>& out) {
QMutexLocker lock(&m_mutex);
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2011-02-03 16:25:57
|
Module: editor Branch: master Commit: 42b1b2b9203e37d2f3a725e69e9e8a9e98a27bda Author: Lasse Karkkainen <tro...@tr...> Date: Thu Feb 3 17:23:20 2011 +0100 Major rewrite of audio decoding and analyzer input. * Editor hangs during analyzing. * Proper samplerate & #channels control missing. --- ffmpeg.cc | 62 +++++++++++---------------- ffmpeg.hh | 135 +++++++++++++++++++++++----------------------------------- pitch.cc | 28 ++---------- pitch.hh | 39 ++++------------- pitchvis.cc | 17 ++++---- 5 files changed, 101 insertions(+), 180 deletions(-) |
|
From: Tapio V. <aa...@us...> - 2011-02-03 13:51:09
|
Module: editor
Branch: master
Commit: 2013427b7a57fd8641187e8f1e79344aec60628b
Author: Tapio Vierros <tap...@gm...>
Date: Thu Feb 3 15:50:42 2011 +0200
Add missing accelerator to Lyrics tab.
---
editor.ui | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/editor.ui b/editor.ui
index 49a3880..a0eddfe 100644
--- a/editor.ui
+++ b/editor.ui
@@ -447,7 +447,7 @@
</widget>
<widget class="QWidget" name="tabLyrics">
<attribute name="title">
- <string>Lyrics</string>
+ <string>&Lyrics</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_7">
<item row="1" column="0">
|
|
From: Tapio V. <aa...@us...> - 2011-02-03 13:30:58
|
Module: editor Branch: master Commit: 52c264bb847a1b9b32177fd296dea445174fab2c Author: Tapio Vierros <tap...@gm...> Date: Thu Feb 3 15:29:49 2011 +0200 Set initial seekHandle grab behaviour according to UI. --- editorapp.cc | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/editorapp.cc b/editorapp.cc index b3b959a..7c6531c 100644 --- a/editorapp.cc +++ b/editorapp.cc @@ -46,6 +46,7 @@ EditorApp::EditorApp(QWidget *parent): QMainWindow(parent), gettingStarted(), pr connect(ui.cmdSkipSentence, SIGNAL(pressed()), noteGraph, SLOT(selectNextSentenceStart())); connect(ui.chkGrabSeekHandle, SIGNAL(toggled(bool)), noteGraph, SLOT(setSeekHandleWrapToViewport(bool))); connect(ui.cmdMusicFile, SIGNAL(clicked()), this, SLOT(on_actionMusicFile_triggered())); + noteGraph->setSeekHandleWrapToViewport(ui.chkGrabSeekHandle->isChecked()); show(); // Needed in order to get real values from width() |
|
From: Yoda-JM <yo...@us...> - 2011-02-03 12:52:57
|
Module: editor
Branch: master
Commit: 2e7319c2b80141d3d09f7e05657492508df98fb2
Author: Vincent Le Ligeour <yo...@us...>
Date: Thu Feb 3 13:52:42 2011 +0100
Fixed dump lyrics method with new line break
---
notegraphwidget.cc | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index fec08e5..17a637c 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -442,11 +442,9 @@ QString NoteGraphWidget::dumpLyrics() const
QString lyrics;
if (!m_notes.isEmpty()) {
for (int i = 0; i < m_notes.size(); ++i) {
+ if(!lyrics.isEmpty() && m_notes[i]->note().lineBreak) lyrics += '\n';
lyrics += m_notes[i]->lyric() + " ";
- if (m_notes[i]->note().lineBreak)
- lyrics.replace(lyrics.size()-1, 1, QString("\n"));
}
- lyrics.replace(lyrics.size()-1, 1, QString("\n"));
}
return lyrics;
}
|
|
From: Tapio V. <aa...@us...> - 2011-02-03 12:00:53
|
Module: editor
Branch: master
Commit: bc7cc539a6a7ceb6a187ffece91e9e74f5507072
Author: Tapio Vierros <tap...@gm...>
Date: Thu Feb 3 14:00:10 2011 +0200
Add an error message for unknown operation type.
---
notelabelmanager.cc | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/notelabelmanager.cc b/notelabelmanager.cc
index 4b326c8..2bc8556 100644
--- a/notelabelmanager.cc
+++ b/notelabelmanager.cc
@@ -1,3 +1,4 @@
+#include <iostream>
#include <QString>
#include <QInputDialog>
#include <QLineEdit>
@@ -211,6 +212,8 @@ void NoteLabelManager::doOperation(const Operation& op, Operation::OperationFlag
n->setLyric(op.s(2));
} else if (action == "TYPE") {
n->setType(op.i(2));
+ } else {
+ std::cerr << "Error: Unkown operation type " << action.toStdString() << std::endl;
}
n->createPixmap(n->size());
}
|
|
From: Tapio V. <aa...@us...> - 2011-02-03 11:42:05
|
Module: editor
Branch: master
Commit: 416937f73879cbafccaa4490f80d637344e72887
Author: Tapio Vierros <tap...@gm...>
Date: Thu Feb 3 13:41:08 2011 +0200
Remove unused & deprecated "RESIZE" operation type.
---
notelabelmanager.cc | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/notelabelmanager.cc b/notelabelmanager.cc
index 5943f68..4b326c8 100644
--- a/notelabelmanager.cc
+++ b/notelabelmanager.cc
@@ -200,9 +200,6 @@ void NoteLabelManager::doOperation(const Operation& op, Operation::OperationFlag
if (action == "DEL") {
n->close();
m_notes.removeAt(op.i(1));
- } else if (action == "RESIZE") {
- n->resize(op.i(2), op.i(3));
- n->setFloating(false);
} else if (action == "MOVE") {
n->setGeometry(s2px(op.i(2)), n2px(op.i(4)) - m_noteHalfHeight, s2px(op.i(3) - op.i(2)), 2 * m_noteHalfHeight);
n->setFloating(false);
|
|
From: Tapio V. <aa...@us...> - 2011-02-03 11:27:01
|
Module: editor
Branch: master
Commit: 076dcfb6bee761fcd81a1f44452333a9fc0446d0
Author: Tapio Vierros <tap...@gm...>
Date: Thu Feb 3 13:26:09 2011 +0200
Fix a typo that totally broke undo/save.
---
notegraphwidget.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index ccd1886..fec08e5 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -308,7 +308,7 @@ void NoteGraphWidget::mouseReleaseEvent(QMouseEvent *event)
// Operation for undo stack & saving
Operation op("MOVE");
op << getNoteLabelId(n)
- << px2s(n->x()) << px2n(n->x() + n->width())
+ << px2s(n->x()) << px2s(n->x() + n->width())
<< int(round(px2n(n->y() + m_noteHalfHeight)));
doOperation(op, Operation::NO_EXEC);
++movecount;
|
|
From: Tapio V. <aa...@us...> - 2011-02-03 11:05:23
|
Module: editor
Branch: master
Commit: 134c06c83c6607e5d97d1ddefc685fb1bc2cfe25
Author: Tapio Vierros <tap...@gm...>
Date: Thu Feb 3 13:02:17 2011 +0200
SeekHandle improvements.
* Smoother
* Tiny timerEvent intervals cannot be reached on all systems - now handled
* Checkbox for disabling wrapping to viewport now works
---
editorapp.cc | 1 +
notegraphwidget.cc | 26 +++++++++++++++-----------
notegraphwidget.hh | 11 ++++++++---
3 files changed, 24 insertions(+), 14 deletions(-)
diff --git a/editorapp.cc b/editorapp.cc
index 7262cbb..b3b959a 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -44,6 +44,7 @@ EditorApp::EditorApp(QWidget *parent): QMainWindow(parent), gettingStarted(), pr
connect(ui.cmdTimeSentence, SIGNAL(pressed()), noteGraph, SLOT(timeSentence()));
connect(ui.cmdSkipSyllable, SIGNAL(pressed()), noteGraph, SLOT(selectNextSyllable()));
connect(ui.cmdSkipSentence, SIGNAL(pressed()), noteGraph, SLOT(selectNextSentenceStart()));
+ connect(ui.chkGrabSeekHandle, SIGNAL(toggled(bool)), noteGraph, SLOT(setSeekHandleWrapToViewport(bool)));
connect(ui.cmdMusicFile, SIGNAL(clicked()), this, SLOT(on_actionMusicFile_triggered()));
show(); // Needed in order to get real values from width()
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 37c66a8..ccd1886 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -22,7 +22,7 @@ namespace {
NoteGraphWidget::NoteGraphWidget(QWidget *parent)
: NoteLabelManager(parent), m_panHotSpot(), m_seeking(), m_actionHappened(),
- m_pitch(), m_seekHandle(this), m_duration(10.0)
+ m_pitch(), m_seekHandle(this), m_analyzeTimer(), m_playbackTimer(), m_playbackPos(), m_duration(10.0)
{
setProperty("darkBackground", true);
setStyleSheet("QLabel[darkBackground=\"true\"] { background: rgb(32, 32, 32); }");
@@ -115,9 +115,13 @@ void NoteGraphWidget::analyzeMusic(QString filepath)
m_analyzeTimer = startTimer(100);
}
-void NoteGraphWidget::timerEvent(QTimerEvent*)
+void NoteGraphWidget::timerEvent(QTimerEvent* event)
{
- if (m_pitch) {
+ if (event->timerId() == m_playbackTimer) {
+ m_playbackPos += m_playbackInterval.restart();
+ updateMusicPos(m_playbackPos);
+
+ } else if (event->timerId() == m_analyzeTimer && m_pitch) {
QMutexLocker locker(&m_pitch->mutex);
emit analyzeProgress(1000 * m_pitch->getProgress(), 1000);
if (m_pitch->newDataAvailable()) {
@@ -196,16 +200,18 @@ void NoteGraphWidget::updateNotes(bool leftToRight)
void NoteGraphWidget::updateMusicPos(qint64 time, bool smoothing)
{
- int x = s2px(time / 1000.0) - m_seekHandle.width() / 2;
- m_seekHandle.killTimer(m_seekHandle.moveTimerId);
+ m_playbackPos = time;
+ int x = s2px(m_playbackPos / 1000.0) - m_seekHandle.width() / 2;
+ killTimer(m_playbackTimer);
m_seekHandle.move(x, 0);
if (smoothing)
- m_seekHandle.moveTimerId = m_seekHandle.startTimer(std::ceil(px2s(1) * 1000));
+ m_playbackTimer = startTimer(17); // Hope for 60 fps
+ m_playbackInterval.restart();
}
void NoteGraphWidget::stopMusic()
{
- m_seekHandle.killTimer(m_seekHandle.moveTimerId);
+ killTimer(m_playbackTimer);
}
void NoteGraphWidget::seek(int x)
@@ -480,12 +486,10 @@ void SeekHandle::mouseMoveEvent(QMouseEvent *event)
event->ignore();
}
-void SeekHandle::timerEvent(QTimerEvent*)
+void SeekHandle::moveEvent(QMoveEvent*)
{
- move(x() + 1, 0);
-
// Make handle always visible in the ScrollArea
- if (parentWidget() && parentWidget()->parentWidget()) {
+ if (wrapToViewport && parentWidget() && parentWidget()->parentWidget()) {
QScrollArea *scrollArea = qobject_cast<QScrollArea*>(parentWidget()->parentWidget()->parent());
if (scrollArea) {
QScrollBar *scrollVer = scrollArea->verticalScrollBar();
diff --git a/notegraphwidget.hh b/notegraphwidget.hh
index e27ae4d..e53d1a3 100644
--- a/notegraphwidget.hh
+++ b/notegraphwidget.hh
@@ -6,6 +6,7 @@
#include <QLabel>
#include <QList>
#include <QScopedPointer>
+#include <QElapsedTimer>
class NoteLabel;
typedef QList<NoteLabel*> NoteLabels;
@@ -17,10 +18,10 @@ class SeekHandle: public QLabel
public:
SeekHandle(QWidget *parent = 0);
int curx() const { return x() + width() / 2; }
- int moveTimerId;
+ bool wrapToViewport;
protected:
void mouseMoveEvent(QMouseEvent *event);
- void timerEvent(QTimerEvent *event);
+ void moveEvent(QMoveEvent *event);
};
@@ -88,7 +89,7 @@ public:
void analyzeMusic(QString filepath);
void updateNotes(bool leftToRight = true);
- void updateMusicPos(qint64 time, bool smoothing);
+ void updateMusicPos(qint64 time, bool smoothing = true);
void stopMusic();
void seek(int x);
@@ -99,6 +100,7 @@ public:
public slots:
void timeSyllable();
void timeSentence();
+ void setSeekHandleWrapToViewport(bool state) { m_seekHandle.wrapToViewport = state; }
signals:
void analyzeProgress(int, int);
@@ -125,6 +127,9 @@ private:
QScopedPointer<PitchVis> m_pitch;
SeekHandle m_seekHandle;
int m_analyzeTimer;
+ int m_playbackTimer;
+ QElapsedTimer m_playbackInterval;
+ qint64 m_playbackPos;
double m_duration;
};
|
|
From: Tapio V. <aa...@us...> - 2011-02-02 15:52:15
|
Module: editor Branch: master Commit: dbb6179810ef66e1a6169de4eedb1b099e2035fe Author: Tapio Vierros <tap...@gm...> Date: Wed Feb 2 17:49:51 2011 +0200 Split big NoteGraphWidget class into two. * NoteLabelManager: NoteLabel and Operation related helper functions * NoteGraphWidget: Event listeners and general stuff --- notegraphwidget.cc | 223 +------------------------------------------------ notegraphwidget.hh | 67 ++++++++++----- notelabelmanager.cc | 232 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 277 insertions(+), 245 deletions(-) |
|
From: Tapio V. <aa...@us...> - 2011-02-02 15:17:06
|
Module: editor Branch: master Commit: 42400069defa919b615fb660771d192b3e0497a5 Author: Tapio Vierros <tap...@gm...> Date: Wed Feb 2 17:14:59 2011 +0200 Big multi-note selection refactoring. * Use list container in NoteGraphWidget instead of manually linking them. * Cleaner code, less buggy. * Undo is somewhat b0rked ATM. --- editorapp.cc | 2 +- notegraphwidget.cc | 118 ++++++++++++++++++++++++--------------------------- notegraphwidget.hh | 7 ++- notelabel.cc | 14 ++---- notelabel.hh | 11 +---- 5 files changed, 68 insertions(+), 84 deletions(-) |
|
From: Tapio V. <aa...@us...> - 2011-02-02 14:30:57
|
Module: editor
Branch: master
Commit: 838372497f6a0eca993359f0639dc8e4d03c3dc0
Author: Tapio Vierros <tap...@gm...>
Date: Wed Feb 2 16:29:37 2011 +0200
Keyboard left/right keys now call selectNextSyllable().
---
notegraphwidget.cc | 20 ++++++--------------
notegraphwidget.hh | 2 +-
2 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 6a35ee2..5d4136d 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -281,13 +281,13 @@ void NoteGraphWidget::timeSentence()
selectNextSentenceStart();
}
-void NoteGraphWidget::selectNextSyllable(bool backwards)
+void NoteGraphWidget::selectNextSyllable(bool backwards, bool addToSelection)
{
int i = getNoteLabelId(m_selectedNote);
if (!backwards && i < m_notes.size()-1)
- selectNote(m_notes[i+1]);
- else if (backwards && i > 1)
- selectNote(m_notes[i-1]);
+ selectNote(m_notes[i+1], !addToSelection);
+ else if (backwards && i > 0)
+ selectNote(m_notes[i-1], !addToSelection);
}
void NoteGraphWidget::selectNextSentenceStart()
@@ -558,17 +558,9 @@ void NoteGraphWidget::keyPressEvent(QKeyEvent *event)
} else if (k == Qt::Key_Return) { // Edit lyric
editLyric(m_selectedNote);
} else if (k == Qt::Key_Left) { // Select note on the left
- if (m_selectedNote && m_notes.size() > 1 && m_selectedNote != m_notes.front()) {
- for (NoteLabels::iterator it = m_notes.begin(); it != m_notes.end(); ++it) {
- if (m_selectedNote == *it) { selectNote(*(--it), !(m & Qt::ControlModifier)); break; }
- }
- }
+ selectNextSyllable(true, (m & Qt::ControlModifier));
} else if (k == Qt::Key_Right) { // Select note on the right
- if (m_selectedNote && m_notes.size() > 1 && m_selectedNote != m_notes.back()) {
- for (NoteLabels::iterator it = m_notes.begin(); it != m_notes.end(); ++it) {
- if (m_selectedNote == *it) { selectNote(*(++it), !(m & Qt::ControlModifier)); break; }
- }
- }
+ selectNextSyllable(false, (m & Qt::ControlModifier));
} else if (k == Qt::Key_Up) { // Move note up
move(m_selectedNote, 1);
} else if (k == Qt::Key_Down) { // Move note down
diff --git a/notegraphwidget.hh b/notegraphwidget.hh
index 5b65cfe..7e49c45 100644
--- a/notegraphwidget.hh
+++ b/notegraphwidget.hh
@@ -68,7 +68,7 @@ public:
public slots:
void timeSyllable();
void timeSentence();
- void selectNextSyllable(bool backwards = false);
+ void selectNextSyllable(bool backwards = false, bool addToSelection = false);
void selectNextSentenceStart();
signals:
|
|
From: Tapio V. <aa...@us...> - 2011-02-02 14:30:56
|
Module: editor
Branch: master
Commit: 7f5566f975e9d2c61c5a2b5636c64f8bf8a2c12d
Author: Tapio Vierros <tap...@gm...>
Date: Wed Feb 2 16:23:37 2011 +0200
Fix and greatly simplify selectNextSyllable and selectNextSentenceStart.
---
notegraphwidget.cc | 30 +++++++++++-------------------
notegraphwidget.hh | 2 +-
2 files changed, 12 insertions(+), 20 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index c4bf321..6a35ee2 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -281,30 +281,22 @@ void NoteGraphWidget::timeSentence()
selectNextSentenceStart();
}
-void NoteGraphWidget::selectNextSyllable()
-{
- bool currentFound = (m_selectedNote ? false : true);
- if (m_notes.size() > 1 && m_selectedNote != m_notes.back()) {
- for (NoteLabels::iterator it = m_notes.begin(); it != m_notes.end(); ++it) {
- if (m_selectedNote == *it) currentFound = true;
- else if (currentFound && (*it)->x() > m_seekHandle.curx()) {
- selectNote(*it); break;
- }
- }
- }
+void NoteGraphWidget::selectNextSyllable(bool backwards)
+{
+ int i = getNoteLabelId(m_selectedNote);
+ if (!backwards && i < m_notes.size()-1)
+ selectNote(m_notes[i+1]);
+ else if (backwards && i > 1)
+ selectNote(m_notes[i-1]);
}
void NoteGraphWidget::selectNextSentenceStart()
{
- bool currentFound = (m_selectedNote ? false : true);
- NoteLabel *prev = NULL;
- if (m_notes.size() > 1 && m_selectedNote != m_notes.back()) {
- for (NoteLabels::iterator it = m_notes.begin(); it != m_notes.end(); prev = *it, ++it) {
- if (m_selectedNote == *it) currentFound = true;
- else if (currentFound && (*it)->x() > m_seekHandle.curx()
- && prev && prev->note().lineBreak) {
- selectNote(*it); break;
- }
+ // Start looking for the sentance start from the next NoteLabel
+ for (int i = getNoteLabelId(m_selectedNote) + 1; i < m_notes.size(); ++i) {
+ if (m_notes[i]->note().lineBreak) {
+ selectNote(m_notes[i]);
+ break;
}
}
}
diff --git a/notegraphwidget.hh b/notegraphwidget.hh
index 8837198..5b65cfe 100644
--- a/notegraphwidget.hh
+++ b/notegraphwidget.hh
@@ -68,7 +68,7 @@ public:
public slots:
void timeSyllable();
void timeSentence();
- void selectNextSyllable();
+ void selectNextSyllable(bool backwards = false);
void selectNextSentenceStart();
signals:
|
|
From: Tapio V. <aa...@us...> - 2011-02-02 14:30:50
|
Module: editor
Branch: master
Commit: 0cc147ff437aa4f40a091fab799c798a1a0b0d42
Author: Tapio Vierros <tap...@gm...>
Date: Wed Feb 2 16:14:35 2011 +0200
Implement Skip syllable and Skip Sentence buttons.
---
editorapp.cc | 3 ++-
notegraphwidget.cc | 6 +++---
notegraphwidget.hh | 4 ++--
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/editorapp.cc b/editorapp.cc
index b5b3680..b84913b 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -42,7 +42,8 @@ EditorApp::EditorApp(QWidget *parent): QMainWindow(parent), gettingStarted(), pr
connect(noteGraph, SIGNAL(updateNoteInfo(NoteLabel*)), this, SLOT(updateNoteInfo(NoteLabel*)));
connect(ui.cmdTimeSyllable, SIGNAL(pressed()), noteGraph, SLOT(timeSyllable()));
connect(ui.cmdTimeSentence, SIGNAL(pressed()), noteGraph, SLOT(timeSentence()));
- // Duplicate/reused signals/slots
+ connect(ui.cmdSkipSyllable, SIGNAL(pressed()), noteGraph, SLOT(selectNextSyllable()));
+ connect(ui.cmdSkipSentence, SIGNAL(pressed()), noteGraph, SLOT(selectNextSentenceStart()));
connect(ui.cmdMusicFile, SIGNAL(clicked()), this, SLOT(on_actionMusicFile_triggered()));
show(); // Needed in order to get real values from width()
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 83b1bbe..c4bf321 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -272,7 +272,7 @@ void NoteGraphWidget::timeCurrent()
void NoteGraphWidget::timeSyllable()
{
timeCurrent();
- selectNextSyllableAfterSeekHandle();
+ selectNextSyllable();
}
void NoteGraphWidget::timeSentence()
@@ -281,7 +281,7 @@ void NoteGraphWidget::timeSentence()
selectNextSentenceStart();
}
-void NoteGraphWidget::selectNextSyllableAfterSeekHandle()
+void NoteGraphWidget::selectNextSyllable()
{
bool currentFound = (m_selectedNote ? false : true);
if (m_notes.size() > 1 && m_selectedNote != m_notes.back()) {
@@ -404,7 +404,7 @@ void NoteGraphWidget::mouseDoubleClickEvent(QMouseEvent *event)
if (!child) {
// Double click empty space = seek there
seek(event->x());
- selectNextSyllableAfterSeekHandle();
+ selectNextSyllable();
return;
}
diff --git a/notegraphwidget.hh b/notegraphwidget.hh
index d076c0c..8837198 100644
--- a/notegraphwidget.hh
+++ b/notegraphwidget.hh
@@ -68,6 +68,8 @@ public:
public slots:
void timeSyllable();
void timeSentence();
+ void selectNextSyllable();
+ void selectNextSentenceStart();
signals:
void updateNoteInfo(NoteLabel*);
@@ -88,8 +90,6 @@ protected:
private:
void finalizeNewLyrics();
void timeCurrent();
- void selectNextSyllableAfterSeekHandle();
- void selectNextSentenceStart();
int m_requiredWidth;
int m_noteHalfHeight;
|
|
From: Tapio V. <aa...@us...> - 2011-02-02 13:55:03
|
Module: editor
Branch: master
Commit: dc9c63543df4418d9f617265f8478d82868d3386
Author: Tapio Vierros <tap...@gm...>
Date: Wed Feb 2 15:54:34 2011 +0200
Some dummy controls.
---
editor.ui | 58 ++++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 44 insertions(+), 14 deletions(-)
diff --git a/editor.ui b/editor.ui
index 040d86a..49a3880 100644
--- a/editor.ui
+++ b/editor.ui
@@ -380,7 +380,27 @@
</property>
</widget>
</item>
- <item row="2" column="1">
+ <item row="5" column="0">
+ <spacer name="verticalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="4" column="0" colspan="2">
+ <widget class="QLabel" name="lblCurrentSentence">
+ <property name="text">
+ <string>Current sentence:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
<widget class="QPushButton" name="cmdTimeSentence">
<property name="toolTip">
<string>Set selected note start to cursor position and move to next sentence start.</string>
@@ -393,23 +413,33 @@
</property>
</widget>
</item>
- <item row="4" column="0">
- <spacer name="verticalSpacer_3">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
+ <item row="2" column="1">
+ <widget class="QPushButton" name="cmdSkipSyllable">
+ <property name="text">
+ <string>Skip syllable (J)</string>
</property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
+ <property name="shortcut">
+ <string>J</string>
</property>
- </spacer>
+ </widget>
</item>
- <item row="3" column="0" colspan="2">
- <widget class="QLabel" name="lblCurrentSentence">
+ <item row="2" column="2">
+ <widget class="QPushButton" name="cmdSkipSentence">
<property name="text">
- <string>Current sentence:</string>
+ <string>Skip Sentence (K)</string>
+ </property>
+ <property name="shortcut">
+ <string>K</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="chkGrabSeekHandle">
+ <property name="text">
+ <string>Keep playback position in view</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
</property>
</widget>
</item>
|
|
From: Tapio V. <aa...@us...> - 2011-02-02 13:52:38
|
Module: editor
Branch: master
Commit: d299b0ffe37673f117bcd8b441c408c4f4fa9b5d
Author: Tapio Vierros <tap...@gm...>
Date: Wed Feb 2 15:51:57 2011 +0200
Fix segfault in timeCurrent().
---
notegraphwidget.cc | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 3c841e1..83b1bbe 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -262,8 +262,9 @@ void NoteGraphWidget::timeCurrent()
{
if (m_selectedNote) {
Operation op("MOVE");
- op << px2s(m_seekHandle.curx()) << px2s(m_seekHandle.curx() + m_selectedNote->width())
- << int(round(px2n(m_selectedNote->y() + m_noteHalfHeight))) + 1;
+ op << getNoteLabelId(m_selectedNote)
+ << px2s(m_seekHandle.curx()) << px2s(m_seekHandle.curx() + m_selectedNote->width())
+ << int(round(px2n(m_selectedNote->y() + m_noteHalfHeight))) + 1;
doOperation(op);
}
}
@@ -371,7 +372,7 @@ void NoteGraphWidget::mouseReleaseEvent(QMouseEvent *event)
if (m_actionHappened) {
// Operation for undo stack & saving
Operation op("MOVE");
- op << getNoteLabelId(n)
+ op << getNoteLabelId(n)
<< px2s(n->x()) << px2n(n->x() + n->width())
<< int(round(px2n(n->y() + m_noteHalfHeight)));
doOperation(op, Operation::NO_EXEC);
|
|
From: Yoda-JM <yo...@us...> - 2011-02-02 13:22:56
|
Module: editor
Branch: master
Commit: c162362f91740423c10280a962d7a5044e681580
Author: Vincent Le Ligeour <yo...@us...>
Date: Wed Feb 2 14:22:35 2011 +0100
Fixed segfault introduced by new move prototype
---
notegraphwidget.cc | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 9b8a405..3c841e1 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -464,8 +464,9 @@ void NoteGraphWidget::move(NoteLabel *note, int value)
int movecount = 0;
for (NoteLabel *n = note ; n; n = n->nextSelected, ++movecount) {
Operation op("MOVE");
- op << getNoteLabelId(n);
- op << n->x() << int(round(px2n(n->y() + m_noteHalfHeight))) + value;
+ op << getNoteLabelId(n)
+ << px2s(n->x()) << px2s(n->x() + n->width())
+ << int(round(px2n(n->y() + m_noteHalfHeight))) + value;
doOperation(op);
}
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2011-02-02 12:36:11
|
Module: editor Branch: master Commit: 73a4a1665793e01c90123cd44ed0df49aad49eda Author: Lasse Karkkainen <tro...@tr...> Date: Wed Feb 2 13:36:00 2011 +0100 Fix compile warning. --- notelabel.cc | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/notelabel.cc b/notelabel.cc index 224b7f1..3e5daa6 100644 --- a/notelabel.cc +++ b/notelabel.cc @@ -127,7 +127,7 @@ void NoteLabel::mouseMoveEvent(QMouseEvent *event) NoteLabel *n = this; // Pick first note in the selection chain while (n->prevSelected) n = n->prevSelected; - for (n; n; n = n->nextSelected) + for (; n; n = n->nextSelected) n->move(n->x() + dx, ngw->n2px(int(round(ngw->px2n(n->y() + dy + height() / 2)))) - height() / 2); ngw->updateNotes((event->pos() - m_hotspot).x() < 0); } |
|
From: Lasse Kärkkäi. <tr...@us...> - 2011-02-02 12:28:23
|
Module: editor
Branch: master
Commit: c7d93cf94cc13efef372826c4b9a8c146512fb2c
Author: Lasse Karkkainen <tro...@tr...>
Date: Wed Feb 2 13:08:08 2011 +0100
Remove SETGEOM command and use MOVE <begin> <end> <note> with seconds and midinotes as units instead of pixels.
---
notegraphwidget.cc | 21 ++++++++++-----------
1 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 169c3c0..9b8a405 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -135,7 +135,9 @@ void NoteGraphWidget::finalizeNewLyrics()
Operation floatop("FLOATING"); floatop << (int)m_notes.size()-1 << false;
doOperation(floatop);
Operation moveop("MOVE");
- moveop << (int)m_notes.size()-1 << width() - m_notes.back()->width() << m_notes.back()->y();
+ moveop << (int)m_notes.size()-1
+ << px2s(width() - m_notes.back()->width()) << px2s(width() - m_notes.back()->width() + m_notes.back()->x())
+ << px2n(m_notes.back()->y() + m_noteHalfHeight);
doOperation(moveop);
// Make sure there is enough room
setFixedWidth(std::max<int>(width(), m_notes.size() * NoteLabel::min_width + m_notes.front()->width() * 2));
@@ -259,10 +261,9 @@ void NoteGraphWidget::seek(int x)
void NoteGraphWidget::timeCurrent()
{
if (m_selectedNote) {
- // TODO: Automatic pitch detection
Operation op("MOVE");
- op << getNoteLabelId(m_selectedNote)
- << m_seekHandle.curx() << m_selectedNote->y();
+ op << px2s(m_seekHandle.curx()) << px2s(m_seekHandle.curx() + m_selectedNote->width())
+ << int(round(px2n(m_selectedNote->y() + m_noteHalfHeight))) + 1;
doOperation(op);
}
}
@@ -369,9 +370,10 @@ void NoteGraphWidget::mouseReleaseEvent(QMouseEvent *event)
n->startDragging(QPoint());
if (m_actionHappened) {
// Operation for undo stack & saving
- Operation op("SETGEOM");
+ Operation op("MOVE");
op << getNoteLabelId(n)
- << n->x() << n->y() << n->width() << n->height();
+ << px2s(n->x()) << px2n(n->x() + n->width())
+ << int(round(px2n(n->y() + m_noteHalfHeight)));
doOperation(op, Operation::NO_EXEC);
++movecount;
}
@@ -523,7 +525,7 @@ void NoteGraphWidget::mouseMoveEvent(QMouseEvent *event)
m_actionHappened = true; // We have movement, so resize/move can be accepted
// See if the note needs to be unfloated
if (m_selectedAction != NONE && m_selectedNote && m_selectedNote->isFloating()) {
- // Undo op is handled later by the SETGEOM constructed at drop
+ // Undo op is handled later by the MOVE constructed at drop
m_selectedNote->setFloating(false);
}
}
@@ -607,14 +609,11 @@ void NoteGraphWidget::doOperation(const Operation& op, Operation::OperationFlags
n->setSelected(false); // Remove from selection list
n->close();
m_notes.removeAt(op.i(1));
- } else if (action == "SETGEOM") {
- n->setGeometry(op.i(2), op.i(3), op.i(4), op.i(5));
- n->setFloating(false);
} else if (action == "RESIZE") {
n->resize(op.i(2), op.i(3));
n->setFloating(false);
} else if (action == "MOVE") {
- n->move(op.i(2), n2px(op.i(3)) - m_noteHalfHeight);
+ n->setGeometry(s2px(op.i(2)), n2px(op.i(4)) - m_noteHalfHeight, s2px(op.i(3) - op.i(2)), 2 * m_noteHalfHeight);
n->setFloating(false);
} else if (action == "FLOATING") {
n->setFloating(op.b(2));
|
|
From: Tapio V. <aa...@us...> - 2011-02-02 12:15:30
|
Module: editor
Branch: master
Commit: 0680519c4724f0b730304612ec9945c024cb4b1a
Author: Tapio Vierros <tap...@gm...>
Date: Wed Feb 2 14:14:43 2011 +0200
Handle undoing the moving of multiple notes with mouse.
---
notegraphwidget.cc | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index d35c386..169c3c0 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -363,18 +363,22 @@ void NoteGraphWidget::mouseReleaseEvent(QMouseEvent *event)
(void)*event;
if (m_selectedAction != NONE) {
if (m_selectedNote) {
+ int movecount = 0;
for (NoteLabel *n = m_selectedNote; n; n = n->nextSelected) {
n->startResizing(0);
n->startDragging(QPoint());
+ if (m_actionHappened) {
+ // Operation for undo stack & saving
+ Operation op("SETGEOM");
+ op << getNoteLabelId(n)
+ << n->x() << n->y() << n->width() << n->height();
+ doOperation(op, Operation::NO_EXEC);
+ ++movecount;
+ }
}
- if (m_actionHappened) {
- // TODO: Undo multiple note move
- // Operation for undo stack & saving
- Operation op("SETGEOM");
- op << getNoteLabelId(m_selectedNote)
- << m_selectedNote->x() << m_selectedNote->y()
- << m_selectedNote->width() << m_selectedNote->height();
- doOperation(op, Operation::NO_EXEC);
+ // Combine to one undo operation
+ if (movecount > 1) {
+ Operation op("COMBINER"); op << movecount; doOperation(op);
}
}
m_selectedAction = NONE;
|
|
From: Tapio V. <aa...@us...> - 2011-02-02 12:15:27
|
Module: editor
Branch: master
Commit: 4d1dc41f4fb4f92a5e0b5c9d8d203eab761bba99
Author: Tapio Vierros <tap...@gm...>
Date: Wed Feb 2 14:07:24 2011 +0200
Improve still buggy multi-note movement.
---
notegraphwidget.cc | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 6948f61..d35c386 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -344,8 +344,7 @@ void NoteGraphWidget::mousePressEvent(QMouseEvent *event)
// Ctrl allows selecting multiple notes for dragging
selectNote(child, !(event->modifiers() & Qt::ControlModifier));
m_selectedAction = MOVE;
- for (NoteLabel *n = m_selectedNote; n; n = n->nextSelected)
- n->startDragging(hotSpot);
+ child->startDragging(hotSpot);
}
child->createPixmap(child->size());
@@ -364,10 +363,12 @@ void NoteGraphWidget::mouseReleaseEvent(QMouseEvent *event)
(void)*event;
if (m_selectedAction != NONE) {
if (m_selectedNote) {
- m_selectedNote->startResizing(0);
- m_selectedNote->startDragging(QPoint());
- m_selectedNote->move(m_selectedNote->pos().x(), n2px(round(px2n(m_selectedNote->pos().y() + m_noteHalfHeight))) - m_noteHalfHeight);
+ for (NoteLabel *n = m_selectedNote; n; n = n->nextSelected) {
+ n->startResizing(0);
+ n->startDragging(QPoint());
+ }
if (m_actionHappened) {
+ // TODO: Undo multiple note move
// Operation for undo stack & saving
Operation op("SETGEOM");
op << getNoteLabelId(m_selectedNote)
|
|
From: Tapio V. <aa...@us...> - 2011-02-02 11:40:24
|
Module: editor
Branch: master
Commit: 108bcf0725a2f29cf8753d28b92be4ad72a72176
Author: Tapio Vierros <tap...@gm...>
Date: Wed Feb 2 13:39:54 2011 +0200
Buggy first version of multi-note mouse moving.
---
notegraphwidget.cc | 12 ++++--------
notelabel.cc | 8 ++++++--
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index f1ab117..6948f61 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -336,20 +336,16 @@ void NoteGraphWidget::mousePressEvent(QMouseEvent *event)
// Determine if it is drag or resize
if (hotSpot.x() < NoteLabel::resize_margin || hotSpot.x() > child->width() - NoteLabel::resize_margin) {
// Start a resize
- selectNote(child);
+ selectNote(child); // Resizing will deselect everything but one
m_selectedAction = RESIZE;
child->startResizing( (hotSpot.x() < NoteLabel::resize_margin) ? -1 : 1 );
} else {
// Ctrl allows selecting multiple notes for dragging
selectNote(child, !(event->modifiers() & Qt::ControlModifier));
- // FIXME: Drag disabled for multiple notes
- if (m_selectedNote && !m_selectedNote->nextSelected) {
- // Start a drag
- m_selectedAction = MOVE;
- child->startDragging(hotSpot);
-
- }
+ m_selectedAction = MOVE;
+ for (NoteLabel *n = m_selectedNote; n; n = n->nextSelected)
+ n->startDragging(hotSpot);
}
child->createPixmap(child->size());
diff --git a/notelabel.cc b/notelabel.cc
index 031a0a2..224b7f1 100644
--- a/notelabel.cc
+++ b/notelabel.cc
@@ -122,9 +122,13 @@ void NoteLabel::mouseMoveEvent(QMouseEvent *event)
} else if (!m_hotspot.isNull()) {
// Moving
QPoint newpos = pos() + event->pos() - m_hotspot;
- move(newpos);
+ int dx = newpos.x() - pos().x(), dy = newpos.y() - pos().y();
if (ngw) {
- move(x(), ngw->n2px(int(round(ngw->px2n(y() + height() / 2)))) - height() / 2);
+ NoteLabel *n = this;
+ // Pick first note in the selection chain
+ while (n->prevSelected) n = n->prevSelected;
+ for (n; n; n = n->nextSelected)
+ n->move(n->x() + dx, ngw->n2px(int(round(ngw->px2n(n->y() + dy + height() / 2)))) - height() / 2);
ngw->updateNotes((event->pos() - m_hotspot).x() < 0);
}
// Check if we need a new hotspot, because the note was constrained
|