a bit more work on saving beat preferences

This commit is contained in:
lone-cloud 2015-10-08 17:10:42 -07:00
parent 1cffaefba3
commit 4dd928564a
5 changed files with 44 additions and 19 deletions

View file

@ -317,13 +317,25 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, {
var song = this.get('playQueue')[this.get('playQueuePointer')],
title = Em.isEmpty(song.artist) ? song.filename : song.artist + '-' + song.title,
songBeatPreferences = this.get('songBeatPreferences'),
preference = songBeatPreferences[title];
preference = songBeatPreferences[title],
oldBeatPrefCache = this.get('oldBeatPrefCache'),
newOldBeatPrefCache = null;
if(!Em.isNone(preference)) { // load existing beat prefs
newOldBeatPrefCache = {threshold: this.get('threshold'), decay: this.get('decay'), frequency: this.get('frequency') };
if(!Em.isNone(preference)) {
this.changePlayerControl('threshold', preference.threshold, true, true);
this.changePlayerControl('decay', preference.decay, true, true);
this.changePlayerControl('frequency', preference.frequency, true, true);
this.set('usingBeatPreferences', true);
} else if(!Em.isNone(oldBeatPrefCache)) { // revert to using beat prefs before the remembered song
this.changePlayerControl('threshold', oldBeatPrefCache.threshold, true, true);
this.changePlayerControl('decay', oldBeatPrefCache.decay, true, true);
this.changePlayerControl('frequency', oldBeatPrefCache.frequency, true, true);
this.set('usingBeatPreferences', false);
}
this.set('oldBeatPrefCache', newOldBeatPrefCache);
},
startUsingMic() {

View file

@ -97,8 +97,8 @@ export default Em.Mixin.create({
playQueueEmpty: Em.computed.empty('playQueue'),
playQueueNotEmpty: Em.computed.notEmpty('playQueue'),
playQueueMultiple: function(){
return this.get('playQueue.length') > 1;
}.property('playQueue'),
return this.get('playQueue').length > 1;
}.property('playQueue.[]'),
seekPosition: function() {
var timeTotal = this.get('timeTotal'), timeElapsed = this.get('timeElapsed');
@ -121,6 +121,8 @@ export default Em.Mixin.create({
playing: false,
fadeOutNotification: false,
songBeatPreferences: {},
usingBeatPreferences: false,
oldBeatPrefCache: null,
storage: null,
speakerViewed: true,

View file

@ -76,7 +76,7 @@
{{else}}
{{item.filename}}
{{/if}}
<div data-toggle="tooltip" data-placement="bottom auto" data-title="Remove from playlist" class="audioRemoveButton cursorPointer bootstrapTooltip" {{action "removeAudio" index bubbles=false}}>{{paper-icon icon="close"}}
<div data-toggle="tooltip" data-placement="bottom auto" data-title="Remove from playlist" container="body" class="audioRemoveButton cursorPointer bootstrapTooltip" {{action "removeAudio" index bubbles=false}}>{{paper-icon icon="close"}}
</div>
</div>
{{/each}}
@ -94,6 +94,12 @@
<div id="playerBottom" class="row antiDimmer {{if dimmerOn "dimmerFriendly"}}">
<div id="beatArea" class="col-sm-7 col-xs-12">
{{#if usingBeatPreferences}}
<div data-toggle="tooltip" data-placement="bottom auto" data-title="Using your saved beat preferences from the last time you listened to this song" container="body" class="bootstrapTooltip">
{{paper-icon id="saveBeatPreferencesStar" icon="star"}}
</div>
{{/if}}
<div class="row">
<div class="beatOption col-xs-3">
<div class="text-center">{{threshold}}</div>

View file

@ -3,13 +3,13 @@
@import 'ember-modal-dialog/ember-modal-structure';
@import 'ember-modal-dialog/ember-modal-appearance';
$playerBackColor: #F12B24;
$playerHeight: 400px;
$playerDefaultIconColor: #BBBBBB;
$footerHeight: 40px;
$playerBottomHeight: 340px;
$secondaryThemeColor: #F12B24;
// BRIDGE FINDER
// BRIDGE FINDER
html {
min-height: 100%;
height: auto;
@ -67,7 +67,7 @@ md-switch[disabled=disabled], md-switch[disabled=disabled] .md-container, md-sli
.settingsItem.on md-icon.md-default-theme.group,
.settingsItem.on md-icon.md-default-theme.settings {
color: #F12B24 !important;
color: $secondaryThemeColor !important;
}
.settingsItem:hover md-icon.group,
@ -222,8 +222,8 @@ md-slider {
}
md-slider.md-default-theme .md-thumb:after {
border-color: #F12B24;
background-color: #F12B24;
border-color: $secondaryThemeColor;
background-color: $secondaryThemeColor;
}
.paper-sidenav {
@ -420,7 +420,7 @@ md-switch.md-default-theme.md-checked .md-bar {
}
md-switch.md-default-theme.md-checked .md-thumb {
background-color: #F12B24;
background-color: $secondaryThemeColor;
}
#playerControls {
@ -464,7 +464,7 @@ md-switch.md-default-theme.md-checked .md-thumb {
}
.playerControllIcon.active {
color: #F12B24 !important;
color: $secondaryThemeColor !important;
}
.playerControllIcon:hover {
@ -521,7 +521,7 @@ md-switch.md-default-theme.md-checked .md-thumb {
}
#playerArea * .noUi-base {
background-color: $playerBackColor;
background-color: $secondaryThemeColor;
border-radius: 5px;
}
@ -530,7 +530,7 @@ md-switch.md-default-theme.md-checked .md-thumb {
}
.noUi-connect {
background-color: $playerBackColor;
background-color: $secondaryThemeColor;
}
#volumeBar {
@ -584,7 +584,7 @@ md-switch.md-default-theme.md-checked .md-thumb {
left: -6px;
opacity: 0;
transition-duration: 0.1s;
background-color: $playerBackColor !important;
background-color: $secondaryThemeColor !important;
box-shadow: none;
}
@ -960,5 +960,10 @@ $vibrateblurouter: 2px;
background: grey;
}
#saveBeatPreferencesStar {
position: absolute;
top: 2px;
left: 3px;
color: #F12B24 !important;
font-size: 30px;
}

View file

@ -2,7 +2,7 @@
"name": "huegasm",
"dependencies": {
"bootstrap-sass": "~3.3.5",
"ember": "~2.0.2",
"ember": "~2.1.0",
"ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3",
"ember-cli-test-loader": "ember-cli-test-loader#0.1.3",
"ember-data": "~2.1.0",
@ -22,7 +22,7 @@
"three.js": "~0.72.0"
},
"resolutions": {
"ember": "~2.0.2",
"ember": "~2.1.0",
"jquery": "~2.1.4"
}
}