Add ma_device_get_channel_map().

This commit is contained in:
David Reid
2026-02-01 16:59:13 +10:00
parent d929fafb34
commit 5c4cb49ad8
+43
View File
@@ -9379,6 +9379,32 @@ This should only be called in single-threaded mode. It should be called in a loo
MA_API ma_result ma_device_step(ma_device* pDevice, ma_blocking_mode blockingMode);
/*
Retrieves the channel map of the device.
Parameters
----------
pDevice (in)
A pointer to the device whose channel map is being retrieved.
deviceType (in)
Either `ma_device_type_playback` or `ma_device_type_capture` specifying which side of the device whose channel map is being retrieved.
pChannelMap (out)
A pointer to the buffer that will receive the channel map.
channelMapCap (in)
The capacity of `pChannelMap`.
Return Value
------------
MA_SUCCESS if successful; any other error otherwise.
*/
MA_API ma_result ma_device_get_channel_map(const ma_device* pDevice, ma_device_type deviceType, ma_channel* pChannelMap, size_t channelMapCap);
/*
Performs post backend initialization routines for setting up internal data conversion.
@@ -49461,6 +49487,23 @@ MA_API ma_result ma_device_step(ma_device* pDevice, ma_blocking_mode blockingMod
return MA_SUCCESS;
}
MA_API ma_result ma_device_get_channel_map(const ma_device* pDevice, ma_device_type deviceType, ma_channel* pChannelMap, size_t channelMapCap)
{
if (pDevice == NULL || pChannelMap == NULL) {
return MA_INVALID_ARGS;
}
if (deviceType == ma_device_type_duplex) {
return MA_INVALID_ARGS; /* Don't know if the playback or capture side is being requested. */
}
if (deviceType == ma_device_type_playback) {
return ma_data_converter_get_input_channel_map(&pDevice->playback.converter, pChannelMap, channelMapCap);
} else {
return ma_data_converter_get_output_channel_map(&pDevice->capture.converter, pChannelMap, channelMapCap);
}
}
MA_API ma_result ma_device_set_master_volume(ma_device* pDevice, float volume)
{
if (pDevice == NULL) {