-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: fairlight talkback mute and solo
- Loading branch information
Showing
5 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/commands/Fairlight/FairlightMixerMonitorSoloCommand.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { FairlightAudioMonitorSolo } from '../../state/fairlight' | ||
import { AtemState, InvalidIdError } from '../../state' | ||
import { DeserializedCommand, WritableCommand } from '../CommandBase' | ||
import { OmitReadonly } from '../../lib/types' | ||
|
||
export class FairlightMixerMonitorSoloCommand extends WritableCommand<OmitReadonly<FairlightAudioMonitorSolo>> { | ||
public static MaskFlags = { | ||
solo: 1 << 0, | ||
index: 1 << 1, | ||
source: 1 << 1, // Intentional duplicate | ||
} | ||
|
||
public static readonly rawName = 'CFMS' | ||
|
||
public serialize(): Buffer { | ||
const buffer = Buffer.alloc(24) | ||
buffer.writeUInt8(this.flag, 0) | ||
|
||
buffer.writeUInt8(this.properties.solo ? 1 : 0, 1) | ||
buffer.writeUInt16BE(this.properties.index ?? 0, 8) | ||
if (this.properties.source) buffer.writeBigInt64BE(BigInt(this.properties.source), 16) | ||
return buffer | ||
} | ||
} | ||
|
||
export class FairlightMixerMonitorSoloUpdateCommand extends DeserializedCommand<FairlightAudioMonitorSolo> { | ||
public static readonly rawName = 'FAMS' | ||
|
||
public static deserialize(rawCommand: Buffer): FairlightMixerMonitorSoloUpdateCommand { | ||
const properties: FairlightAudioMonitorSolo = { | ||
solo: rawCommand.readUint8(0) === 1, | ||
index: rawCommand.readUInt16BE(8), | ||
source: rawCommand.readBigInt64BE(16).toString(), | ||
} | ||
|
||
return new FairlightMixerMonitorSoloUpdateCommand(properties) | ||
} | ||
|
||
public applyToState(state: AtemState): string { | ||
if (!state.fairlight) { | ||
throw new InvalidIdError('Fairlight') | ||
} | ||
|
||
state.fairlight.solo = { ...this.properties } | ||
|
||
return `fairlight.solo` | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters