MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ RtAudioDevice()

MayaFlux::Core::RtAudioDevice::RtAudioDevice ( RtAudio *  context)

Initializes the device manager with an RtAudio context.

Parameters
contextPointer to an active RtAudio instance

Creates a device manager that uses the provided RtAudio context to enumerate and query audio devices. The device lists are populated during construction.

Definition at line 77 of file RtAudioBackend.cpp.

78 : m_context(context)
81{
82 if (!context) {
83 throw std::invalid_argument("RtAudioDevice: context must not be null");
84 }
85
86 if (m_context->getDeviceCount() == 0) {
87 throw std::runtime_error("No audio devices found");
88 }
89
90 m_defaultOutputDevice = m_context->getDefaultOutputDevice();
91 m_defaultInputDevice = m_context->getDefaultInputDevice();
92
93 for (unsigned int id : m_context->getDeviceIds()) {
94 try {
95 RtAudio::DeviceInfo info = m_context->getDeviceInfo(id);
96
97 if (info.outputChannels > 0) {
100 }
101
102 if (info.inputChannels > 0) {
105 }
106 } catch (RtAudioErrorType& e) {
107 std::cerr << "Error probing device: " << id << ": " << e << "\n";
108 }
109 }
110}
std::vector< DeviceInfo > m_output_devices
Cached list of output devices.
unsigned int m_defaultOutputDevice
System identifier for the default output device.
RtAudio * m_context
Pointer to the underlying RtAudio context.
std::vector< DeviceInfo > m_input_devices
Cached list of input devices.
unsigned int m_defaultInputDevice
System identifier for the default input device.
static DeviceInfo convert_device_info(const RtAudio::DeviceInfo &rtInfo, unsigned int id, unsigned int defaultOutputDevice, unsigned int defaultInputDevice)
Converts RtAudio-specific device information to the engine's device model.

References MayaFlux::Core::convert_device_info(), m_context, m_defaultInputDevice, m_defaultOutputDevice, m_input_devices, and m_output_devices.

+ Here is the call graph for this function: