Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for high-resolution Midi CCs #27

Merged
merged 26 commits into from
Jan 11, 2025
Merged

Conversation

infovore
Copy link
Contributor

@infovore infovore commented Jan 8, 2025

See #25

@infovore
Copy link
Contributor Author

infovore commented Jan 8, 2025

First of all: I've added a UI checkbox, a field on Control, and the UI for altering it. I've also set it so that if you have set a CC above (127-32), and you toggle to high-res, it clamps your CC to the maximum possible.

This adds:

- a `deviceCapability` for highResolution to the newer devices.
- front-end UI for displaying that in edit fields
- a brief explanation of what this is, within the editor.
@infovore infovore force-pushed the high_resolution_option branch from dd65e99 to 3c3a7de Compare January 8, 2025 16:32
@infovore
Copy link
Contributor Author

infovore commented Jan 8, 2025

CleanShot 2025-01-08 at 17 02 52

quite like this as a way of showing what's going on with a high-res CC in the 'viewer' mode.

@infovore
Copy link
Contributor Author

infovore commented Jan 8, 2025

Changed the MIDI code. Now, when it sees a CC change, it checks not only if that's a CC we're interested in... but also if it's a CC 32 above a high-resolution CC we're interested in.

If it is, it sets an MSB/LSB pairing. Otherwise, it just sets an LSB, and we calculate the final value from that.

Interesting thought: the "send me your current state" sysex command also ought to respect hi-res. Another thing to do.

I think the next step is to just write some test firmware that is always in high-resolution mode, config be damned, just to see what happens when we receive that data.

Device "capabilites" are now either boolean - ie, not enabled or
definitely enabled - or a semver string. If the latter, this indicates
the firmware version from which the feature is available.
@infovore infovore force-pushed the high_resolution_option branch from 620a025 to 1fa58a3 Compare January 9, 2025 12:57
This is what powers the instruction top right to upgrade. Because of the
way things work, we can - and should - do this _per-device_. So:

- each device config contains the latest semver for that device's
  firmware, and the URL to get it
- that's what gets tested against the number transmitted over sysex.

Neat.
@infovore
Copy link
Contributor Author

infovore commented Jan 9, 2025

This is feeling good: the features above summarise it all quite well.

Now all that is left is "the big one": writing/reading this configuration option to/from hardware, which involves some memory map changes, and working on the serialisation code.

Hi-res config is spread across three bytes each for USB and TRS; it's
basically a 16-bit bitmask split across three 7-bit values.
This fixes an issue where, moving from high to low res, bars need
recalculating. Now they don't.
Mainly snags - formatting I don't like - or copy changes, as detected by
viewing the whole PR.
Basically, making the function resemble its name. I think this is an
improvement, even if it's more verbose.
@infovore infovore force-pushed the high_resolution_option branch from eaf0b92 to a66a0e6 Compare January 10, 2025 15:16
- MIDI stores are all now in src/lib/state/midi.svelte.ts
- config is all now in src/lib/state/configuration.svelte.ts
@infovore infovore marked this pull request as ready for review January 11, 2025 16:37
- uses `onclick` like rest of Svelte 5
- uses children/slot rather than `label` prop.
@infovore infovore force-pushed the high_resolution_option branch from e14ddcd to 197c149 Compare January 11, 2025 16:42
@infovore infovore merged commit 884f6af into main Jan 11, 2025
2 checks passed
@Dewb Dewb mentioned this pull request Jan 11, 2025
5 tasks
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.

1 participant