Skip to content

Commit

Permalink
fix: enable/disable HuiRemoteController in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
olzzon committed Jun 11, 2019
1 parent fb34bf6 commit 39e0824
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/components/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,16 @@ class Settings extends React.PureComponent<IAppProps & Store, IState> {
<div className="settings-header">
REMOTE CONTROLLER SETTINGS:
</div>
<label className="settings-input-field">
ENABLE REMOTE CONTROLLER:
<input
type="checkbox"
name="enableRemoteFader"
checked={this.state.settings.enableRemoteFader}
onChange={this.handleChange}
/>
</label>
<br/>
<div className="settings-input-field">
Remote Midi Input Port :
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/reducers/settingsReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface ISettings {
localOscPort: number,
deviceIp: string,
devicePort: number,
enableRemoteFader: boolean,
remoteFaderMidiInputPort: string,
remoteFaderMidiOutputPort: string,
numberOfChannels: number,
Expand All @@ -27,6 +28,7 @@ const defaultSettingsReducerState: Array<ISettings> = [
localOscPort: 8000,
deviceIp: "0.0.0.0",
devicePort: 10024,
enableRemoteFader: false,
remoteFaderMidiInputPort: "",
remoteFaderMidiOutputPort: "",
numberOfChannels: DEFAULTS.NUMBER_OF_CHANNELS,
Expand Down
4 changes: 3 additions & 1 deletion src/utils/HuiMidiRemoteConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ export class HuiMidiRemoteConnection {
this.remoteProtocol = RemoteFaderPresets.hui;
this.mixerProtocol = MixerProtocolPresets[this.store.settings[0].mixerProtocol] || MixerProtocolPresets.genericMidi;

if (!this.store.settings[0].enableRemoteFader) {
return
}

WebMidi.enable((err) => {

if (err) {
console.log("Remote MidiController connection could not be enabled.", err);
}
Expand Down

0 comments on commit 39e0824

Please sign in to comment.