Skip to content

Commit

Permalink
feat: multiple mixers - move local Ip and port to "mixers" so multipl…
Browse files Browse the repository at this point in the history
…e OSC protocols can be supported
  • Loading branch information
olzzon authored and olzzon committed Oct 12, 2020
1 parent 858acf1 commit b071cca
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 39 deletions.
53 changes: 31 additions & 22 deletions client/components/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class Settings extends React.PureComponent<IAppProps & Store, IState> {
settings.mixers = []
for (let i = 0; i < settings.numberOfMixers; i++) {
if (settings.mixers[i] === undefined) {
settings.mixers.push( JSON.parse(JSON.stringify(mixers[0])))
settings.mixers.push(JSON.parse(JSON.stringify(mixers[0])))
} else {
settings.mixers.push(mixers[i])
}
Expand Down Expand Up @@ -338,6 +338,36 @@ class Settings extends React.PureComponent<IAppProps & Store, IState> {
/>
</label>
<br />
<label className="settings-input-field">
LOCAL MIXER IP:
<input
name="localIp"
type="text"
value={mixer.localIp}
onChange={(event) =>
this.handleMixerChange(
event,
mixerIndex
)
}
/>
</label>
<br />
<label className="settings-input-field">
LOCAL MIXER PORT :
<input
name="localOscPort"
type="text"
value={mixer.localOscPort}
onChange={(event) =>
this.handleMixerChange(
event,
mixerIndex
)
}
/>
</label>
<br />
<label className="settings-input-field">
PROTOCOL LATENCY :
<input
Expand Down Expand Up @@ -401,27 +431,6 @@ class Settings extends React.PureComponent<IAppProps & Store, IState> {
return (
<div className="settings-body">
<div className="settings-header">GENERIC SETTINGS:</div>

<label className="settings-input-field">
LOCAL MIXER IP:
<input
name="localIp"
type="text"
value={this.state.settings.localIp}
onChange={this.handleChange}
/>
</label>
<br />
<label className="settings-input-field">
LOCAL MIXER PORT :
<input
name="localOscPort"
type="text"
value={this.state.settings.localOscPort}
onChange={this.handleChange}
/>
</label>
<br />
<label className="settings-input-field">
FADE TIME :
<input
Expand Down
6 changes: 3 additions & 3 deletions server/__tests__/__mocks__/parsedEmptyStore.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@
"numberOfChannelsInType": [8],
"numberOfAux": 0,
"nextSendAux": -1,
"mixerOnline": false
"mixerOnline": false,
"localIp": "0.0.0.0",
"localOscPort": 1234
}
],
"localIp": "0.0.0.0",
"localOscPort": 1234,
"enableRemoteFader": false,
"remoteFaderMidiInputPort": "",
"remoteFaderMidiOutputPort": "",
Expand Down
6 changes: 3 additions & 3 deletions server/__tests__/__mocks__/parsedFullStore.json
Original file line number Diff line number Diff line change
Expand Up @@ -962,8 +962,6 @@
"showMonitorOptions": -1,
"showStorage": false,
"mixerProtocol": "genericMidi",
"localIp": "0.0.0.0",
"localOscPort": 1234,
"numberOfMixers": 1,
"mixers": [
{
Expand All @@ -976,7 +974,9 @@
"numberOfChannelsInType": [8],
"numberOfAux": 0,
"nextSendAux": -1,
"mixerOnline": false
"mixerOnline": false,
"localIp": "0.0.0.0",
"localOscPort": 1234
}
],
"enableRemoteFader": false,
Expand Down
6 changes: 3 additions & 3 deletions server/__tests__/__mocks__/parsedSimpleStore.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@
"showMonitorOptions": -1,
"showStorage": false,
"mixerProtocol": "genericMidi",
"localIp": "0.0.0.0",
"localOscPort": 1234,
"numberOfMixers": 1,
"mixers": [
{
Expand All @@ -79,7 +77,9 @@
"numberOfChannelsInType": [8],
"numberOfAux": 0,
"nextSendAux": -1,
"mixerOnline": false
"mixerOnline": false,
"localIp": "0.0.0.0",
"localOscPort": 1234
}
],
"enableRemoteFader": false,
Expand Down
9 changes: 4 additions & 5 deletions server/reducers/settingsReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ export interface ISettings {
/** User config */
numberOfMixers: number
mixers: IMixerSettings[]
localIp: string
localOscPort: number
enableRemoteFader: boolean
remoteFaderMidiInputPort: string
remoteFaderMidiOutputPort: string
Expand Down Expand Up @@ -74,6 +72,8 @@ export interface IMixerSettings {
numberOfAux: number
nextSendAux: number
mixerOnline: boolean
localIp: string
localOscPort: number
}

const defaultSettingsReducerState: Array<ISettings> = [
Expand All @@ -98,11 +98,10 @@ const defaultSettingsReducerState: Array<ISettings> = [
nextSendAux: -1,
numberOfChannelsInType: [8],
mixerOnline: false,
localIp: '0.0.0.0',
localOscPort: 1234,
},
],

localIp: '0.0.0.0',
localOscPort: 1234,
enableRemoteFader: false,
remoteFaderMidiInputPort: '',
remoteFaderMidiOutputPort: '',
Expand Down
2 changes: 1 addition & 1 deletion server/utils/mixerConnections/CasparCGConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class CasparCGConnection {
state.settings[0].mixers[this.mixerIndex].devicePort + ''
) + 1000
this.oscClient = new osc.UDPPort({
localAddress: state.settings[0].localIp,
localAddress: state.settings[0].mixers[this.mixerIndex].localIp,
localPort: remotePort,
remoteAddress:
state.settings[0].mixers[this.mixerIndex].deviceIp,
Expand Down
6 changes: 4 additions & 2 deletions server/utils/mixerConnections/OscMixerConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ export class OscMixerConnection {
.findIndex((ch) => ch === '{channel}')

this.oscConnection = new osc.UDPPort({
localAddress: state.settings[0].localIp,
localPort: parseInt(state.settings[0].localOscPort + ''),
localAddress: state.settings[0].mixers[this.mixerIndex].localIp,
localPort: parseInt(
state.settings[0].mixers[this.mixerIndex].localOscPort + ''
),
remoteAddress: state.settings[0].mixers[this.mixerIndex].deviceIp,
remotePort: parseInt(
state.settings[0].mixers[this.mixerIndex].devicePort + ''
Expand Down

0 comments on commit b071cca

Please sign in to comment.