Skip to content

[raudio][W.I.P] Separate audio devices from context, support other types other than playback - #6031

Closed
AllMeatball wants to merge 2 commits into
raysan5:masterfrom
AllMeatball:audiodevices
Closed

[raudio][W.I.P] Separate audio devices from context, support other types other than playback#6031
AllMeatball wants to merge 2 commits into
raysan5:masterfrom
AllMeatball:audiodevices

Conversation

@AllMeatball

@AllMeatball AllMeatball commented Jul 30, 2026

Copy link
Copy Markdown

Reason

I have decided since miniaudio (what raylib uses under the hood) can use (and enumerate) separate audio devices for initialization, raylib should implement these too.

A lot of games made today have sound configuration menus for input (capture) and output (playback) devices.

This is a draft due not having all of the features I want (some might be added already) (see Feature list)

What it does

Currently it just lists out sound devices, no option for individual device setup at the moment.

Added functions, types, config options etc.

Functions

  • rcore: StringDuplicate
  • raudio: GetAudioDeviceList, GetAudioDeviceList

Config Flags

  • SUPPORT_POSIX_STRDUP (is 1 by default and may want to be change for compat reasons)

Types

  • raudio (internal): rAudioDeviceID
  • raudio (external): AudioDevice, AudioDeviceList, AudioDeviceType

NOTE: the StringDuplicate function is used for copying the audio device names. if you want me to remove this or make it private to raylibs code, I am perfectly willing to do so.

Feature list

  • * Ability to list devices
  • * Individual/specific device setup (separating miniaudio context from device)
  • * Capture device / microphone support

Stuff to improve

  • I think that rAudioDeviceID is a bit too abstracted, a string format like "PulseAudio:hex" could be a better system

  • InitAudioDevice may change into the following

  • before:

// ... init window and what not
InitAudioDevice();
// ... close everything
CloseAudioDevice();
  • after:
// ... init window and what not
InitAudioContext();

#ifdef USE_DEFAULT_AUDIO_DEVICE
SetAudioDevice(NULL); /* picks the default audio device */
#else
AudioDevice device = {};
/* get specific audio device from `GetAudioDeviceList` */
SetAudioDevice(&device);
#endif

// ... close everything
CloseAudioContext();

Let me know if there's anything here that I need to fix or change.

@AllMeatball
AllMeatball marked this pull request as draft July 30, 2026 01:28
@raysan5

raysan5 commented Jul 30, 2026

Copy link
Copy Markdown
Owner

@AllMeatball thanks but no plans to follow this route.

@raysan5 raysan5 closed this Jul 30, 2026
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.

2 participants