SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
SDL::AudioDevice Struct Reference

SDL Audio Device instance IDs. More...

Inheritance diagram for SDL::AudioDevice:
[legend]

Public Member Functions

constexpr AudioDevice (AudioDeviceID resource) noexcept
 Constructs from raw AudioDevice.
constexpr AudioDevice (const AudioDevice &other)=delete
 Copy constructor.
constexpr AudioDevice (AudioDevice &&other) noexcept
 Move constructor.
constexpr AudioDevice (const AudioDeviceRef &other)=delete
constexpr AudioDevice (AudioDeviceRef &&other)=delete
 AudioDevice (AudioDeviceRef devid, OptionalRef< const AudioSpec > spec)
 Open a specific audio device.
 ~AudioDevice ()
 Destructor.
constexpr AudioDeviceoperator= (AudioDevice &&other) noexcept
 Assignment operator.
AudioDeviceoperator= (const AudioDevice &other)=delete
 Assignment operator.
void Close ()
 Close a previously-opened audio device.
const char * GetName () const
 Get the human-readable name of a specific audio device.
AudioSpec GetFormat (int *sample_frames=nullptr) const
 Get the current audio format of a specific audio device.
OwnArray< int > GetChannelMap () const
 Get the current channel map of an audio device.
bool IsPhysical () const
 Determine if an audio device is physical (instead of logical).
bool IsPlayback () const
 Determine if an audio device is a playback device (instead of recording).
void Pause ()
 Use this function to pause audio playback on a specified device.
void Resume ()
 Use this function to unpause audio playback on a specified device.
bool Paused () const
 Use this function to query if an audio device is paused.
float GetGain () const
 Get the gain of an audio device.
void SetGain (float gain)
 Change the gain of an audio device.
void BindAudioStreams (std::span< AudioStreamRef > streams)
 Bind a list of audio streams to an audio device.
void BindAudioStream (AudioStreamRef stream)
 Bind a single audio stream to an audio device.
void SetPostmixCallback (AudioPostmixCallback callback, void *userdata)
 Set a callback that fires when data is about to be fed to an audio device.
void SetPostmixCallback (AudioPostmixCB callback)
 Set a callback that fires when data is about to be fed to an audio device.
AudioStream OpenStream (OptionalRef< const AudioSpec > spec, AudioStreamCallback callback, void *userdata)
 Convenience function for straightforward audio init for the common case.
AudioStream OpenStream (OptionalRef< const AudioSpec > spec, AudioStreamCB callback)
 Convenience function for straightforward audio init for the common case.
constexpr ResourceBase (RawPointer resource)
 Constructs from resource pointer.
constexpr ResourceBase (std::nullptr_t=nullptr)
 Constructs null/invalid.
Public Member Functions inherited from SDL::ResourceBase< AudioDeviceID >
constexpr ResourceBase (RawPointer resource)
 Constructs from resource pointer.
constexpr operator bool () const
 Converts to bool.
constexpr auto operator<=> (const ResourceBase &other) const=default
 Comparison.
constexpr RawConstPointer operator-> () const noexcept
 member access to underlying resource pointer.
constexpr RawPointer get () const noexcept
 Retrieves underlying resource pointer.
constexpr RawPointer release () noexcept
 Retrieves underlying resource pointer and clear this.

Additional Inherited Members

Public Types inherited from SDL::ResourceBase< AudioDeviceID >
using RawPointer
 The underlying raw pointer type.
using RawConstPointer
 The underlying const raw pointer type.

Detailed Description

SDL Audio Device instance IDs.

Zero is used to signify an invalid/null device.

Since
This datatype is available since SDL 3.2.0.
Category:
Resource

Constructor & Destructor Documentation

◆ AudioDevice()

SDL::AudioDevice::AudioDevice ( AudioDeviceID resource)
inlineexplicitconstexprnoexcept

Constructs from raw AudioDevice.

Parameters
resourcea AudioDeviceID to be wrapped.

This assumes the ownership, call release() if you need to take back.


The documentation for this struct was generated from the following file: