Skip to content

Commit

Permalink
Merge pull request #271 from bbc/feat/fadeTimeWithFaderLevel
Browse files Browse the repository at this point in the history
Allow fade times to be set with each level change
  • Loading branch information
KvelaGorrrrnio committed Aug 18, 2023
2 parents eec793f + e69b7b1 commit 2c5f755
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ To set the state send these OSC commands from you Automation to ProducersAudioMi

#### Set channel faderlevel:

/ch/1/mix/faderlevel - float {between 0 and 1}
(the first defines the fader level)
(if second is missing it will take default fade value)
/ch/1/mix/faderlevel - float {between 0 and 1} - float { fadetime in ms }

#### Set channel label:

Expand Down
9 changes: 8 additions & 1 deletion server/src/utils/AutomationConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,14 @@ export class AutomationConnection {
} else if (check('CHANNEL_FADER_LEVEL')) {
wrapChannelCommand((ch: any) => {
store.dispatch(storeFaderLevel(ch - 1, message.args[0]))
mixerGenericConnection.updateOutLevel(ch - 1, -1)
if (message.args.length > 1) {
mixerGenericConnection.updateOutLevel(
ch - 1,
parseFloat(message.args[1])
)
} else {
mixerGenericConnection.updateOutLevel(ch - 1, -1)
}
global.mainThreadHandler.updatePartialStore(ch - 1)
})
} else if (check('INJECT_COMMAND')) {
Expand Down
2 changes: 1 addition & 1 deletion server/src/utils/MixerConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ export class MixerGenericConnection {
const currentTimeMS = Date.now()
const elapsedTimeMS = currentTimeMS - startTimeAsMs

if (elapsedTimeMS >= fadeTime) {
if (elapsedTimeMS >= fadeTime || endLevel === startLevel) {
this.mixerConnection[mixerIndex].updateFadeIOLevel(
channelIndex,
endLevel
Expand Down

0 comments on commit 2c5f755

Please sign in to comment.