Skip to content

Commit

Permalink
feat: multiple mixers support loop through all mixers in generic conn…
Browse files Browse the repository at this point in the history
…ection
  • Loading branch information
olzzon authored and olzzon committed Oct 5, 2020
1 parent 95209b5 commit f29b09f
Show file tree
Hide file tree
Showing 2 changed files with 158 additions and 80 deletions.
4 changes: 2 additions & 2 deletions server/reducers/channelsReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import {
} from './channelActions'

export interface IChannels {
chConnection: IchConnections[]
chConnection: IchConnection[]
}

export interface IchConnections {
export interface IchConnection {
channel: Array<IChannel>
}

Expand Down
234 changes: 156 additions & 78 deletions server/utils/MixerConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { LawoRubyMixerConnection } from './mixerConnections/LawoRubyConnection'
import { StuderMixerConnection } from './mixerConnections/StuderMixerConnection'
import { StuderVistaMixerConnection } from './mixerConnections/StuderVistaMixerConnection'
import { CasparCGConnection } from './mixerConnections/CasparCGConnection'
import { IChannel } from '../reducers/channelsReducer'
import { IChannel, IchConnection } from '../reducers/channelsReducer'
import {
storeFadeActive,
storeSetOutputLevel,
Expand Down Expand Up @@ -112,6 +112,7 @@ export class MixerGenericConnection {
}

loadMixerPreset(presetName: string) {
//TODO: atm mixer presets only supports first mixer connected to Sisyfos
this.mixerConnection[0].loadMixerPreset(presetName)
}

Expand Down Expand Up @@ -150,13 +151,18 @@ export class MixerGenericConnection {
}
}

state.channels[0].chConnection[0].channel.forEach(
(channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.fadeInOut(channelIndex, fadeTime)
}
state.channels[0].chConnection.forEach(
(chConnection: IchConnection) => {
chConnection.channel.forEach(
(channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.fadeInOut(channelIndex, fadeTime)
}
}
)
}
)

if (remoteConnections) {
remoteConnections.updateRemoteFaderState(
faderIndex,
Expand All @@ -167,26 +173,37 @@ export class MixerGenericConnection {

updateInputGain(faderIndex: number) {
let level = state.faders[0].fader[faderIndex].inputGain
state.channels[0].chConnection[0].channel.forEach(
(channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.mixerConnection[0].updateInputGain(channelIndex, level)
}
state.channels[0].chConnection.forEach(
(chConnection: IchConnection) => {
chConnection.channel.forEach(
(channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.mixerConnection[0].updateInputGain(
channelIndex,
level
)
}
}
)
}
)
}

updateInputSelector(faderIndex: number) {
let inputSelected = state.faders[0].fader[faderIndex].inputSelector
console.log(faderIndex, inputSelected)
state.channels[0].chConnection[0].channel.forEach(
(channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.mixerConnection[0].updateInputSelector(
channelIndex,
inputSelected
)
}
state.channels[0].chConnection.forEach(
(chConnection: IchConnection) => {
chConnection.channel.forEach(
(channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.mixerConnection[0].updateInputSelector(
channelIndex,
inputSelected
)
}
}
)
}
)
}
Expand All @@ -196,27 +213,35 @@ export class MixerGenericConnection {
}

updateMuteState(faderIndex: number) {
state.channels[0].chConnection[0].channel.forEach(
(channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.mixerConnection[0].updateMuteState(
channelIndex,
state.faders[0].fader[faderIndex].muteOn
)
}
state.channels[0].chConnection.forEach(
(chConnection: IchConnection) => {
chConnection.channel.forEach(
(channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.mixerConnection[0].updateMuteState(
channelIndex,
state.faders[0].fader[faderIndex].muteOn
)
}
}
)
}
)
}

updateAMixState(faderIndex: number) {
state.channels[0].chConnection[0].channel.forEach(
(channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.mixerConnection[0].updateAMixState(
channelIndex,
state.faders[0].fader[faderIndex].amixOn
)
}
state.channels[0].chConnection.forEach(
(chConnection: IchConnection) => {
chConnection.channel.forEach(
(channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.mixerConnection[0].updateAMixState(
channelIndex,
state.faders[0].fader[faderIndex].amixOn
)
}
}
)
}
)
}
Expand All @@ -231,85 +256,138 @@ export class MixerGenericConnection {
(100 - state.settings[0].voLevel)) /
100
}
state.channels[0].chConnection[0].channel.forEach(
(channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.mixerConnection[0].updateNextAux(channelIndex, level)
}
state.channels[0].chConnection.forEach(
(chConnection: IchConnection) => {
chConnection.channel.forEach(
(channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.mixerConnection[0].updateNextAux(
channelIndex,
level
)
}
}
)
}
)
}

updateThreshold(faderIndex: number) {
let level = state.faders[0].fader[faderIndex].threshold
state.channels[0].chConnection[0].channel.forEach(
(channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.mixerConnection[0].updateThreshold(channelIndex, level)
}
state.channels[0].chConnection.forEach(
(chConnection: IchConnection) => {
chConnection.channel.forEach(
(channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.mixerConnection[0].updateThreshold(
channelIndex,
level
)
}
}
)
}
)
}
updateRatio(faderIndex: number) {
let level = state.faders[0].fader[faderIndex].ratio
state.channels[0].chConnection[0].channel.forEach(
(channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.mixerConnection[0].updateRatio(channelIndex, level)
}
state.channels[0].chConnection.forEach(
(chConnection: IchConnection) => {
chConnection.channel.forEach(
(channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.mixerConnection[0].updateRatio(
channelIndex,
level
)
}
}
)
}
)
}
updateDelayTime(faderIndex: number) {
let delayTime = state.faders[0].fader[faderIndex].delayTime
state.channels[0].chConnection[0].channel.forEach(
(channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.mixerConnection[0].updateDelayTime(
channelIndex,
delayTime
)
}
state.channels[0].chConnection.forEach(
(chConnection: IchConnection) => {
chConnection.channel.forEach(
(channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.mixerConnection[0].updateDelayTime(
channelIndex,
delayTime
)
}
}
)
}
)
}
updateLow(faderIndex: number) {
let level = state.faders[0].fader[faderIndex].low
state.channels[0].chConnection[0].channel.forEach(
(channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.mixerConnection[0].updateLow(channelIndex, level)
}
state.channels[0].chConnection.forEach(
(chConnection: IchConnection) => {
chConnection.channel.forEach(
(channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.mixerConnection[0].updateLow(
channelIndex,
level
)
}
}
)
}
)
}
updateLoMid(faderIndex: number) {
let level = state.faders[0].fader[faderIndex].loMid
state.channels[0].chConnection[0].channel.forEach(
(channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.mixerConnection[0].updateLoMid(channelIndex, level)
}
state.channels[0].chConnection.forEach(
(chConnection: IchConnection) => {
chConnection.channel.forEach(
(channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.mixerConnection[0].updateLoMid(
channelIndex,
level
)
}
}
)
}
)
}
updateMid(faderIndex: number) {
let level = state.faders[0].fader[faderIndex].mid
state.channels[0].chConnection[0].channel.forEach(
(channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.mixerConnection[0].updateMid(channelIndex, level)
}
state.channels[0].chConnection.forEach(
(chConnection: IchConnection) => {
chConnection.channel.forEach(
(channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.mixerConnection[0].updateMid(
channelIndex,
level
)
}
}
)
}
)
}
updateHigh(faderIndex: number) {
let level = state.faders[0].fader[faderIndex].high
state.channels[0].chConnection[0].channel.forEach(
(channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.mixerConnection[0].updateHigh(channelIndex, level)
}
state.channels[0].chConnection.forEach(
(chConnection: IchConnection) => {
chConnection.channel.forEach(
(channel: IChannel, channelIndex: number) => {
if (faderIndex === channel.assignedFader) {
this.mixerConnection[0].updateHigh(
channelIndex,
level
)
}
}
)
}
)
}
Expand Down

0 comments on commit f29b09f

Please sign in to comment.