Open
Conversation
Expose track/channel context information to plugins through the existing context traits (InitContext, ProcessContext, GuiContext). This adds a new TrackInfo struct with optional name, color, audio channel count, and track type fields. CLAP: Uses the track-info extension (with compat fallback) to query track name, color, channel count, and type (master/return/bus). VST3: Implements IInfoListener to receive channel context updates from the host, with partial-update merging for hosts like Ableton that send name and color in separate calls. Standalone: Returns None for all track info queries. Closes robbert-vdh#119 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use u32::try_from() instead of `as u32` for CLAP audio_channel_count to avoid wrapping negative sentinel values from buggy hosts - Add Eq and Default derives to TrackInfo - Import TrackType in VST3 wrapper instead of using fully qualified path - Add null-termination guard for VST3 name buffer hardening Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a
TrackInfoAPI that exposes track name, color, channel count, and track type to plugins. Implements the backing host integrations for both CLAP (clap.track-infoextension) and VST3 (IInfoListener::setChannelContextInfos).Resolves #119.
New API
New types (re-exported via
nih_plug::prelude)TrackInfo— name, color, channel count, track typeTrackColor— RGBA (u8 per channel)TrackType— Regular | Return | Bus | MasterImplementation details
CLAP
clap.track-infoextension withCLAP_EXT_TRACK_INFO_COMPATfallback for older hostsclap_host_track_info::get()32::try_from()cast foraudio_channel_count(guards against negative sentinels)VST3
IInfoListener(added to#[VST3(implements(...))])set_channel_context_infos(IAttributeList*)kChannelNameKey(UTF-16) andkChannelColorKey(ARGB packedu32)Standalone
Host compatibility
Verified working with REAPER (VST3 track name confirmed).
VST3
IInfoListenerknown to be supported by Cubase, Nuendo, REAPER, Ableton Live, Bitwig, Studio One, FL Studio, Digital Performer, and Cakewalk.Important note
Track info arrives after
initialize(). Both VST3 and CLAP hosts push/provide track info after the plugin is fully set up. Plugins should query fromprocess()or the GUI, not rely on it duringinit.Test plan
cargo build(default features)cargo build --no-default-featurescargo test --features "standalone,zstd"— all tests passcargo clippy— no new warnings