Skip to content

Commit

Permalink
mistake resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
b18050 committed Feb 22, 2020
1 parent f58cb9b commit 753a27c
Show file tree
Hide file tree
Showing 13 changed files with 91 additions and 26 deletions.
Binary file added images/animations/sel_a1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/animations/sel_a_sharp1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/animations/sel_b1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/animations/sel_c1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/animations/sel_c_sharp1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/animations/sel_d1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/animations/sel_d_sharp1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/animations/sel_e1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/animations/sel_f1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/animations/sel_f_sharp1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/animations/sel_g1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/animations/sel_g_sharp1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
117 changes: 91 additions & 26 deletions js/widgets/modewidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,50 +417,115 @@ function ModeWidget() {
this._notesToPlay.push(i);
}
}

console.debug(this._notesToPlay);
this._lastNotePlayed = null;
if (this._playing) {
this.__playNextNote(0);
}
};

this.__playNextNote = function(i) {

var highlightImgs = ['images/highlights/sel_c.png', 'images/highlights/sel_c_sharp.png', 'images/highlights/sel_d.png', 'images/highlights/sel_d_sharp.png', 'images/highlights/sel_e.png', 'images/highlights/sel_f.png', 'images/highlights/sel_f_sharp.png', 'images/highlights/sel_g.png', 'images/highlights/sel_g_sharp.png', 'images/highlights/sel_a.png', 'images/highlights/sel_a_sharp.png', 'images/highlights/sel_b.png'];

var animationImgs = ['images/animations/sel_c1.png', 'images/animations/sel_c_sharp1.png', 'images/animations/sel_d1.png', 'images/animations/sel_d_sharp1.png', 'images/animations/sel_e1.png', 'images/animations/sel_f1.png', 'images/animations/sel_f_sharp1.png', 'images/animations/sel_g1.png', 'images/animations/sel_g_sharp1.png', 'images/animations/sel_a1.png', 'images/animations/sel_a_sharp1.png', 'images/animations/sel_b1.png'];

var startingposition = 0;
time = this._noteValue + 0.125;
var that = this;


if (i > this._notesToPlay.length - 1) {
setTimeout(function() {
var currentKey = keySignatureToMode(this._logo.keySignature[0])[0];
if(currentKey === 'C'){
if (i > this._notesToPlay.length - 1) {
setTimeout(function() {
// Did we just play the last note?
that._playing = false;
that._playing = false;
var note_key = document.getElementById('pkey_'+0);
if(note_key !==null) {
note_key.src = highlightImgs[0];
}
that._playButton.innerHTML = '&nbsp;&nbsp;<img src="header-icons/play-button.svg" title="' + _('Play all') + '" alt="' + _('Play all') + '" height="' + ICONSIZE + '" width="' + ICONSIZE + '" vertical-align="middle">&nbsp;&nbsp;';
that._resetNotes();
that._locked = false;
}, 1000 * time);

that._playButton.innerHTML = '&nbsp;&nbsp;<img src="header-icons/play-button.svg" title="' + _('Play all') + '" alt="' + _('Play all') + '" height="' + ICONSIZE + '" width="' + ICONSIZE + '" vertical-align="middle">&nbsp;&nbsp;';
that._resetNotes();
that._locked = false;
}, 1000 * time);
return;

}

return;
}
setTimeout(function() {
if (that._lastNotePlayed !== null) {
that._playWheel.navItems[that._lastNotePlayed % 12].navItem.hide();
var note_key = document.getElementById('pkey_'+that._lastNotePlayed % 12);
if(note_key !==null){
note_key.src = highlightImgs[(that._lastNotePlayed+startingposition)%12];;
}
}

setTimeout(function() {
if (that._lastNotePlayed !== null) {
that._playWheel.navItems[that._lastNotePlayed % 12].navItem.hide();
}
note = that._notesToPlay[i];
that._playWheel.navItems[note % 12].navItem.show();

var flag = that._lastNotePlayed ===12 && note ===12;
if(!flag) {
var note_key = document.getElementById('pkey_'+note%12);
if(note_key !==null){
note_key.src = animationImgs[(note+startingposition)%12];
}
}


that._lastNotePlayed = note;
var ks = that._logo.keySignature[0];
var noteToPlay = getNote(that._pitch, 4, note, ks, false, null, that._logo.errorMsg);
that._logo.synth.trigger(0, noteToPlay[0].replace(//g, '#').replace(//g, 'b') + noteToPlay[1], that._noteValue, DEFAULTVOICE, null, null);
if (that._playing) {
that.__playNextNote(i + 1);
} else {
that._locked = false;
setTimeout(that._resetNotes(), 500);
return;
}
}, 1000 * time);
}

note = that._notesToPlay[i];
that._playWheel.navItems[note % 12].navItem.show();
that._lastNotePlayed = note;
else {
if (i > this._notesToPlay.length - 1) {
setTimeout(function() {
// Did we just play the last note?
that._playing = false;
that._playButton.innerHTML = '&nbsp;&nbsp;<img src="header-icons/play-button.svg" title="' + _('Play all') + '" alt="' + _('Play all') + '" height="' + ICONSIZE + '" width="' + ICONSIZE + '" vertical-align="middle">&nbsp;&nbsp;';
that._resetNotes();
that._locked = false;
}, 1000 * time);

var ks = that._logo.keySignature[0];
var noteToPlay = getNote(that._pitch, 4, note, ks, false, null, that._logo.errorMsg);
that._logo.synth.trigger(0, noteToPlay[0].replace(//g, '#').replace(//g, 'b') + noteToPlay[1], that._noteValue, DEFAULTVOICE, null, null);
if (that._playing) {
that.__playNextNote(i + 1);
} else {
that._locked = false;
setTimeout(that._resetNotes(), 500);
return;
}
}, 1000 * time);

setTimeout(function() {
if (that._lastNotePlayed !== null) {
that._playWheel.navItems[that._lastNotePlayed % 12].navItem.hide();

}

note = that._notesToPlay[i];
that._playWheel.navItems[note % 12].navItem.show();
that._lastNotePlayed = note;

var ks = that._logo.keySignature[0];
var noteToPlay = getNote(that._pitch, 4, note, ks, false, null, that._logo.errorMsg);
that._logo.synth.trigger(0, noteToPlay[0].replace(//g, '#').replace(//g, 'b') + noteToPlay[1], that._noteValue, DEFAULTVOICE, null, null);
if (that._playing) {
that.__playNextNote(i + 1);
} else {
that._locked = false;
setTimeout(that._resetNotes(), 500);
return;
}
}, 1000 * time);

}

};

this._playNote = function(i) {
Expand Down

0 comments on commit 753a27c

Please sign in to comment.