✨ feat(yamaha-01v96): Fixed channel pairing bug in AUX and BUS tabs#6
✨ feat(yamaha-01v96): Fixed channel pairing bug in AUX and BUS tabs#6RafaSRibeiro wants to merge 2 commits intokryops:mainfrom
Conversation
- 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.
kryops
left a comment
There was a problem hiding this comment.
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 😅
| for (let groupIndex = 1; groupIndex <= 8; groupIndex++) { | ||
| for (const groupType of groupTypes) { | ||
| sendMessage( | ||
| message({ | ||
| type: `kInputGroup/kInGroup${groupType}${groupIndex}`, | ||
| channel: channel - 1, | ||
| isRequest: true, | ||
| }) | ||
| ) | ||
| } |
There was a problem hiding this comment.
Does this not break the grouping sync, as it is the only place where the groups are requested?
| const state = useEntryState(category, id) | ||
|
|
||
| let pairColor = color | ||
| if (state?.paired) { | ||
| const pairIndex = Math.floor((parseInt(id) - 1) / 2) | ||
| pairColor = pairColors[pairIndex % pairColors.length] | ||
| } |
There was a problem hiding this comment.
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)
Fixed channel pairing bug in AUX and BUS tabs