Skip to content

feat: Set or toggle audio output tracks#355

Open
Wiethoofd wants to merge 5 commits into
bitfocus:mainfrom
Wiethoofd:inputAudioTracks
Open

feat: Set or toggle audio output tracks#355
Wiethoofd wants to merge 5 commits into
bitfocus:mainfrom
Wiethoofd:inputAudioTracks

Conversation

@Wiethoofd

Copy link
Copy Markdown
Contributor

Added actions for managing the output tracks of audio sources.

  1. Select source and individually set (true/false) or toggle each track
image
  1. Select source and set (true/false) or toggle the state of selected (or all) tracks
image

Additionally exposed each audio source track object as variable.

Use case
When utilizing the Twitch VOD track or the MultiRTMP plugin with a non-default output track selected or having multiple audio tracks set up in the recording settings; if a source is still needed on the main audio track, but not the VOD track or vice versa, this can now be managed here instead of the Advanced Volume Properties without needing to mute the source.

This gives the user more control over where to route the audio.

Save and update `inputAudioTracks` in variables on `InputAudioTracksChanged` for audio sources.
Action to set an audio track state to true/false or toggle between, based on current state.

Configure all 6 tracks for a single audio source individually and send as one `setInputAudioTracks` request.
Action to set audio track state for select tracks in a multiselect dropdown.

The `setInputAudioTracks` does not require all 6 tracks to be set to be able to change or toggle state.

Checkbox for ease of use to not have to select all tracks, acts the same if all are selected.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds control and visibility for OBS audio source output track routing (tracks 1–6), enabling per-track set/toggle actions and exposing current track states as variables.

Changes:

  • Add new actions to set/toggle an input’s audio output track assignments.
  • Expose per-source tracks_* variables and keep them updated via OBS websocket events.
  • Document the new tracks capability in the module help.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
actions.js Adds “Set Audio Output Tracks” and “Toggle Audio Output Tracks” actions.
index.js Updates tracks_* variables when audio track state is fetched/changes.
variables.js Adds tracks_* source variables and populates their values.
companion/HELP.md Mentions the new audio tracks capability in actions/variables lists.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread companion/HELP.md Outdated
Comment thread actions.js Outdated
Comment thread actions.js
],
callback: async (action) => {
let sourceName = await this.parseVariablesInString(action.options.source);
let audioTrackIDs = await this.parseVariablesInString(action.options.tracks);

Copilot AI Feb 23, 2026

Copy link

Choose a reason for hiding this comment

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

audioTrackIDs is computed with parseVariablesInString(action.options.tracks) but never used. Also, action.options.tracks from a multidropdown is an array, so passing it into parseVariablesInString (which is used elsewhere only with strings) is likely to throw at runtime. Remove this parse call (and the unused variable) and operate directly on the array of selected track IDs.

Suggested change
let audioTrackIDs = await this.parseVariablesInString(action.options.tracks);

Copilot uses AI. Check for mistakes.
Comment thread actions.js
}
})
await this.sendRequest('SetInputAudioTracks', {
inputName: action.options.source,

Copilot AI Feb 23, 2026

Copy link

Choose a reason for hiding this comment

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

You compute sourceName (after variable parsing) but the request sends inputName: action.options.source. Use the parsed sourceName consistently for both the lookup and inputName to avoid targeting the wrong input when variables/custom values are used.

Suggested change
inputName: action.options.source,
inputName: sourceName,

Copilot uses AI. Check for mistakes.
Comment thread actions.js
}
});
await this.sendRequest('SetInputAudioTracks', {
inputName: action.options.source,

Copilot AI Feb 23, 2026

Copy link

Choose a reason for hiding this comment

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

Same issue here: the request uses inputName: action.options.source while the action already computed sourceName. Use sourceName for inputName so the lookup and request stay consistent.

Suggested change
inputName: action.options.source,
inputName: sourceName,

Copilot uses AI. Check for mistakes.
bryce-seifert and others added 2 commits February 22, 2026 21:04
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

3 participants