obsproject / obs-websocket

Remote-control of OBS Studio through WebSocket
GNU General Public License v2.0
3.84k stars 704 forks source link

Feature Request: Provide Requests and Events for fetching audio mixer data #1078

Open malliaridis opened 1 year ago

malliaridis commented 1 year ago

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:

  1. Fetch all scene items from the current scene (one request)
  2. Recursively resolve all scenes included in the current scene (0-n requests)
  3. Filter found scene items by visibility (when hidden audio mixers not displayed) (client)
  4. Filter found scene items by inputKind (which is not documented which input kinds have audio and which not) (client)
  5. From filtered scene items get the sourceName they are using (client)
  6. Filter duplicates in source names (client)
  7. Fetch for each source name the mute state and volume / decibel etc. (n requests)
  8. 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:

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

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.

cezarsmpio commented 1 year ago

any progress on this? how can I help?