Skip to content

Commit

Permalink
Merge pull request #193 from tv2/feat/ratio-labels-non-numeric
Browse files Browse the repository at this point in the history
Feat/ratio labels non numeric
  • Loading branch information
olzzon authored Nov 10, 2021
2 parents d74b69b + a5489f8 commit 6c74489
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 964 deletions.
30 changes: 22 additions & 8 deletions client/components/ChanStrip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,17 @@ class ChanStrip extends React.PureComponent<
let valueLabel =
window.mixerProtocol.channelTypes[0].fromMixer[fxParam]?.[0]
.valueLabel ?? ''
let valueAsLabels =
window.mixerProtocol.channelTypes[0].fromMixer[fxParam]?.[0]
.valueAsLabels
return (
<div className="parameter-text">
{window.mixerProtocol.channelTypes[0].fromMixer[fxParam][0]
.label ?? ''}
<div className="parameter-mini-text">
{maxLabel + valueLabel}
{!valueAsLabels
? maxLabel + valueLabel
: valueAsLabels[valueAsLabels.length - 1] + valueLabel}
</div>
<ReactSlider
className="chan-strip-fader"
Expand All @@ -256,11 +261,18 @@ class ChanStrip extends React.PureComponent<
}
renderThumb={(props: any, state: any) => (
<div {...props}>
{Math.round(
(maxLabel - minLabel) *
parseFloat(state.valueNow) +
minLabel
)}
{!valueAsLabels
? Math.round(
(maxLabel - minLabel) *
parseFloat(state.valueNow) +
minLabel
)
: valueAsLabels[
Math.round(
parseFloat(state.valueNow) *
(maxLabel - minLabel)
)
]}
{valueLabel}
</div>
)}
Expand All @@ -269,7 +281,9 @@ class ChanStrip extends React.PureComponent<
}}
/>
<div className="parameter-mini-text">
{minLabel + valueLabel}
{!valueAsLabels
? minLabel + valueLabel
: valueAsLabels[0] + valueLabel}
</div>
</div>
)
Expand Down Expand Up @@ -356,7 +370,7 @@ class ChanStrip extends React.PureComponent<
</div>
</React.Fragment>
)}
{hasGainTrim && (
{hasGainTrim && (
<React.Fragment>
<div className="item">
<div className="title">INPUT</div>
Expand Down
49 changes: 28 additions & 21 deletions client/components/ChanStripFull.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -589,35 +589,44 @@ class ChanStripFull extends React.PureComponent<
let valueLabel =
window.mixerProtocol.channelTypes[0].fromMixer[fxParam]?.[0]
.valueLabel ?? ''

let valueAsLabels =
window.mixerProtocol.channelTypes[0].fromMixer[fxParam]?.[0]
.valueAsLabels
return (
<div className="parameter-text">
{
window.mixerProtocol.channelTypes[0].fromMixer[fxParam][0]
.label
}
{window.mixerProtocol.channelTypes[0].fromMixer[fxParam][0]
.label ?? ''}
<div className="parameter-mini-text">
{maxLabel + valueLabel}
{!valueAsLabels
? maxLabel + valueLabel
: valueAsLabels[valueAsLabels.length - 1] + valueLabel}
</div>
<ReactSlider
className="chan-strip-full-fader"
thumbClassName="chan-strip-full-thumb"
className="chan-strip-fader"
thumbClassName="chan-strip-thumb"
orientation="vertical"
invert
min={0}
max={1}
step={0.001}
invert="false"
value={
this.props.fader[this.props.faderIndex][fxParam]?.[0] ??
0
}
renderThumb={(props: any, state: any) => (
<div {...props}>
{Math.round(
(maxLabel - minLabel) *
parseFloat(state.valueNow) +
minLabel
)}
{!valueAsLabels
? Math.round(
(maxLabel - minLabel) *
parseFloat(state.valueNow) +
minLabel
)
: valueAsLabels[
Math.round(
parseFloat(state.valueNow) *
(maxLabel - minLabel)
)
]}
{valueLabel}
</div>
)}
Expand All @@ -626,7 +635,9 @@ class ChanStripFull extends React.PureComponent<
}}
/>
<div className="parameter-mini-text">
{minLabel + valueLabel}
{!valueAsLabels
? minLabel + valueLabel
: valueAsLabels[0] + valueLabel}
</div>
</div>
)
Expand Down Expand Up @@ -793,19 +804,15 @@ class ChanStripFull extends React.PureComponent<
>
X
</button>
{window.location.search.includes(
'settings=1'
) ? (
{window.location.search.includes('settings=1') ? (
<button
className="button half"
onClick={() => this.handleShowRoutingOptions()}
>
Channel-Fader Routing
</button>
) : null}
{window.location.search.includes(
'settings=1'
) ? (
{window.location.search.includes('settings=1') ? (
<button
className="button half"
onClick={() => this.handleShowMonitorOptions()}
Expand Down
1 change: 1 addition & 0 deletions server/constants/MixerProtocolInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ interface IMixerMessageProtocol {
max?: number
zero?: number
label?: string
valueAsLabels?: Array<string>
valueLabel?: string
minLabel?: number
maxLabel?: number
Expand Down
18 changes: 16 additions & 2 deletions server/constants/mixerProtocols/midasMaster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,23 @@ export const MidasMaster: IMixerProtocol = {
[fxParamsList.CompRatio]: [
{
mixerMessage: '/ch/{channel}/dyn/ratio',
minLabel: 1,
maxLabel: 10,
minLabel: 0,
maxLabel: 11,
label: 'Ratio',
valueAsLabels: [
'1.1',
'1.3',
'1.5',
'2.0',
'2.5',
'3.0',
'4.0',
'5.0',
'7.0',
'10',
'20',
'100',
],
valueLabel: ' :1',
},
],
Expand Down
16 changes: 7 additions & 9 deletions server/utils/mixerConnections/OscMixerConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,21 +449,19 @@ export class OscMixerConnection {
}

let fxKey = keyName as keyof typeof fxParamsList
if (
this.checkOscCommand(
message.address,
this.mixerProtocol.channelTypes[0].fromMixer[
fxParamsList[fxKey]
][0].mixerMessage
)
) {
let fxMessage = this.mixerProtocol.channelTypes[0].fromMixer[
fxParamsList[fxKey]
][0]
if (this.checkOscCommand(message.address, fxMessage.mixerMessage)) {
let ch = message.address.split('/')[this.cmdChannelIndex]

store.dispatch(
storeFaderFx(
fxParamsList[fxKey],
state.channels[0].chMixerConnection[this.mixerIndex]
.channel[ch - 1].assignedFader,
message.args[0]
message.args[0] /
(fxMessage.maxLabel - fxMessage.minLabel)
)
)
global.mainThreadHandler.updatePartialStore(
Expand Down
Loading

0 comments on commit 6c74489

Please sign in to comment.