Skip to content

Commit

Permalink
fix: Clear protocolDelay timer when aborting old fade
Browse files Browse the repository at this point in the history
  • Loading branch information
olzzon committed Aug 20, 2019
1 parent a8a19f4 commit 7801638
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/utils/MixerConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export class MixerGenericConnection {
mixerProtocol: IMixerProtocolGeneric;
mixerConnection: any;
timer: any;
fadeActiveTimer: any;

constructor() {
this.updateOutLevels = this.updateOutLevels.bind(this);
Expand Down Expand Up @@ -45,6 +46,7 @@ export class MixerGenericConnection {

//Setup timers for fade in & out
this.timer = new Array(this.store.channels[0].channel.length);
this.fadeActiveTimer = new Array(this.store.channels[0].channel.length);
}

updateOutLevels() {
Expand Down Expand Up @@ -79,19 +81,21 @@ export class MixerGenericConnection {
}

delayedFadeActiveDisable (channelIndex: number) {
let delayedTimer = setTimeout( ()=>{
this.fadeActiveTimer[channelIndex] = setTimeout( ()=>{
window.storeRedux.dispatch({
type:'FADE_ACTIVE',
channel: channelIndex,
active: false
})
},
this.store.settings[0].protocolLatency)
this.store.settings[0].protocolLatency
)
}

fadeInOut (channelIndex: number, fadeTime: number){
//Clear Old timer or set Fade to active:
if (this.store.channels[0].channel[channelIndex].fadeActive) {
clearInterval(this.fadeActiveTimer[channelIndex]);
clearInterval(this.timer[channelIndex]);
} else {
window.storeRedux.dispatch({
Expand Down

0 comments on commit 7801638

Please sign in to comment.