Mercurial > hg > webaudioevaluationtool
comparison ape.js @ 939:c2fe27b91359
Only 'Stop' button; 'Start' when any sample is clicked.
author | Brecht De Man <BrechtDeMan@users.noreply.github.com> |
---|---|
date | Sat, 16 May 2015 20:58:15 +0100 |
parents | c3fe29d33643 |
children | 475aeb3075da |
comparison
equal
deleted
inserted
replaced
938:c3fe29d33643 | 939:c2fe27b91359 |
---|---|
164 var downloadPoint = document.createElement('div'); | 164 var downloadPoint = document.createElement('div'); |
165 downloadPoint.id = 'download-point'; | 165 downloadPoint.id = 'download-point'; |
166 | 166 |
167 // Create playback start/stop points | 167 // Create playback start/stop points |
168 var playback = document.createElement("button"); | 168 var playback = document.createElement("button"); |
169 playback.innerHTML = 'Start'; | 169 playback.innerHTML = 'Stop'; |
170 playback.id = 'playback-button'; | 170 playback.id = 'playback-button'; |
171 // onclick function. Check if it is playing or not, call the correct function in the | 171 // onclick function. Check if it is playing or not, call the correct function in the |
172 // audioEngine, change the button text to reflect the next state. | 172 // audioEngine, change the button text to reflect the next state. |
173 playback.onclick = function() { | 173 playback.onclick = function() { |
174 if (audioEngineContext.status == 0) { | 174 if (audioEngineContext.status == 1) { |
175 audioEngineContext.play(); | 175 audioEngineContext.stop(); |
176 this.innerHTML = 'Stop'; | 176 this.innerHTML = 'Stop'; |
177 } else { | |
178 audioEngineContext.stop(); | |
179 this.innerHTML = 'Start'; | |
180 } | 177 } |
181 }; | 178 }; |
182 // Create Submit (save) button | 179 // Create Submit (save) button |
183 var submit = document.createElement("button"); | 180 var submit = document.createElement("button"); |
184 submit.innerHTML = 'Submit'; | 181 submit.innerHTML = 'Submit'; |
500 { | 497 { |
501 document.getElementById('track-slider-'+i).style.backgroundColor = "rgb(100,200,100)"; | 498 document.getElementById('track-slider-'+i).style.backgroundColor = "rgb(100,200,100)"; |
502 } | 499 } |
503 | 500 |
504 } | 501 } |
502 audioEngineContext.play(); | |
505 }; | 503 }; |
506 | 504 |
507 canvas.appendChild(trackSliderObj); | 505 canvas.appendChild(trackSliderObj); |
508 }); | 506 }); |
509 | 507 |
779 showPopup(); | 777 showPopup(); |
780 preTestPopupStart(postTest); | 778 preTestPopupStart(postTest); |
781 } | 779 } |
782 } | 780 } |
783 | 781 |
784 function buttonSubmitClick() | 782 function buttonSubmitClick() // TODO: Only when all songs have been played! |
785 { | 783 { |
786 if (audioEngineContext.status == 1) { | 784 if (audioEngineContext.status == 1) { |
787 var playback = document.getElementById('playback-button'); | 785 var playback = document.getElementById('playback-button'); |
788 playback.click(); | 786 playback.click(); |
789 // This function is called when the submit button is clicked. Will check for any further tests to perform, or any post-test options | 787 // This function is called when the submit button is clicked. Will check for any further tests to perform, or any post-test options |