diff --git a/app/pods/components/hue-controls/component.js b/app/pods/components/hue-controls/component.js
index ed137c3..43f8e42 100644
--- a/app/pods/components/hue-controls/component.js
+++ b/app/pods/components/hue-controls/component.js
@@ -66,15 +66,6 @@ export default Em.Component.extend({
'TIP: Beat settings are saved per song as indicated by the red star icon in the top left corner. These settings they will be restored if you ever listen to the same song again.',
position: 'top'
},
- {
- element: '#beatOptionButtonGroup',
- intro: 'Some additional settings:
' +
- 'Default - Revert to the default beat detection settings
' +
- 'Random/Sequential - The transition order of lights on beat
' +
- 'Brightness/Brightness & Color - The properties of the lights to change on beat
' +
- 'TIP: Turn the colorloop \'on\' in the Lights tab and set only the brightness to change on beat for a cool visual effect.',
- position: 'top'
- },
{
element: '#beatContainer',
intro: 'An interactive speaker that will bump when a beat is registered. Switch over to the Debug View to see the intesity of all the registered and unregistered beats.
' +
diff --git a/app/pods/components/music-tab/component.js b/app/pods/components/music-tab/component.js
index 6c39f59..c8b407b 100644
--- a/app/pods/components/music-tab/component.js
+++ b/app/pods/components/music-tab/component.js
@@ -198,13 +198,6 @@ export default Em.Component.extend(helperMixin, visualizerMixin, {
this.send('goToSong', index, true, true);
}
},
- defaultControls(){
- var beatOptions = this.get('beatOptions');
-
- this.changePlayerControl('threshold', beatOptions.threshold.defaultValue);
- this.changePlayerControl('interval', beatOptions.interval.defaultValue);
- this.changePlayerControl('transitionTime', beatOptions.transitionTime.defaultValue);
- },
playerAreaPlay(){
if(Em.isEmpty(Em.$('#playerControls:hover')) && this.get('playQueuePointer') !== -1 ){
this.send('play');
@@ -260,8 +253,6 @@ export default Em.Component.extend(helperMixin, visualizerMixin, {
repeat = this.get('repeat'),
shuffle = this.get('shuffle');
- this.get('beatHistory').clear();
-
if(repeat === 2){ // repeating one song takes precedence over shuffling
if(playQueuePointer === -1 && playQueue.length > 0) {
nextSong = 0;
@@ -380,9 +371,6 @@ export default Em.Component.extend(helperMixin, visualizerMixin, {
this.get('storage').set('huegasm.micBoost', value);
this.get('dancer').setBoost(value);
},
- intervalChanged(value){
- this.changePlayerControl('interval', value, true);
- },
audioModeChanged(value){
if(value === 1) {
this.startUsingMic();
@@ -454,6 +442,11 @@ export default Em.Component.extend(helperMixin, visualizerMixin, {
changePlayerControl(name, value, saveBeatPrefs){
this.set(name, value);
+
+ if(name === 'threshold'){
+ this.get('kick').set({threshold: value});
+ }
+
if(saveBeatPrefs && this.get('usingLocalAudio') && this.get('playQueuePointer') !== -1){
this.saveSongBeatPreferences();
}
@@ -466,7 +459,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')};
+ songBeatPreferences[title] = {threshold: this.get('threshold')};
this.set('usingBeatPreferences', true);
this.get('storage').set('huegasm.songBeatPreferences', songBeatPreferences);
@@ -481,14 +474,12 @@ 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')};
+ newOldBeatPrefCache = {threshold: this.get('threshold')};
this.changePlayerControl('threshold', preference.threshold);
- this.changePlayerControl('interval', preference.interval);
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.set('usingBeatPreferences', false);
}
@@ -517,7 +508,7 @@ export default Em.Component.extend(helperMixin, visualizerMixin, {
dancer.load(stream, this.get('micBoost'), true);
this.set('usingBeatPreferences', false);
- // much more sensitive beath preference settings are needed for mic mode
+ // much more sensitive beat preference settings are needed for mic mode
this.setProperties({
oldThreshold: this.get('threshold'),
threshold: 0.1
@@ -589,97 +580,65 @@ export default Em.Component.extend(helperMixin, visualizerMixin, {
this.set('dragLeaveTimeoutHandle', setTimeout(function(){ self.set('dragging', false); }, 500));
},
- simulateKick(mag) {
- var validBeat = (this.get('threshold') < mag),
- beatInterval = this.get('interval');
+ simulateKick() {
+ var activeLights = this.get('activeLights'),
+ transitionTime = this.get('transitionTime') * 10,
+ onBeatBriAndColor = this.get('onBeatBriAndColor'),
+ lightsData = this.get('lightsData'),
+ color = null,
+ beatInterval = 1,
+ stimulateLight = (light, brightness, hue) => {
+ var options = {'bri': brightness, 'transitiontime': transitionTime};
- if(validBeat){
- var activeLights = this.get('activeLights'),
- transitionTime = this.get('transitionTime') * 10,
- onBeatBriAndColor = this.get('onBeatBriAndColor'),
- lightsData = this.get('lightsData'),
- color = null,
- stimulateLight = (light, brightness, hue) => {
- var options = {'bri': brightness, 'transitiontime': transitionTime};
+ if(!Em.isNone(hue)) {
+ options.hue = hue;
+ }
- if(!Em.isNone(hue)) {
- options.hue = hue;
- }
+ if(lightsData[light].state.on === false){
+ options.on = true;
+ }
- if(lightsData[light].state.on === false){
- options.on = true;
- }
+ Em.$.ajax(this.get('apiURL') + '/lights/' + light + '/state', {
+ data: JSON.stringify(options),
+ contentType: 'application/json',
+ type: 'PUT'
+ });
+ };
- Em.$.ajax(this.get('apiURL') + '/lights/' + light + '/state', {
- data: JSON.stringify(options),
- contentType: 'application/json',
- type: 'PUT'
- });
- };
+ if(activeLights.length > 0){
+ var lastLightBopIndex = this.get('lastLightBopIndex'),
+ lightBopIndex,
+ light;
- if(activeLights.length > 0){
- var lastLightBopIndex = this.get('lastLightBopIndex'),
- randomTransition = this.get('randomTransition'),
- lightBopIndex,
- light;
+ lightBopIndex = Math.floor(Math.random() * activeLights.length);
- if(randomTransition) {
+ // let's try not to select the same light twice in a row
+ if(activeLights.length > 1) {
+ while(lightBopIndex === lastLightBopIndex) {
lightBopIndex = Math.floor(Math.random() * activeLights.length);
-
- // let's try not to select the same light twice in a row
- if(activeLights.length > 1) {
- while(lightBopIndex === lastLightBopIndex) {
- lightBopIndex = Math.floor(Math.random() * activeLights.length);
- }
- }
- } else {
- lightBopIndex = (lastLightBopIndex + 1) % activeLights.length;
}
-
- light = activeLights[lightBopIndex];
- this.set('lastLightBopIndex', lightBopIndex);
-
- if(onBeatBriAndColor) {
- color = Math.floor(Math.random() * 65535);
- }
-
- stimulateLight(light, 254, color);
- setTimeout(stimulateLight, transitionTime + 50, light, 1);
}
+
+ light = activeLights[lightBopIndex];
+ this.set('lastLightBopIndex', lightBopIndex);
+
+ if(onBeatBriAndColor) {
+ color = Math.floor(Math.random() * 65535);
+ }
+
+ stimulateLight(light, 254, color);
+ setTimeout(stimulateLight, transitionTime + 50, light, 1);
}
- if(beatInterval > 0 && validBeat){
- this.set('paused', true);
- setTimeout(() => {
- this.set('paused', false);
- }, beatInterval * 1000);
- }
+ this.set('paused', true);
+ setTimeout(() => {
+ this.set('paused', false);
+ }, beatInterval * 100);
//work the music beat area
- if(this.get('speakerViewed')){
- if(validBeat){
- // simulate the speaker vibration by running a CSS animation on it
- Em.$('#beatSpeakerCenterOuter').removeClass('vibrateOuter').prop('offsetWidth', Em.$('#beatSpeakerCenterOuter').prop('offsetWidth')).addClass('vibrateOuter');
- Em.$('#beatSpeakerCenterInner').removeClass('vibrateInner').prop('offsetWidth', Em.$('#beatSpeakerCenterInner').prop('offsetWidth')).addClass('vibrateInner');
- }
- } else {
- var beatHistory = this.get('beatHistory'),
- debugFiltered = this.get('debugFiltered'),
- maxSize = this.get('maxBeatHistorySize'),
- html = 'Beat intesity of ' + mag.toFixed(3) + ' at ' + this.get('timeElapsedTxt') + '';
-
- if(!validBeat){
- if(!debugFiltered){
- return;
- }
- html = '' + html + ' ( filtered ) ';
- }
- beatHistory.unshiftObjects(html);
-
- if(beatHistory.length > maxSize){
- beatHistory.popObject();
- }
- }
+ // simulate the speaker vibration by running a CSS animation on it
+ Em.$('#beatSpeakerCenterOuter').removeClass('vibrateOuter').prop('offsetWidth', Em.$('#beatSpeakerCenterOuter').prop('offsetWidth')).addClass('vibrateOuter');
+ Em.$('#beatSpeakerCenterInner').removeClass('vibrateInner').prop('offsetWidth', Em.$('#beatSpeakerCenterInner').prop('offsetWidth')).addClass('vibrateInner');
},
init() {
@@ -690,13 +649,13 @@ export default Em.Component.extend(helperMixin, visualizerMixin, {
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
var dancer = new Dancer(),
- self = this,
storage = this.get('storage'),
kick = dancer.createKick({
- threshold: this.beatOptions.threshold.range.min,
- onKick: function (mag) {
- if (self.get('paused') === false) {
- self.simulateKick(mag);
+ frequency: [0,100],
+ threshold: this.get('threshold'),
+ onKick: (mag) => {
+ if (this.get('paused') === false) {
+ this.simulateKick(mag);
}
}
});
@@ -712,14 +671,14 @@ export default Em.Component.extend(helperMixin, visualizerMixin, {
this.set('usingMicSupported', false);
}
- ['volume', 'shuffle', 'repeat', 'volumeMuted', 'threshold', 'interval', 'speakerViewed', 'transitionTime', 'randomTransition', 'playerBottomDisplayed', 'onBeatBriAndColor', 'audioMode', 'songBeatPreferences', 'debugFiltered', 'firstVisit', 'currentVisName', 'playQueue', 'playQueuePointer', 'micBoost'].forEach(function (item) {
+ ['volume', 'shuffle', 'repeat', 'volumeMuted', 'threshold', 'transitionTime', 'playerBottomDisplayed', 'onBeatBriAndColor', 'audioMode', 'songBeatPreferences', 'firstVisit', 'currentVisName', 'playQueue', 'playQueuePointer', 'micBoost'].forEach((item)=>{
if (!Em.isNone(storage.get('huegasm.' + item))) {
var itemVal = storage.get('huegasm.' + item);
- if(Em.isNone(self.actions[item+'Changed'])){
- self.set(item, itemVal);
+ if(Em.isNone(this.actions[item+'Changed'])){
+ this.set(item, itemVal);
} else {
- self.send(item + 'Changed', itemVal);
+ this.send(item + 'Changed', itemVal);
}
}
});
diff --git a/app/pods/components/music-tab/mixins/helpers.js b/app/pods/components/music-tab/mixins/helpers.js
index a501e47..ee7babd 100644
--- a/app/pods/components/music-tab/mixins/helpers.js
+++ b/app/pods/components/music-tab/mixins/helpers.js
@@ -11,23 +11,9 @@ export default Em.Mixin.create({
beatOptions: {
threshold: {
- range: {min: 0.1, max: 1.0},
+ range: {min: 0, max: 1.0},
step: 0.01,
defaultValue: 0.3,
- pips: {
- mode: 'positions',
- values: [0,25,50,75,100],
- density: 3,
- format: {
- to: function ( value ) {return value;},
- from: function ( value ) { return value; }
- }
- }
- },
- interval: {
- range: {min: 0, max: 0.5},
- step: 0.01,
- defaultValue: 0.1,
pips: {
mode: 'positions',
values: [0,20,40,60,80,100],
@@ -70,14 +56,11 @@ export default Em.Mixin.create({
transitionTime: 0.1,
threshold: 0.3,
- interval: 0.1,
micBoost: 5,
oldThreshold: null,
playQueuePointer: -1,
playQueue: Em.A(),
- beatHistory: Em.A(),
- maxBeatHistorySize: 200,
timeElapsed: 0,
timeTotal: 0,
lastLightBopIndex: 0,
@@ -163,39 +146,6 @@ export default Em.Mixin.create({
return this.get('playing');
}.property('playing'),
- speakerViewed: true,
- debugFiltered: false,
- speakerLabel: function() {
- this.get('storage').set('huegasm.speakerViewed', this.get('speakerViewed'));
-
- if(this.get('speakerViewed')){
- this.get('beatHistory').clear();
- return 'Speaker View';
- } else {
- return 'Debug View';
- }
- }.property('speakerViewed'),
- debugFilteredText: function(){
- var debugFiltered = this.get('debugFiltered');
- this.get('storage').set('huegasm.debugFiltered', debugFiltered);
- Em.$('#beatHistory .filterBeat').css('display', debugFiltered === true ? 'inline' : 'none');
-
- if(debugFiltered){
- return 'View Filtered';
- } else {
- return 'Hide Filtered';
- }
- }.property('debugFiltered'),
-
- randomTransition: true,
- randomTransitionLabel: function() {
- if(this.get('randomTransition')){
- return 'Random';
- } else {
- return 'Sequential';
- }
- }.property('randomTransition'),
-
onBeatBriAndColor: true,
onBeatBriAndColorLabel: function() {
if(this.get('onBeatBriAndColor')){
@@ -296,7 +246,7 @@ export default Em.Mixin.create({
onOptionChange: function(self, option){
option = option.replace('.[]', '');
this.get('storage').set('huegasm.' + option, this.get(option));
- }.observes('randomTransition', 'onBeatBriAndColor', 'playQueue.[]', 'playQueuePointer'),
+ }.observes('onBeatBriAndColor', 'playQueue.[]', 'playQueuePointer'),
onRepeatChange: function () {
var tooltipTxt = 'Repeat all', type = 'repeat';
diff --git a/app/pods/components/music-tab/template.hbs b/app/pods/components/music-tab/template.hbs
index f565465..ee7a501 100644
--- a/app/pods/components/music-tab/template.hbs
+++ b/app/pods/components/music-tab/template.hbs
@@ -146,79 +146,50 @@
{{{item}}}
- {{/each}} -