Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDL3: Allow audio channel maps to map to null channel #11373

Open
isXander opened this issue Oct 29, 2024 · 0 comments · May be fixed by #11512
Open

SDL3: Allow audio channel maps to map to null channel #11373

isXander opened this issue Oct 29, 2024 · 0 comments · May be fixed by #11512
Assignees
Milestone

Comments

@isXander
Copy link
Contributor

Problem

Currently channel maps require every channel of the output map is bound to a valid input channel. There is currently no way to map an output channel to null (not play anything on a channel).

For example, if the input is a stereo stream (2 channels) and the output is a quadrophonic stream (4 channels), it is currently impossible to play the stereo sound on only the first two channels of the quadrophonic stream, you would need to duplicate the stereo sound to channels 3 and 4, which may be undesired.

Example use cases

Use case 1

Take for example you have a quadrophonic output.

  • Channel 1 is front left
  • Channel 2 is front right
  • Channel 3 is back left
  • Channel 4 is back right

You have two input streams

  • you want to map input stream 1 to play on the front channels
  • you want to map input stream 2 to play on the back channels

This behaviour is currently unsupported by SDL, as when you create a channel map for stream 1, each output channel must be bound to an input channel.

Use case 2

This is a lot more specific to my use case.

A DualSense controller exposes a 4-channel audio playback device,

  • channels 1 and 2 are used for a regular stereo passthrough to a wired jack on the controller.
  • channels 3 and 4 are used for HD haptics: 3 being for the left handle, 4 being for the right

In this scenario, my game has two audio streams: one for game audio, the other for HD haptic data.
It would be ideal to be able to map my two streams as { 0, 1, null, null } and { null, null, 0, 1 } respectively. Instead however, I need to mix these two audio streams by adding 0 samples to the channels I don't want to play on.

Solution

Allow channel maps to accept -1, indicating a channel is mapped to nothing.
You could #define NO_MAP -1 to make the DX a little better too.

@slouken slouken added this to the 3.2.0 milestone Oct 29, 2024
@isXander isXander changed the title Allow audio channel maps to map to null channel SDL3: Allow audio channel maps to map to null channel Oct 30, 2024
icculus added a commit to icculus/SDL that referenced this issue Nov 21, 2024
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 a pull request may close this issue.

3 participants