Commit 4ddca897 authored by Sandro Andrade's avatar Sandro Andrade
Browse files

Fix piano key highlight for non-noteoff (vel=0) midi files

parent a8154731
......@@ -108,14 +108,14 @@ void MidiSequencer::SMFHeader(int format, int ntrks, int division)
m_song.setHeader(format, ntrks, division);
}
void MidiSequencer::SMFNoteOn(int chan, int pitch, int vol)
void MidiSequencer::SMFNoteOn(int chan, int pitch, int vel)
{
appendEvent(new drumstick::NoteOnEvent(chan, pitch, vol));
appendEvent(new drumstick::NoteOnEvent(chan, pitch, vel));
}
void MidiSequencer::SMFNoteOff(int chan, int pitch, int vol)
void MidiSequencer::SMFNoteOff(int chan, int pitch, int vel)
{
appendEvent(new drumstick::NoteOffEvent(chan, pitch, vol));
appendEvent(new drumstick::NoteOffEvent(chan, pitch, vel));
}
void MidiSequencer::SMFKeyPress(int chan, int pitch, int press)
......
......@@ -52,14 +52,14 @@ public:
void play(const QString &fileName);
Q_SIGNALS:
void noteOn(int chan, int pitch, int vol);
void noteOff(int chan, int pitch, int vol);
void noteOn(int chan, int pitch, int vel);
void noteOff(int chan, int pitch, int vel);
private Q_SLOTS:
// Slots for events generated when reading a MIDI file
void SMFHeader(int format, int ntrks, int division);
void SMFNoteOn(int chan, int pitch, int vol);
void SMFNoteOff(int chan, int pitch, int vol);
void SMFNoteOn(int chan, int pitch, int vel);
void SMFNoteOff(int chan, int pitch, int vel);
void SMFKeyPress(int chan, int pitch, int press);
void SMFCtlChange(int chan, int ctl, int value);
void SMFPitchBend(int chan, int value);
......
<RCC>
<qresource prefix="/">
<file alias="main.qml">qml/main.qml</file>
<file alias="WhiteKey.qml">qml/WhiteKey.qml</file>
<file alias="BlackKey.qml">qml/BlackKey.qml</file>
<file alias="Octave.qml">qml/Octave.qml</file>
<file alias="PianoView.qml">qml/PianoView.qml</file>
<file alias="MultimediaButton.qml">qml/MultimediaButton.qml</file>
<file alias="MultimediaSlider.qml">qml/MultimediaSlider.qml</file>
<file alias="MidiPlayer.qml">qml/MidiPlayer.qml</file>
<file alias="WhiteKey.qml">qml/pianoview/WhiteKey.qml</file>
<file alias="BlackKey.qml">qml/pianoview/BlackKey.qml</file>
<file alias="Octave.qml">qml/pianoview/Octave.qml</file>
<file alias="PianoView.qml">qml/pianoview/PianoView.qml</file>
<file alias="MultimediaButton.qml">qml/midiplayer/MultimediaButton.qml</file>
<file alias="MultimediaSlider.qml">qml/midiplayer/MultimediaSlider.qml</file>
<file alias="MidiPlayer.qml">qml/midiplayer/MidiPlayer.qml</file>
<file alias="images/minuet-background.png">qml/images/minuet-background.png</file>
<file alias="images/navigate-next.png">qml/images/navigate-next.png</file>
<file alias="images/multimedia-pause.png">qml/images/multimedia-pause.png</file>
......
......@@ -6,10 +6,13 @@ Item {
property int keyWidth: 20
property int keyHeight: 3.4*keyWidth
function noteOn(chan, pitch, vol) {
highlightKey(pitch, "#778692")
function noteOn(chan, pitch, vel) {
if (vel > 0)
highlightKey(pitch, "#778692")
else
noteOff(chan, pitch, vel)
}
function noteOff(chan, pitch, vol) {
function noteOff(chan, pitch, vel) {
highlightKey(pitch, ([1,3,6,8,10].indexOf(pitch % 12) > -1) ? "black":"white")
}
function highlightKey(pitch, color) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment