Code for the video demo:
Fixed log duration. Renable partition multilinestc-disrupt-london-midi
parent
6b99662184
commit
1d6621c31c
|
@ -107,7 +107,7 @@ angular.module('eventStreamService', [])
|
||||||
// Initial sync: get all information and the last 30 messages of all rooms of the user
|
// Initial sync: get all information and the last 30 messages of all rooms of the user
|
||||||
// 30 messages should be enough to display a full page of messages in a room
|
// 30 messages should be enough to display a full page of messages in a room
|
||||||
// without requiring to make an additional request
|
// without requiring to make an additional request
|
||||||
matrixService.initialSync(10000, false).then(
|
matrixService.initialSync(1, false).then(
|
||||||
function(response) {
|
function(response) {
|
||||||
var rooms = response.data.rooms;
|
var rooms = response.data.rooms;
|
||||||
for (var i = 0; i < rooms.length; ++i) {
|
for (var i = 0; i < rooms.length; ++i) {
|
||||||
|
|
|
@ -87,7 +87,7 @@ notes C-D-E/4 #0# =:: C-D-E-F/4 =|=");
|
||||||
|
|
||||||
getLogDuration: function(duration) {
|
getLogDuration: function(duration) {
|
||||||
var fraction = duration / this.beat;
|
var fraction = duration / this.beat;
|
||||||
console.log(fraction);
|
//console.log(fraction);
|
||||||
|
|
||||||
// log2(4) = 2 # 4 beats == whole bar == w
|
// log2(4) = 2 # 4 beats == whole bar == w
|
||||||
// log2(2) = 1 # 2 beats == half = h
|
// log2(2) = 1 # 2 beats == half = h
|
||||||
|
@ -101,26 +101,26 @@ notes C-D-E/4 #0# =:: C-D-E-F/4 =|=");
|
||||||
var logDuration = this.getLogDuration(duration);
|
var logDuration = this.getLogDuration(duration);
|
||||||
var trashIt = false; // Flag to ignore artefact(???)
|
var trashIt = false; // Flag to ignore artefact(???)
|
||||||
switch (logDuration) {
|
switch (logDuration) {
|
||||||
case 4:
|
case 2:
|
||||||
musicFraction = "w";
|
musicFraction = "w";
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 1:
|
||||||
musicFraction = "h";
|
musicFraction = "h";
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 0:
|
||||||
musicFraction = "q";
|
musicFraction = "q";
|
||||||
break;
|
break;
|
||||||
/* // quantise to quavers for now
|
// quantise to quavers for now
|
||||||
case 0:
|
case -1:
|
||||||
musicFraction = "8";
|
musicFraction = "8";
|
||||||
break;
|
break;
|
||||||
case -1:
|
case -2:
|
||||||
musicFraction = "16";
|
musicFraction = "16";
|
||||||
break;
|
break;
|
||||||
case -2:
|
case -3:
|
||||||
musicFraction = "32";
|
musicFraction = "32";
|
||||||
break;
|
break;
|
||||||
*/
|
|
||||||
default:
|
default:
|
||||||
console.log("## Ignored note");
|
console.log("## Ignored note");
|
||||||
// Too short, ignore it
|
// Too short, ignore it
|
||||||
|
@ -131,6 +131,8 @@ notes C-D-E/4 #0# =:: C-D-E-F/4 =|=");
|
||||||
// Matthew is about to fix it
|
// Matthew is about to fix it
|
||||||
if (trashIt) return;
|
if (trashIt) return;
|
||||||
|
|
||||||
|
this.currentMeasureTime += duration / this.beat;
|
||||||
|
|
||||||
var s = ":" + musicFraction + " ";
|
var s = ":" + musicFraction + " ";
|
||||||
|
|
||||||
if (rest) {
|
if (rest) {
|
||||||
|
@ -202,7 +204,10 @@ notes C-D-E/4 #0# =:: C-D-E-F/4 =|=");
|
||||||
|
|
||||||
// check if it's been so long since the last note that we should do a rest.
|
// check if it's been so long since the last note that we should do a rest.
|
||||||
var logDuration = this.getLogDuration(midi_ts - this.chord.end_midi_ts);
|
var logDuration = this.getLogDuration(midi_ts - this.chord.end_midi_ts);
|
||||||
if (logDuration >= -2) {
|
|
||||||
|
//console.log((midi_ts - this.chord.end_midi_ts) + " -> " + logDuration);
|
||||||
|
|
||||||
|
if (logDuration >= 1) {
|
||||||
this.renderChord(midi_ts - this.chord.end_midi_ts, true);
|
this.renderChord(midi_ts - this.chord.end_midi_ts, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue