From cf58c5df36a9b94cb8943b3b3b852bace90c183d Mon Sep 17 00:00:00 2001 From: Egor Date: Sun, 1 Nov 2015 22:04:02 -0800 Subject: [PATCH] removing frequency control --- app/pods/components/music-tab/component.js | 25 +---- .../components/music-tab/mixins/helpers.js | 16 --- app/pods/components/music-tab/template.hbs | 15 +-- app/styles/app.scss | 5 +- vendor/dancer.js | 102 ------------------ 5 files changed, 8 insertions(+), 155 deletions(-) diff --git a/app/pods/components/music-tab/component.js b/app/pods/components/music-tab/component.js index 0c7736e..6c39f59 100644 --- a/app/pods/components/music-tab/component.js +++ b/app/pods/components/music-tab/component.js @@ -111,7 +111,6 @@ export default Em.Component.extend(helperMixin, visualizerMixin, { // restore the old beat preferences ( before the user went into mic mode ) if(!Em.isNone(this.get('oldThreshold'))){ this.set('threshold', this.get('oldThreshold')); - this.set('frequency', this.get('oldFrequency')); } document.title = 'Huegasm'; @@ -204,7 +203,6 @@ export default Em.Component.extend(helperMixin, visualizerMixin, { this.changePlayerControl('threshold', beatOptions.threshold.defaultValue); this.changePlayerControl('interval', beatOptions.interval.defaultValue); - this.changePlayerControl('frequency', beatOptions.frequency.defaultValue); this.changePlayerControl('transitionTime', beatOptions.transitionTime.defaultValue); }, playerAreaPlay(){ @@ -385,9 +383,6 @@ export default Em.Component.extend(helperMixin, visualizerMixin, { intervalChanged(value){ this.changePlayerControl('interval', value, true); }, - frequencyChanged(value){ - this.changePlayerControl('frequency', value, true); - }, audioModeChanged(value){ if(value === 1) { this.startUsingMic(); @@ -463,12 +458,6 @@ export default Em.Component.extend(helperMixin, visualizerMixin, { this.saveSongBeatPreferences(); } - if(name === 'frequency'){ - var options = {}; - options[name] = value; - this.get('kick').set(options); - } - this.get('storage').set('huegasm.' + name, value); }, @@ -477,7 +466,7 @@ export default Em.Component.extend(helperMixin, visualizerMixin, { title = Em.isEmpty(song.artist) ? song.fileName : song.artist + '-' + song.title, songBeatPreferences = this.get('songBeatPreferences'); - songBeatPreferences[title] = {threshold: this.get('threshold'), interval: this.get('interval'), frequency: this.get('frequency')}; + songBeatPreferences[title] = {threshold: this.get('threshold'), interval: this.get('interval')}; this.set('usingBeatPreferences', true); this.get('storage').set('huegasm.songBeatPreferences', songBeatPreferences); @@ -492,16 +481,14 @@ export default Em.Component.extend(helperMixin, visualizerMixin, { newOldBeatPrefCache = null; if(!Em.isNone(preference)) { // load existing beat prefs - newOldBeatPrefCache = {threshold: this.get('threshold'), interval: this.get('interval'), frequency: this.get('frequency') }; + newOldBeatPrefCache = {threshold: this.get('threshold'), interval: this.get('interval')}; this.changePlayerControl('threshold', preference.threshold); this.changePlayerControl('interval', preference.interval); - this.changePlayerControl('frequency', preference.frequency); this.set('usingBeatPreferences', true); } else if(!Em.isNone(oldBeatPrefCache)) { // revert to using beat prefs before the remembered song this.changePlayerControl('threshold', oldBeatPrefCache.threshold); this.changePlayerControl('interval', oldBeatPrefCache.interval); - this.changePlayerControl('frequency', oldBeatPrefCache.frequency); this.set('usingBeatPreferences', false); } @@ -532,10 +519,8 @@ export default Em.Component.extend(helperMixin, visualizerMixin, { // much more sensitive beath preference settings are needed for mic mode this.setProperties({ - oldFrequency: this.get('frequency'), oldThreshold: this.get('threshold'), - threshold: 0.1, - frequency: [0,10] + threshold: 0.1 }); dancer.setVolume(0); @@ -707,10 +692,8 @@ export default Em.Component.extend(helperMixin, visualizerMixin, { var dancer = new Dancer(), self = this, storage = this.get('storage'), - frequency = this.get('frequency'), kick = dancer.createKick({ threshold: this.beatOptions.threshold.range.min, - frequency: frequency, onKick: function (mag) { if (self.get('paused') === false) { self.simulateKick(mag); @@ -729,7 +712,7 @@ export default Em.Component.extend(helperMixin, visualizerMixin, { this.set('usingMicSupported', false); } - ['volume', 'shuffle', 'repeat', 'volumeMuted', 'threshold', 'interval', 'frequency', 'speakerViewed', 'transitionTime', 'randomTransition', 'playerBottomDisplayed', 'onBeatBriAndColor', 'audioMode', 'songBeatPreferences', 'debugFiltered', 'firstVisit', 'currentVisName', 'playQueue', 'playQueuePointer', 'micBoost'].forEach(function (item) { + ['volume', 'shuffle', 'repeat', 'volumeMuted', 'threshold', 'interval', 'speakerViewed', 'transitionTime', 'randomTransition', 'playerBottomDisplayed', 'onBeatBriAndColor', 'audioMode', 'songBeatPreferences', 'debugFiltered', 'firstVisit', 'currentVisName', 'playQueue', 'playQueuePointer', 'micBoost'].forEach(function (item) { if (!Em.isNone(storage.get('huegasm.' + item))) { var itemVal = storage.get('huegasm.' + item); diff --git a/app/pods/components/music-tab/mixins/helpers.js b/app/pods/components/music-tab/mixins/helpers.js index 09a2825..a501e47 100644 --- a/app/pods/components/music-tab/mixins/helpers.js +++ b/app/pods/components/music-tab/mixins/helpers.js @@ -38,20 +38,6 @@ export default Em.Mixin.create({ } } }, - frequency: { - range: {min: 0, max: 10}, - step: 1, - defaultValue: [0,4], - pips: { - mode: 'values', - values: [0,2,4,6,8,10], - density: 10, - format: { - to: function ( value ) {return value;}, - from: function ( value ) { return value; } - } - } - }, transitionTime: { range: {min: 0, max: 0.5}, step: 0.1, @@ -85,10 +71,8 @@ export default Em.Mixin.create({ transitionTime: 0.1, threshold: 0.3, interval: 0.1, - frequency: [0,4], micBoost: 5, oldThreshold: null, - oldFrequency: null, playQueuePointer: -1, playQueue: Em.A(), diff --git a/app/pods/components/music-tab/template.hbs b/app/pods/components/music-tab/template.hbs index 0ed9922..f565465 100644 --- a/app/pods/components/music-tab/template.hbs +++ b/app/pods/components/music-tab/template.hbs @@ -152,28 +152,19 @@ {{/if}}
-
+
Beat Threshold {{range-slider start=threshold orientation="vertical" step=beatOptions.threshold.step range=beatOptions.threshold.range slide="thresholdChanged" pips=beatOptions.threshold.pips}}
{{threshold}}
-
+
Beat Interval {{range-slider start=interval orientation="vertical" step=beatOptions.interval.step range=beatOptions.interval.range slide="intervalChanged" pips=beatOptions.interval.pips}}
{{interval}} sec
-
-Frequency Range -{{range-slider start=frequency orientation="vertical" step=beatOptions.frequency.step range=beatOptions.frequency.range connect=true slide="frequencyChanged" pips=beatOptions.frequency.pips}} -
[{{#each frequency as |item index|}}{{item}}{{#unless index}} -,{{/unless}}{{/each}} -] -
-
- -
+
Transition Time {{range-slider start=transitionTime orientation="vertical" step=beatOptions.transitionTime.step range=beatOptions.transitionTime.range slide="transitionTimeChanged" pips=beatOptions.transitionTime.pips}}
{{transitionTime}} sec
diff --git a/app/styles/app.scss b/app/styles/app.scss index ba392a8..32079fc 100644 --- a/app/styles/app.scss +++ b/app/styles/app.scss @@ -636,9 +636,6 @@ md-switch.md-default-theme.md-checked .md-thumb { // mobile overrides @media(max-width:767px) { - .noUi-pips-vertical { - display: none; - } #seekSlider { height: 8px; .noUi-handle { @@ -804,7 +801,7 @@ md-switch.md-default-theme.md-checked .md-thumb { } .savedStarTooltip + .tooltip .tooltip-arrow { - margin-left: 8px; + margin-left: 12px; } #beatOptionButtonGroup { diff --git a/vendor/dancer.js b/vendor/dancer.js index ad78488..2e13945 100644 --- a/vendor/dancer.js +++ b/vendor/dancer.js @@ -227,8 +227,6 @@ return null; } else if ( !isUnsupportedSafari() && ( window.AudioContext || window.webkitAudioContext )) { return 'webaudio'; - } else if ( audioEl && audioEl.mozSetup ) { - return 'audiodata'; } else if ( FlashDetect.versionAtLeast( 9 ) ) { return 'flash'; } else { @@ -266,8 +264,6 @@ switch ( Dancer.isSupported() ) { case 'webaudio': return new Dancer.adapters.webaudio( instance ); - case 'audiodata': - return new Dancer.adapters.moz( instance ); case 'flash': return new Dancer.adapters.flash( instance ); default: @@ -523,104 +519,6 @@ })(); -(function() { - - var adapter = function ( dancer ) { - this.dancer = dancer; - this.audio = new Audio(); - }; - - adapter.prototype = { - - load : function ( _source ) { - var _this = this; - this.audio = _source; - - this.isLoaded = false; - this.progress = 0; - - if ( this.audio.readyState < 3 ) { - this.audio.addEventListener( 'loadedmetadata', function () { - getMetadata.call( _this ); - }, false); - } else { - getMetadata.call( _this ); - } - - this.audio.addEventListener( 'MozAudioAvailable', function ( e ) { - _this.update( e ); - }, false); - - this.audio.addEventListener( 'progress', function ( e ) { - if ( e.currentTarget.duration && e.currentTarget.duration !== Infinity) { - _this.progress = e.currentTarget.seekable.end( 0 ) / e.currentTarget.duration; - } - }, false); - - return this.audio; - }, - - play : function () { - this.audio.play(); - this.isPlaying = true; - }, - - pause : function () { - this.audio.pause(); - this.isPlaying = false; - }, - - setVolume : function ( volume ) { - this.audio.volume = volume; - }, - - getVolume : function () { - return this.audio.volume; - }, - - getProgress : function () { - return this.progress; - }, - - getWaveform : function () { - return this.signal; - }, - - getSpectrum : function () { - return this.fft.spectrum; - }, - - getTime : function () { - return this.audio.currentTime; - }, - - update : function ( e ) { - if ( !this.isPlaying || !this.isLoaded ) return; - - for ( var i = 0, j = this.fbLength / 2; i < j; i++ ) { - this.signal[ i ] = ( e.frameBuffer[ 2 * i ] + e.frameBuffer[ 2 * i + 1 ] ) / 2; - } - - this.fft.forward( this.signal ); - this.dancer.trigger( 'update' ); - } - }; - - function getMetadata () { - this.fbLength = this.audio.mozFrameBufferLength; - this.channels = this.audio.mozChannels; - this.rate = this.audio.mozSampleRate; - this.fft = new FFT( this.fbLength / this.channels, this.rate ); - this.signal = new Float32Array( this.fbLength / this.channels ); - this.isLoaded = true; - this.progress = 1; - this.dancer.trigger( 'loaded' ); - } - - Dancer.adapters.moz = adapter; - -})(); - (function() { var SAMPLE_SIZE = 1024,