Skip to content

Commit

Permalink
feat: mixer-preset-loading working Midas/Behringer X32 preset loading
Browse files Browse the repository at this point in the history
  • Loading branch information
olzzon authored and olzzon committed Jun 8, 2020
1 parent 0617fec commit a8fe1a9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions client/components/RoutingStorage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Storage extends React.PureComponent<IStorageProps & Store> {
this.ListSnapshotFiles = this.ListSnapshotFiles.bind(this)
this.ListCcgFiles = this.ListCcgFiles.bind(this)
this.ListPresetFiles = this.ListPresetFiles.bind(this)
this.loadMixerPreset = this.loadMixerPreset.bind(this)
this.loadFile = this.loadFile.bind(this)
this.saveFile = this.saveFile.bind(this)
}
Expand Down
2 changes: 1 addition & 1 deletion server/MainThreadHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export class MainThreadHandlers {
this.updateFullClientStore()
})
.on(SOCKET_LOAD_MIXER_PRESET, (payload: any) => {
logger.info('Set default CCG File :' + String(payload), {})
logger.info('Set Mixer Preset :' + String(payload), {})
mixerGenericConnection.loadMixerPreset(payload)
this.updateFullClientStore()
})
Expand Down
12 changes: 10 additions & 2 deletions server/utils/mixerConnections/OscMixerConnection.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
//Node Modules:
const osc = require('osc')
const fs = require('fs')
const path = require('path')

import { store, state } from '../../reducers/store'
import { remoteConnections } from '../../mainClasses'
import { socketServer } from '../../expressHandler'
Expand Down Expand Up @@ -37,6 +40,7 @@ import {
SOCKET_SET_MIXER_ONLINE,
} from '../../constants/SOCKET_IO_DISPATCHERS'
import { logger } from '../logger'
import { valueContainerCSS } from 'react-select/src/components/containers'

export class OscMixerConnection {
mixerProtocol: IMixerProtocol
Expand Down Expand Up @@ -812,8 +816,12 @@ export class OscMixerConnection {
}

loadMixerPreset(presetName: string) {
logger.info('Loading preset :', presetName)
logger.info('Loading preset : ' + presetName)
if (this.mixerProtocol.presetFileExtension === 'X32') {
let data = JSON.parse(
fs.readFileSync(path.resolve('storage', presetName))
)

this.oscConnection.send({
address: this.mixerProtocol.loadPresetCommand[0].mixerMessage,
args: [
Expand All @@ -823,7 +831,7 @@ export class OscMixerConnection {
},
{
type: 'i',
value: 1,
value: parseInt(data.sceneIndex),
},
],
})
Expand Down

0 comments on commit a8fe1a9

Please sign in to comment.