Skip to content

Commit

Permalink
fix: use minLabel AND maxLabel when calculating received OSC message
Browse files Browse the repository at this point in the history
  • Loading branch information
olzzon committed Nov 10, 2021
1 parent cb48a27 commit c93a0b0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
12 changes: 6 additions & 6 deletions client/components/ChanStrip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ 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]
Expand All @@ -256,18 +259,15 @@ class ChanStrip extends React.PureComponent<
}
renderThumb={(props: any, state: any) => (
<div {...props}>
{!window.mixerProtocol.channelTypes[0].fromMixer[
fxParam
]?.[0].valueAsLabels
{!valueAsLabels
? Math.round(
(maxLabel - minLabel) *
parseFloat(state.valueNow) +
minLabel
)
: window.mixerProtocol.channelTypes[0]
.fromMixer[fxParam]?.[0].valueAsLabels[
: valueAsLabels[
Math.round(
parseFloat(state.valueNow) * 10
parseFloat(state.valueNow) * (maxLabel - minLabel)
)
]}
{valueLabel}
Expand Down
5 changes: 3 additions & 2 deletions server/constants/mixerProtocols/midasMaster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,12 @@ 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',
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

0 comments on commit c93a0b0

Please sign in to comment.