removing frequency control
This commit is contained in:
parent
7632cd2a02
commit
2c866db997
5 changed files with 8 additions and 155 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -152,28 +152,19 @@
|
|||
{{/if}}
|
||||
|
||||
<div class="row" id="beatOptionRow">
|
||||
<div class="beatOption col-xs-3">
|
||||
<div class="beatOption col-xs-4">
|
||||
<span data-toggle="tooltip" data-placement="bottom auto" data-title="The minimum sound intensity for the beat to register" class="optionDescription bootstrapTooltip">Beat Threshold</span>
|
||||
{{range-slider start=threshold orientation="vertical" step=beatOptions.threshold.step range=beatOptions.threshold.range slide="thresholdChanged" pips=beatOptions.threshold.pips}}
|
||||
<div class="text-center">{{threshold}}</div>
|
||||
</div>
|
||||
|
||||
<div class="beatOption col-xs-3">
|
||||
<div class="beatOption col-xs-4">
|
||||
<span data-toggle="tooltip" data-placement="bottom auto" data-title="The minimum amount of time between each registered beat" class="optionDescription bootstrapTooltip">Beat Interval</span>
|
||||
{{range-slider start=interval orientation="vertical" step=beatOptions.interval.step range=beatOptions.interval.range slide="intervalChanged" pips=beatOptions.interval.pips}}
|
||||
<div class="text-center">{{interval}} sec</div>
|
||||
</div>
|
||||
|
||||
<div class="beatOption col-xs-3">
|
||||
<span data-toggle="tooltip" data-placement="bottom auto" data-title="The frequency range of the sound to listen on for the beat" class="optionDescription bootstrapTooltip">Frequency Range</span>
|
||||
{{range-slider start=frequency orientation="vertical" step=beatOptions.frequency.step range=beatOptions.frequency.range connect=true slide="frequencyChanged" pips=beatOptions.frequency.pips}}
|
||||
<div class="text-center">[{{#each frequency as |item index|}}{{item}}{{#unless index}}
|
||||
,{{/unless}}{{/each}}
|
||||
]
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="beatOption col-xs-3">
|
||||
<div class="beatOption col-xs-4">
|
||||
<span data-toggle="tooltip" data-placement="bottom auto" data-title="The time it takes for a light to change color or brightness" class="optionDescription bootstrapTooltip">Transition Time</span>
|
||||
{{range-slider start=transitionTime orientation="vertical" step=beatOptions.transitionTime.step range=beatOptions.transitionTime.range slide="transitionTimeChanged" pips=beatOptions.transitionTime.pips}}
|
||||
<div class="text-center">{{transitionTime}} sec</div>
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
102
vendor/dancer.js
vendored
102
vendor/dancer.js
vendored
|
|
@ -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,
|
||||
|
|
|
|||
Reference in a new issue