Skip to content

✨ feat(yamaha-01v96): Fixed channel pairing bug in AUX and BUS tabs#6

Open
RafaSRibeiro wants to merge 2 commits intokryops:mainfrom
RafaSRibeiro:fix-group-pair-bus-and-aux
Open

✨ feat(yamaha-01v96): Fixed channel pairing bug in AUX and BUS tabs#6
RafaSRibeiro wants to merge 2 commits intokryops:mainfrom
RafaSRibeiro:fix-group-pair-bus-and-aux

Conversation

@RafaSRibeiro
Copy link
Contributor

Fixed channel pairing bug in AUX and BUS tabs

  • Added support for channel pairing for CH, Aux, and Bus channels.
  • Added "Paired" property for channels.
  • Updated the user interface to display the pairing status of channels.
  • Updated fader colors when the channel is paired for better visualization.
  • Initial pair synchronization when connected to the mixer.

- Added support for channel pairing for CH, Aux, and Bus channels.
- Added "Paired" property for channels.
- Updated the user interface to display the pairing status of channels.
- Updated fader colors when the channel is paired for better visualization.
- Initial pair synchronization when connected to the mixer.
Copy link
Owner

@kryops kryops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, glad you are putting some effort into improving this project, much appreciated 😊

I sadly don't have a 01v96 any more since we switched to a Behringer Wing Compact (and on the rare occasions that I have a gig, I only control the lights anyway), so I can't try this out. Did a quick review just based on the code 😅

Comment on lines -42 to -51
for (let groupIndex = 1; groupIndex <= 8; groupIndex++) {
for (const groupType of groupTypes) {
sendMessage(
message({
type: `kInputGroup/kInGroup${groupType}${groupIndex}`,
channel: channel - 1,
isRequest: true,
})
)
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this not break the grouping sync, as it is the only place where the groups are requested?

Comment on lines +61 to +67
const state = useEntryState(category, id)

let pairColor = color
if (state?.paired) {
const pairIndex = Math.floor((parseInt(id) - 1) / 2)
pairColor = pairColors[pairIndex % pairColors.length]
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't feel quite right, as Fader is a "dumb" generic UI component that shouldn't know too much about what actually happens.

How about extracting this into a hook that determines the color for an entry? (maybe in a new file?)

export function useEntryColor(
  state: StateCategoryEntry | undefined
): string | null | undefined {
  if (state?.paired) {
    const pairIndex = Math.floor((parseInt(id) - 1) / 2)
    return pairColors[pairIndex % pairColors.length]
  } else {
    return state?.color
  }
}

And then the places that render the Fader can just call the hook and pass the resulting color to the fader:

const color = useEntryColor(state)

// ...

return <Fader /* ... */ color={color} />

(the hook could also take category and id, but in both places where we would use it we already have the state, so there is no need to load it twice)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants