feat: Set or toggle audio output tracks#355
Conversation
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.
There was a problem hiding this comment.
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.
| ], | ||
| callback: async (action) => { | ||
| let sourceName = await this.parseVariablesInString(action.options.source); | ||
| let audioTrackIDs = await this.parseVariablesInString(action.options.tracks); |
There was a problem hiding this comment.
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.
| let audioTrackIDs = await this.parseVariablesInString(action.options.tracks); |
| } | ||
| }) | ||
| await this.sendRequest('SetInputAudioTracks', { | ||
| inputName: action.options.source, |
There was a problem hiding this comment.
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.
| inputName: action.options.source, | |
| inputName: sourceName, |
| } | ||
| }); | ||
| await this.sendRequest('SetInputAudioTracks', { | ||
| inputName: action.options.source, |
There was a problem hiding this comment.
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.
| inputName: action.options.source, | |
| inputName: sourceName, |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Added actions for managing the output tracks of audio sources.
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.