Initializes the device manager with an RtAudio context.
Creates a device manager that uses the provided RtAudio context to enumerate and query audio devices. The device lists are populated during construction.
81{
82 if (!context) {
83 throw std::invalid_argument("RtAudioDevice: context must not be null");
84 }
85
87 throw std::runtime_error("No audio devices found");
88 }
89
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.