adding new beat options

This commit is contained in:
lone-cloud 2015-09-29 16:16:13 -07:00
parent 1890236bc6
commit 1874c79cbe
4 changed files with 43 additions and 21 deletions

View file

@ -14,6 +14,8 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, {
}.observes('active'),
actions: {
saveSongPreference: function() {
},
goToSong: function(index){
var dancer = this.get('dancer'), audio = new Audio();
audio.src = this.get('playQueue')[index].url;
@ -43,7 +45,7 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, {
this.changePlayerControl('threshold', beatOptions.threshold.defaultValue, true);
this.changePlayerControl('decay', beatOptions.decay.defaultValue, true);
this.changePlayerControl('frequency', beatOptions.frequency.defaultValue, true);
this.changePlayerControl('transitionTime', beatOptions.frequency.defaultValue, true);
this.changePlayerControl('transitionTime', beatOptions.transitionTime.defaultValue, true);
},
playerAreaPlay: function(){
if(Em.isEmpty(Em.$('#playerControls:hover'))){
@ -158,6 +160,9 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, {
speakerViewedChanged: function(value){
this.set('speakerViewed', value);
},
sequentialTransitionChanged: function(value){
this.set('sequentialTransition', value);
},
clickSpeaker: function(){
this.simulateKick(1);
},
@ -251,33 +256,34 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, {
var activeLights = this.get('activeLights'),
transitionTime = this.get('transitionTime') * 10,
self = this,
briOff = function (i) {
Em.$.ajax(self.get('apiURL') + '/lights/' + i + '/state', {
data: JSON.stringify({'bri': 1, 'transitiontime': transitionTime}),
brightnessChange = function (light, brightness) {
Em.$.ajax(self.get('apiURL') + '/lights/' + light + '/state', {
data: JSON.stringify({'bri': brightness, 'transitiontime': transitionTime}),
contentType: 'application/json',
type: 'PUT'
});
};
if(activeLights.length > 0){
var lastLightBopIndex = this.get('lastLightBopIndex'), light = this.get('activeLights')[lastLightBopIndex];
Em.$.ajax(self.get('apiURL') + '/lights/' + light + '/state', {
data: JSON.stringify({'bri': 254, 'transitiontime': 0}),
contentType: 'application/json',
type: 'PUT'
});
var lastLightBopIndex = this.get('lastLightBopIndex'),
sequentialTransition = this.get('sequentialTransition'),
light;
setTimeout(briOff, 50, light);
lastLightBopIndex = (lastLightBopIndex+1)%activeLights.length;
if(sequentialTransition) {
light = activeLights[lastLightBopIndex];
this.set('lastLightBopIndex', (lastLightBopIndex+1) % activeLights.length);
} else {
light = Math.floor(Math.random() * activeLights.length);
}
this.setProperties({
paused: true,
lastLightBopIndex: lastLightBopIndex
});
brightnessChange(light, 254);
setTimeout(brightnessChange, 50, light, 1);
this.set('paused', true);
setTimeout(function () {
self.set('paused', false);
}, 150);
}, 100);
}
//work the music beat area
@ -324,7 +330,7 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, {
kick: kick
});
['volume', 'shuffle', 'repeat', 'volumeMuted', 'threshold', 'decay', 'frequency', 'speakerViewed'].forEach(function (item) {
['volume', 'shuffle', 'repeat', 'volumeMuted', 'threshold', 'decay', 'frequency', 'speakerViewed', 'sequentialTransition'].forEach(function (item) {
if (localStorage.getItem('huegasm.' + item)) {
var itemVal = localStorage.getItem('huegasm.' + item);
if (item === 'repeat' || item === 'volume' || item === 'decay' || item === 'threshold') {

View file

@ -117,6 +117,15 @@ export default Em.Mixin.create({
}
}.property('speakerViewed'),
sequentialTransition: true,
sequentialTransitionLabel: function() {
if(this.get('sequentialTransition')){
return 'Sequential';
} else {
return 'Random';
}
}.property('sequentialTransition'),
changePlayerControl: function(name, value, isOption){
if(isOption){
var options = {};
@ -193,6 +202,10 @@ export default Em.Mixin.create({
this.get('beatHistory').clear();
}.observes('speakerViewed'),
onSequentialTransitionChange: function(){
localStorage.setItem('huegasm.sequentialTransition', this.get('sequentialTransition'));
}.observes('sequentialTransition'),
onRepeatChange: function () {
var tooltipTxt = 'Repeat all', type = 'repeat';

View file

@ -55,7 +55,6 @@ md-switch[disabled=disabled], md-switch[disabled=disabled] .md-container, md-sli
}
.appSettingsItem.warn:hover {
text-transform: uppercase;
background: rgba(255, 0, 0, 0.70);
color: white;
}
@ -725,6 +724,9 @@ md-switch.md-default-theme.md-checked .md-thumb {
#playerButtonGroup {
margin-top: 10px;
button {
box-shadow: 5px 0px 15px 5px rgba(0, 0, 0, 0.3);
}
}
#vertDivider {

View file

@ -79,7 +79,7 @@
</div>
<div class="beatOption">
<div class="beatOption hidden">
<div class="text-center">{{decay}} sec</div>
{{range-slider start=decay orientation="vertical" step=beatOptions.decay.step range=beatOptions.decay.range slide="decayChanged" pips=beatOptions.decay.pips}}
Decay Rate
@ -97,12 +97,13 @@
</div>
<div class="beatOption">
{{switch-button}}
Transition type: {{#paper-switch checked=sequentialTransition}} {{sequentialTransitionLabel}} {{/paper-switch}}
</div>
</div>
<div id="playerButtonGroup">
{{#paper-button raised=true warn=true action="defaultControls"}}Default{{/paper-button}}
{{#paper-button raised=true action="saveSongPreference"}}Save Song Preference{{/paper-button}}
</div>
</div>