Mercurial > hg > webaudioevaluationtool
diff interfaces/discrete.js @ 1360:a9eb4f6443d8
Interfaces have startPlayback and stopPlayback methods to clean up code management. Looping playbacks now have a 2s cross-fade.
author | Nicholas Jillings <nickjillings@users.noreply.github.com> |
---|---|
date | Tue, 26 Jan 2016 13:52:56 +0000 |
parents | 386415d2a5c1 |
children | cb348f6208b2 c0022a09c4f6 |
line wrap: on
line diff
--- a/interfaces/discrete.js Tue Jan 26 11:32:11 2016 +0000 +++ b/interfaces/discrete.js Tue Jan 26 13:52:56 2016 +0000 @@ -275,12 +275,6 @@ var id = Number(event.currentTarget.value); //audioEngineContext.metric.sliderPlayed(id); audioEngineContext.play(id); - $(".track-slider").removeClass('track-slider-playing'); - $(event.currentTarget.parentElement).addClass('track-slider-playing'); - var outsideReference = document.getElementById('outside-reference'); - if (outsideReference != null) { - $(outsideReference).removeClass('track-slider-playing'); - } }; this.resize = function(event) { @@ -308,6 +302,23 @@ { // progress is a value from 0 to 100 indicating the current download state of media files }; + + this.startPlayback = function() + { + // Called by audioObject when playback begins + $(".track-slider").removeClass('track-slider-playing'); + $(this.holder).addClass('track-slider-playing'); + var outsideReference = document.getElementById('outside-reference'); + if (outsideReference != null) { + $(outsideReference).removeClass('track-slider-playing'); + } + } + this.stopPlayback = function() + { + // Called by audioObject when playback stops + $(this.holder).removeClass('track-slider-playing'); + } + this.getValue = function() { // Return the current value of the object. If there is no value, return -1