Skip to content
This repository was archived by the owner on Jul 10, 2019. It is now read-only.

Commit a85e0e0

Browse files
committed
using a real test JSON score, and enabling/disabling buttons
1 parent 11399f9 commit a85e0e0

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

js/tidal.js

+15-6
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,32 @@
2323

2424
function playWithWebDirt(button) {
2525
$(button).text('loading');
26-
dirt.playScoreWhenReady([{sample_name: 'cp', sample_n:0, when:0}],0.05,
27-
function() { $(button).text('stop') }, // readyCallback
28-
function() { $(button).text('play') } // finishedCallback
29-
);
30-
// dirt.loadAndPlayScore(url,0.05);
26+
$(button).prop('disabled',true);
3127
// both of these methods will only start when all necessary samples loaded
32-
// hence, the low latency setting of 50 milliseconds
28+
// hence, the low latency setting of 50 milliseconds:
29+
// dirt.playScoreWhenReady([{sample_name: 'cp', sample_n:0, when:0}],0.05,
30+
dirt.loadAndPlayScore("testScore.json",0.05,
31+
function() { // readyCallback
32+
$(button).text('playing');
33+
$(button).prop('disabled',true);
34+
},
35+
function() { // finishedCallback
36+
$(button).text('play');
37+
$(button).prop('disabled',false);
38+
}
39+
);
3340
}
3441

3542
$(document).ready(function() {
3643
$(".render").each(function() {
3744
var button = $('<button/>', { text: "loading", class: "renderButton" });
45+
button.prop('disabled',true);
3846
$(this).append(button);
3947
});
4048
dirt = new WebDirt("/WebDirt/sampleMap.json", "/samples", null, function() {
4149
$(".renderButton").each(function() {
4250
$(this).text('play');
51+
$(this).prop('disabled',false);
4352
var button = this;
4453
$(this).on('click',function() {
4554
playWithWebDirt(button);

testScore.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[{"when":1.5,"s":"bd"},{"when":1,"s":"bd"},{"when":0.6666666666666666,"s":"bd"},{"when":0.5555555555555556,"s":"sn"},{"when":0.5,"s":"sn"},{"when":0.4444444444444444,"s":"sn"},{"when":0.3333333333333333,"s":"sn"},{"when":0,"s":"sn"},{"when":3.5,"s":"bd"},{"when":3,"s":"bd"},{"when":2.6666666666666665,"s":"bd"},{"when":2.5555555555555554,"s":"sn"},{"when":2.5,"s":"sn"},{"when":2.4444444444444446,"s":"sn"},{"when":2.3333333333333335,"s":"sn"},{"when":2,"s":"sn"},{"when":5.5,"s":"bd"},{"when":5,"s":"bd"},{"when":4.666666666666667,"s":"bd"},{"when":4.555555555555555,"s":"sn"},{"when":4.5,"s":"sn"},{"when":4.444444444444445,"s":"sn"},{"when":4.333333333333333,"s":"sn"},{"when":4,"s":"sn"},{"when":7.5,"s":"bd"},{"when":7,"s":"bd"},{"when":6.666666666666667,"s":"bd"},{"when":6.555555555555555,"s":"sn"},{"when":6.5,"s":"sn"},{"when":6.444444444444445,"s":"sn"},{"when":6.333333333333333,"s":"sn"},{"when":6,"s":"sn"}]

0 commit comments

Comments
 (0)