adding new beat options
This commit is contained in:
parent
b4f2133cbd
commit
af9ce1d4dc
4 changed files with 43 additions and 21 deletions
|
|
@ -14,6 +14,8 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, {
|
||||||
}.observes('active'),
|
}.observes('active'),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
saveSongPreference: function() {
|
||||||
|
},
|
||||||
goToSong: function(index){
|
goToSong: function(index){
|
||||||
var dancer = this.get('dancer'), audio = new Audio();
|
var dancer = this.get('dancer'), audio = new Audio();
|
||||||
audio.src = this.get('playQueue')[index].url;
|
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('threshold', beatOptions.threshold.defaultValue, true);
|
||||||
this.changePlayerControl('decay', beatOptions.decay.defaultValue, true);
|
this.changePlayerControl('decay', beatOptions.decay.defaultValue, true);
|
||||||
this.changePlayerControl('frequency', beatOptions.frequency.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(){
|
playerAreaPlay: function(){
|
||||||
if(Em.isEmpty(Em.$('#playerControls:hover'))){
|
if(Em.isEmpty(Em.$('#playerControls:hover'))){
|
||||||
|
|
@ -158,6 +160,9 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, {
|
||||||
speakerViewedChanged: function(value){
|
speakerViewedChanged: function(value){
|
||||||
this.set('speakerViewed', value);
|
this.set('speakerViewed', value);
|
||||||
},
|
},
|
||||||
|
sequentialTransitionChanged: function(value){
|
||||||
|
this.set('sequentialTransition', value);
|
||||||
|
},
|
||||||
clickSpeaker: function(){
|
clickSpeaker: function(){
|
||||||
this.simulateKick(1);
|
this.simulateKick(1);
|
||||||
},
|
},
|
||||||
|
|
@ -251,33 +256,34 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, {
|
||||||
var activeLights = this.get('activeLights'),
|
var activeLights = this.get('activeLights'),
|
||||||
transitionTime = this.get('transitionTime') * 10,
|
transitionTime = this.get('transitionTime') * 10,
|
||||||
self = this,
|
self = this,
|
||||||
briOff = function (i) {
|
brightnessChange = function (light, brightness) {
|
||||||
Em.$.ajax(self.get('apiURL') + '/lights/' + i + '/state', {
|
Em.$.ajax(self.get('apiURL') + '/lights/' + light + '/state', {
|
||||||
data: JSON.stringify({'bri': 1, 'transitiontime': transitionTime}),
|
data: JSON.stringify({'bri': brightness, 'transitiontime': transitionTime}),
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
type: 'PUT'
|
type: 'PUT'
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if(activeLights.length > 0){
|
if(activeLights.length > 0){
|
||||||
var lastLightBopIndex = this.get('lastLightBopIndex'), light = this.get('activeLights')[lastLightBopIndex];
|
var lastLightBopIndex = this.get('lastLightBopIndex'),
|
||||||
Em.$.ajax(self.get('apiURL') + '/lights/' + light + '/state', {
|
sequentialTransition = this.get('sequentialTransition'),
|
||||||
data: JSON.stringify({'bri': 254, 'transitiontime': 0}),
|
light;
|
||||||
contentType: 'application/json',
|
|
||||||
type: 'PUT'
|
|
||||||
});
|
|
||||||
|
|
||||||
setTimeout(briOff, 50, light);
|
if(sequentialTransition) {
|
||||||
lastLightBopIndex = (lastLightBopIndex+1)%activeLights.length;
|
light = activeLights[lastLightBopIndex];
|
||||||
|
this.set('lastLightBopIndex', (lastLightBopIndex+1) % activeLights.length);
|
||||||
|
} else {
|
||||||
|
light = Math.floor(Math.random() * activeLights.length);
|
||||||
|
}
|
||||||
|
|
||||||
this.setProperties({
|
brightnessChange(light, 254);
|
||||||
paused: true,
|
setTimeout(brightnessChange, 50, light, 1);
|
||||||
lastLightBopIndex: lastLightBopIndex
|
|
||||||
});
|
this.set('paused', true);
|
||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
self.set('paused', false);
|
self.set('paused', false);
|
||||||
}, 150);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
//work the music beat area
|
//work the music beat area
|
||||||
|
|
@ -324,7 +330,7 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, {
|
||||||
kick: kick
|
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)) {
|
if (localStorage.getItem('huegasm.' + item)) {
|
||||||
var itemVal = localStorage.getItem('huegasm.' + item);
|
var itemVal = localStorage.getItem('huegasm.' + item);
|
||||||
if (item === 'repeat' || item === 'volume' || item === 'decay' || item === 'threshold') {
|
if (item === 'repeat' || item === 'volume' || item === 'decay' || item === 'threshold') {
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,15 @@ export default Em.Mixin.create({
|
||||||
}
|
}
|
||||||
}.property('speakerViewed'),
|
}.property('speakerViewed'),
|
||||||
|
|
||||||
|
sequentialTransition: true,
|
||||||
|
sequentialTransitionLabel: function() {
|
||||||
|
if(this.get('sequentialTransition')){
|
||||||
|
return 'Sequential';
|
||||||
|
} else {
|
||||||
|
return 'Random';
|
||||||
|
}
|
||||||
|
}.property('sequentialTransition'),
|
||||||
|
|
||||||
changePlayerControl: function(name, value, isOption){
|
changePlayerControl: function(name, value, isOption){
|
||||||
if(isOption){
|
if(isOption){
|
||||||
var options = {};
|
var options = {};
|
||||||
|
|
@ -193,6 +202,10 @@ export default Em.Mixin.create({
|
||||||
this.get('beatHistory').clear();
|
this.get('beatHistory').clear();
|
||||||
}.observes('speakerViewed'),
|
}.observes('speakerViewed'),
|
||||||
|
|
||||||
|
onSequentialTransitionChange: function(){
|
||||||
|
localStorage.setItem('huegasm.sequentialTransition', this.get('sequentialTransition'));
|
||||||
|
}.observes('sequentialTransition'),
|
||||||
|
|
||||||
onRepeatChange: function () {
|
onRepeatChange: function () {
|
||||||
var tooltipTxt = 'Repeat all', type = 'repeat';
|
var tooltipTxt = 'Repeat all', type = 'repeat';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,6 @@ md-switch[disabled=disabled], md-switch[disabled=disabled] .md-container, md-sli
|
||||||
}
|
}
|
||||||
|
|
||||||
.appSettingsItem.warn:hover {
|
.appSettingsItem.warn:hover {
|
||||||
text-transform: uppercase;
|
|
||||||
background: rgba(255, 0, 0, 0.70);
|
background: rgba(255, 0, 0, 0.70);
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
@ -725,6 +724,9 @@ md-switch.md-default-theme.md-checked .md-thumb {
|
||||||
|
|
||||||
#playerButtonGroup {
|
#playerButtonGroup {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
|
button {
|
||||||
|
box-shadow: 5px 0px 15px 5px rgba(0, 0, 0, 0.3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#vertDivider {
|
#vertDivider {
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="beatOption">
|
<div class="beatOption hidden">
|
||||||
<div class="text-center">{{decay}} sec</div>
|
<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}}
|
{{range-slider start=decay orientation="vertical" step=beatOptions.decay.step range=beatOptions.decay.range slide="decayChanged" pips=beatOptions.decay.pips}}
|
||||||
Decay Rate
|
Decay Rate
|
||||||
|
|
@ -97,12 +97,13 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="beatOption">
|
<div class="beatOption">
|
||||||
{{switch-button}}
|
Transition type: {{#paper-switch checked=sequentialTransition}} {{sequentialTransitionLabel}} {{/paper-switch}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="playerButtonGroup">
|
<div id="playerButtonGroup">
|
||||||
{{#paper-button raised=true warn=true action="defaultControls"}}Default{{/paper-button}}
|
{{#paper-button raised=true warn=true action="defaultControls"}}Default{{/paper-button}}
|
||||||
|
{{#paper-button raised=true action="saveSongPreference"}}Save Song Preference{{/paper-button}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
Reference in a new issue