Skip to content

Commit

Permalink
Fix: When running as "master" volume did not lower when pgm on.
Browse files Browse the repository at this point in the history
  • Loading branch information
olzzon committed Apr 14, 2019
1 parent 3d54dda commit 069b4b0
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/utils/MixerConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,40 +36,44 @@ export class MixerConnection {

fadeInOut (channelIndex){
if (this.store.channels[0].channel[channelIndex].pgmOn) {
let val = parseFloat(this.store.channels[0].channel[channelIndex].outputLevel);

let outputLevel = parseFloat(this.store.channels[0].channel[channelIndex].outputLevel);
let targetVal = this.mixerProtocol.fader.zero;
if (this.mixerProtocol.mode === "master") {
targetVal = parseFloat(this.store.channels[0].channel[channelIndex].faderLevel);
}

let fadeDirection = 1;
if (targetVal<outputLevel) {
fadeDirection = -1;
}

let timer = setInterval(() => {
val = val + 3*this.mixerProtocol.fader.step;
if ( val >= targetVal){
val = targetVal;
outputLevel = outputLevel + fadeDirection*3*this.mixerProtocol.fader.step;
if ( outputLevel >= targetVal){
outputLevel = targetVal;
clearInterval(timer);
return true;
}
window.storeRedux.dispatch({
type:'SET_OUTPUT_LEVEL',
channel: channelIndex,
level: val
level: outputLevel
});
this.mixerConnection.updateOutLevel(channelIndex);
}, 1);
} else {
let val = this.store.channels[0].channel[channelIndex].outputLevel;
let outputLevel = this.store.channels[0].channel[channelIndex].outputLevel;
let timer = setInterval(() => {
val = val - 3*this.mixerProtocol.fader.step;
if ( val <= this.mixerProtocol.fader.min){
val = this.mixerProtocol.fader.min;
outputLevel = outputLevel - 3*this.mixerProtocol.fader.step;
if ( outputLevel <= this.mixerProtocol.fader.min){
outputLevel = this.mixerProtocol.fader.min;
clearInterval(timer);
return true;
}
window.storeRedux.dispatch({
type:'SET_OUTPUT_LEVEL',
channel: channelIndex,
level: val
level: outputLevel
});
this.mixerConnection.updateOutLevel(channelIndex);
}, 1);
Expand Down

0 comments on commit 069b4b0

Please sign in to comment.