Right now there is no simple option for fetching the audio mixer sources that are currently displayed without sending multiple requests and adding complex client-side logic.
The current scenario as far as I know the API capabilities looks as follows:
Fetch all scene items from the current scene (one request)
Recursively resolve all scenes included in the current scene (0-n requests)
Filter found scene items by visibility (when hidden audio mixers not displayed) (client)
Filter found scene items by inputKind (which is not documented which input kinds have audio and which not) (client)
From filtered scene items get the sourceName they are using (client)
Filter duplicates in source names (client)
Fetch for each source name the mute state and volume / decibel etc. (n requests)
Fetch special inputs and their state (at least one more request)
Solution Idea: Introduction of further requests for audio sources
With the introduction of new requests (and optionally events) the calls could be reduced to a single RPC and only a few events.
GetAllAudioSources
Fetches all audio sources available on the current scene collection and profile.
Request Fields:
Name
Type
Description
includeSpecialInputs
Boolean
Whether to include special inputs (Desktop 1, mic 1, etc.) or not
Response Fields:
Name
Type
Description
audioSources
List
List of audio sources
GetAudioSourcesForCurrentScene
Fetches a list of all audio sources that are available for the current scene.
Request Fields:
Name
Type
Description
includeSpecialInputs
Boolean
Whether to include special inputs (Desktop 1, mic 1, etc.) or not
Response Fields:
Name
Type
Description
audioSources
List
List of audio sources
GetAudioSourcesForScene
Fetches a list of all audio sources that are available for a specific scene.
Request Fields:
Name
Type
Description
includeSpecialInputs
Boolean
Whether to include special inputs (Desktop 1, mic 1, etc.) or not
sceneName
String
Whether to include special inputs (Desktop 1, mic 1, etc.) or not
Response Fields:
Name
Type
Description
audioSources
List
List of audio sources
Possible Events
The possible events are currently more or less already available but spread across multiple event groups. Those related to audio could be moved to the AudioSources Events.
Additional events that could be helpful are:
OnCurrentAudioSourcesChanged - The list of audio sources changed (e.g. because scene switch)
OnAudioSourceAdded - An audio source was added to the current scene (or generally)
OnAudioSourceRemoved - An audio source was removed from the current scene (or generally)
OnAudioSourceUpdated - An audio source was updated (volume, active or mute state). merges multiple events into a simple one.
AudioSource object
Object fields:
Name
Type
Description
Value Restrictions
sourceName
String
The name of the source as displayed in audio mixers
none
db
Number
The current decibel as floating point number
none
mul
Number
The current mul as floating point number
none
balance
Number
The current balance of the audio source
>= 0.0 and <= 1.0
muted
Boolean
Whether the audio source is muted or not
none
active
Boolean
Whether the audio source is active or not (value optional, if included it could represent whether or not the audio source is visible in the audio mixers or not, also relevant only for scene-specific requests and affected by visibility state
A simple usage scenario is to display and control the current mixer panel in an app and keep it up-to-date with OBS studio with less requests and implementation effort.
Feature Request Type
RPC Request
Feature Request Type (Other)
No response
Requested Feature
Right now there is no simple option for fetching the audio mixer sources that are currently displayed without sending multiple requests and adding complex client-side logic.
The current scenario as far as I know the API capabilities looks as follows:
inputKind
(which is not documented which input kinds have audio and which not) (client)sourceName
they are using (client)Solution Idea: Introduction of further requests for audio sources
With the introduction of new requests (and optionally events) the calls could be reduced to a single RPC and only a few events.
GetAllAudioSources
Fetches all audio sources available on the current scene collection and profile.
GetAudioSourcesForCurrentScene
Fetches a list of all audio sources that are available for the current scene.
GetAudioSourcesForScene
Fetches a list of all audio sources that are available for a specific scene.
Possible Events
The possible events are currently more or less already available but spread across multiple event groups. Those related to audio could be moved to the AudioSources Events.
Additional events that could be helpful are:
OnCurrentAudioSourcesChanged
- The list of audio sources changed (e.g. because scene switch)OnAudioSourceAdded
- An audio source was added to the current scene (or generally)OnAudioSourceRemoved
- An audio source was removed from the current scene (or generally)OnAudioSourceUpdated
- An audio source was updated (volume, active or mute state). merges multiple events into a simple one.AudioSource object
Further Information
With the v4.X there was
GetSourceList
(see https://github.com/obsproject/obs-websocket/issues/762), which provided enough information to reduce the amount of calls needed.Requested Feature Usage Scenario
A simple usage scenario is to display and control the current mixer panel in an app and keep it up-to-date with OBS studio with less requests and implementation effort.