Skip to content

Events panel: channel filter uses 1-indexed values but compares against 0-indexed backend channels #720

@amiable-dev

Description

@amiable-dev

Summary

The event stream channel filter dropdown uses 1-indexed display values ('1' through '16') as option values, but the backend sends 0-indexed channel numbers (0–15). The filteredEvents derived store compares String(e.channel) directly against the filter value, causing an off-by-one mismatch.

Current behavior

  • Channel dropdown options: <option value="1">Ch 1</option> ... <option value="16">Ch 16</option>
  • Backend MidiEventInfo.channel: 0-indexed (0–15)
  • Filter comparison: String(e.channel) !== $channel — so selecting "Ch 1" matches events with channel: 1 (which is actually MIDI channel 2)

Expected behavior

Selecting "Ch 1" should show events on MIDI channel 1 (backend channel: 0).

Root cause

events.js line ~324:

if ($channel !== 'all' && String(e.channel) !== $channel) return false;

This compares raw 0-indexed backend values against 1-indexed UI values.

Fix options

  1. Store 0-indexed values in the select (value={String(ch - 1)}) — display stays 1-indexed
  2. Adjust the comparison: String((e.channel ?? -1) + 1) !== $channel

Option 1 is cleaner as it keeps the comparison simple.

Affected code

  • conductor-gui/ui/src/lib/stores/events.jsfilteredEvents derived store (two places: raw events and mapping_fired events)
  • conductor-gui/ui/src/lib/components/EventFilter.svelte — channel select option values

Notes

This is pre-existing behavior, not introduced by #711. Discovered during Copilot code review of #715.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggui

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions