diff --git a/app/pods/components/music-tab/component.js b/app/pods/components/music-tab/component.js index 503a1f6..cabc1a9 100644 --- a/app/pods/components/music-tab/component.js +++ b/app/pods/components/music-tab/component.js @@ -233,6 +233,7 @@ export default Em.Component.extend(helperMixin, visualizerMixin, { dancer.play(); } + this.onColorloopModeChange(); this.toggleProperty('playing'); } }, @@ -581,13 +582,17 @@ export default Em.Component.extend(helperMixin, visualizerMixin, { console.log(mag + ',' + ratioKick); var activeLights = this.get('activeLights'), - transitionTime = 100, - onBeatBriAndColor = this.get('onBeatBriAndColor'), lightsData = this.get('lightsData'), color = null, beatInterval = 1, stimulateLight = (light, brightness, hue) => { - var options = {'bri': brightness, 'transitiontime': transitionTime}; + var options = {'bri': brightness}; + + if(this.get('blinkingTransitions')) { + options['transitiontime'] = 0; + } else { + options['transitiontime'] = 1; + } if(!Em.isNone(hue)) { options.hue = hue; @@ -621,12 +626,12 @@ export default Em.Component.extend(helperMixin, visualizerMixin, { light = activeLights[lightBopIndex]; this.set('lastLightBopIndex', lightBopIndex); - if(onBeatBriAndColor) { + if(!this.get('colorloopMode')) { color = Math.floor(Math.random() * 65535); } stimulateLight(light, 254, color); - setTimeout(stimulateLight, transitionTime + 50, light, 1); + setTimeout(stimulateLight, 100, light, 1); } this.set('paused', true); @@ -669,7 +674,7 @@ export default Em.Component.extend(helperMixin, visualizerMixin, { this.set('usingMicSupported', false); } - ['volume', 'shuffle', 'repeat', 'volumeMuted', 'threshold', 'playerBottomDisplayed', 'onBeatBriAndColor', 'audioMode', 'songBeatPreferences', 'firstVisit', 'currentVisName', 'playQueue', 'playQueuePointer', 'micBoost'].forEach((item)=>{ + ['volume', 'shuffle', 'repeat', 'volumeMuted', 'threshold', 'playerBottomDisplayed', 'audioMode', 'songBeatPreferences', 'firstVisit', 'currentVisName', 'playQueue', 'playQueuePointer', 'micBoost', 'blinkingTransitions'].forEach((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 f48af76..0c863cb 100644 --- a/app/pods/components/music-tab/mixins/helpers.js +++ b/app/pods/components/music-tab/mixins/helpers.js @@ -43,6 +43,7 @@ export default Em.Mixin.create({ threshold: 0.3, micBoost: 5, oldThreshold: null, + blinkingTransitions: false, playQueuePointer: -1, playQueue: Em.A(), @@ -131,15 +132,6 @@ export default Em.Mixin.create({ return this.get('playing'); }.property('playing'), - onBeatBriAndColor: true, - onBeatBriAndColorLabel: function() { - if(this.get('onBeatBriAndColor')){ - return 'Brightness & Color'; - } else { - return 'Brightness'; - } - }.property('onBeatBriAndColor'), - micIcon: function () { if (this.get('usingMicAudio')) { return 'mic'; @@ -228,10 +220,20 @@ export default Em.Mixin.create({ } }.property('volumeMuted', 'volume'), + onColorloopModeChange: function(){ + this.get('activeLights').forEach((light) => { + Em.$.ajax(this.get('apiURL') + '/lights/' + light + '/state', { + data: JSON.stringify({'effect': (this.get('playing') && this.get('colorloopMode')) ? 'colorloop' : 'none'}), + contentType: 'application/json', + type: 'PUT' + }); + }); + }.observes('colorloopMode'), + onOptionChange: function(self, option){ option = option.replace('.[]', ''); this.get('storage').set('huegasm.' + option, this.get(option)); - }.observes('onBeatBriAndColor', 'playQueue.[]', 'playQueuePointer'), + }.observes('blinkingTransitions', 'playQueue.[]', 'playQueuePointer', 'colorloopMode'), 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 68783cf..0549852 100644 --- a/app/pods/components/music-tab/template.hbs +++ b/app/pods/components/music-tab/template.hbs @@ -85,11 +85,7 @@ {{#if usingMicAudio}}