Skip to content

Commit

Permalink
feat: monitorview - settings in monitor setup, stored server side
Browse files Browse the repository at this point in the history
  • Loading branch information
olzzon authored and olzzon committed Mar 19, 2020
1 parent 8a219d7 commit 8837fce
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 8 deletions.
8 changes: 7 additions & 1 deletion client/assets/css/MiniChannel.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,11 @@
font-size: 105%;
background-color: rgba(39, 39, 39, 0.308);
border-radius: 7px;
border-color: rgba(99, 99, 99, 0.301);
border-color: rgba(77, 77, 77, 0.301);
}

.monitor-channel-strip-button.on {
background-color: rgb(146, 146, 146);
border-color: rgba(102, 102, 102, 0.301);

}
19 changes: 18 additions & 1 deletion client/components/ChannelMonitorOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { Store } from 'redux';
import { connect } from 'react-redux';
import { TOGGLE_SHOW_MONITOR_OPTIONS } from '../../server/reducers/settingsActions'
import { ISettings } from '../../server/reducers/settingsReducer';
import { SOCKET_SET_AUX_LEVEL, SOCKET_SET_FADER_MONITOR } from '../../server/constants/SOCKET_IO_DISPATCHERS';
import { SOCKET_SET_AUX_LEVEL, SOCKET_SET_FADER_MONITOR, SOCKET_SHOW_IN_MINI_MONITOR } from '../../server/constants/SOCKET_IO_DISPATCHERS';
import { SHOW_IN_MINI_MONITOR } from '../../server/reducers/faderActions';

interface IMonitorSettingsInjectProps {
label: string,
Expand Down Expand Up @@ -86,6 +87,17 @@ class ChannelMonitorOptions extends React.PureComponent<IChannelProps & IMonitor
}
}


handleShowInMiniMonitor = (event: ChangeEvent<HTMLInputElement>) => {
window.socketIoClient.emit(
SOCKET_SHOW_IN_MINI_MONITOR,
{
faderIndex: this.faderIndex,
showInMiniMonitor: event.target.checked
}
)
}

handleSetAux = (event: ChangeEvent<HTMLInputElement>) => {
let value = parseFloat(event.target.value) || -1
if (value > this.props.settings.numberOfAux || value < 0) {
Expand Down Expand Up @@ -133,6 +145,11 @@ class ChannelMonitorOptions extends React.PureComponent<IChannelProps & IMonitor
value={this.props.fader[this.faderIndex].monitor}
onChange={(event) => this.handleSetAux(event)}
/>
<input
type="checkbox"
checked={this.props.fader[this.faderIndex].showInMiniMonitor}
onChange={(event) => this.handleShowInMiniMonitor(event)}
/>
<hr />
{this.props.channel.map((channel: any, index: number) => {
return <div
Expand Down
2 changes: 1 addition & 1 deletion client/components/MiniChannel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class MiniChannel extends React.Component<IChannelProps & IChannelInjectProps &
return (
<button
className={ClassNames("monitor-channel-strip-button", {
'on': this.props.settings.showChanStrip
'on': (this.props.settings.showChanStrip === this.props.channelTypeIndex)
})}
onClick={event => {
this.handleShowChanStrip();
Expand Down
8 changes: 6 additions & 2 deletions client/components/MiniChannels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,15 @@ class Channels extends React.Component<IChannelsInjectProps & Store> {
render() {
return (
<div className="mini-channels-body">
{this.props.faders.map((none: any, index: number) => {
return <MiniChannel
{this.props.faders.map((fader: IFader, index: number) => {
return ((fader.showInMiniMonitor) ?
<MiniChannel
faderIndex = {index}
key={index}
/>
:
null
)
})
}
{(this.props.settings.showChanStrip >= 0) ?
Expand Down
17 changes: 15 additions & 2 deletions server/MainThreadHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ import {
SOCKET_SET_LO_MID,
SOCKET_SET_INPUT_OPTION,
SOCKET_SAVE_CCG_FILE,
SOCKET_SET_DELAY_TIME
SOCKET_SET_DELAY_TIME,
SOCKET_SHOW_IN_MINI_MONITOR,

} from './constants/SOCKET_IO_DISPATCHERS'
import {
TOGGLE_PGM,
Expand All @@ -61,7 +63,8 @@ import {
SET_FADER_MONITOR,
IGNORE_AUTOMATION,
SET_FADER_LO_MID,
SET_FADER_DELAY_TIME
SET_FADER_DELAY_TIME,
SHOW_IN_MINI_MONITOR
} from './reducers/faderActions';
import { SET_FADER_LEVEL } from './reducers/faderActions';
import { SET_ASSIGNED_FADER, SET_AUX_LEVEL } from './reducers/channelActions';
Expand Down Expand Up @@ -212,6 +215,16 @@ export class MainThreadHandlers {
this.updateFullClientStore()
})
)
.on(SOCKET_SHOW_IN_MINI_MONITOR, (
(payload: any) => {
store.dispatch({
type: SHOW_IN_MINI_MONITOR,
faderIndex: payload.faderIndex,
showInMiniMonitor: payload.showInMiniMonitor
});
this.updateFullClientStore()
})
)
.on(SOCKET_SET_INPUT_OPTION, (
(payload: any) => {
mixerGenericConnection.updateChannelSettings(payload.channel, payload.prop, payload.option)
Expand Down
1 change: 1 addition & 0 deletions server/constants/SOCKET_IO_DISPATCHERS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
export const SOCKET_SET_FADERLEVEL = 'FaderLevel'
export const SOCKET_SET_ASSIGNED_FADER = 'setAssignedFader'
export const SOCKET_SET_FADER_MONITOR = 'FaderMonitor'
export const SOCKET_SHOW_IN_MINI_MONITOR = 'showInMiniMonitor'
export const SOCKET_SET_AUX_LEVEL = 'setAuxLevel'
export const SOCKET_SET_INPUT_OPTION = 'setInputOption'
export const SOCKET_SET_THRESHOLD = 'setThreshold'
Expand Down
1 change: 1 addition & 0 deletions server/reducers/faderActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const SET_PFL = 'SET_PFL'
export const TOGGLE_MUTE = 'TOGGLE_MUTE'
export const SET_MUTE = 'SET_MUTE'
export const SHOW_CHANNEL = 'SHOW_CHANNEL'
export const SHOW_IN_MINI_MONITOR = 'SHOW_IN_MINI_MONITOR'
export const IGNORE_AUTOMATION = 'IGNORE_AUTOMATION'
export const TOGGLE_SNAP = 'TOGGLE_SNAP'
export const X_MIX = 'X_MIX'
Expand Down
8 changes: 7 additions & 1 deletion server/reducers/fadersReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ import {
SET_FADER_MID,
SET_FADER_HIGH,
SET_FADER_MONITOR,
SET_SINGLE_FADER_STATE
SET_SINGLE_FADER_STATE,
SHOW_IN_MINI_MONITOR
} from '../reducers/faderActions'

export interface IFaders {
Expand All @@ -58,6 +59,7 @@ export interface IFader {
delayTime: number
monitor: number,
showChannel: boolean,
showInMiniMonitor: boolean,
ignoreAutomation: boolean,
snapOn: Array<boolean>,
}
Expand Down Expand Up @@ -92,6 +94,7 @@ const defaultFadersReducerState = (numberOfFaders: number): IFaders[] => {
delayTime: 0,
monitor: (index + 1), // route fader - aux 1:1 as default
showChannel: true,
showInMiniMonitor: false,
ignoreAutomation: false,
snapOn: [],
});
Expand Down Expand Up @@ -218,6 +221,9 @@ export const faders = ((state = defaultFadersReducerState(0), action: any): Arra
case SHOW_CHANNEL: //channel // showChannel
nextState[0].fader[action.channel].showChannel = !!action.showChannel;
return nextState;
case SHOW_IN_MINI_MONITOR: //faderIndexz // showInMiniMonitor
nextState[0].fader[action.faderIndex].showInMiniMonitor = !!action.showInMiniMonitor;
return nextState;
case IGNORE_AUTOMATION: //channel // ignoreAutomation
nextState[0].fader[action.channel].ignoreAutomation = !nextState[0].fader[action.channel].ignoreAutomation
return nextState;
Expand Down

0 comments on commit 8837fce

Please sign in to comment.