Add some more intuitive getters for ma_device.

This adds the following APIs:

    ma_device_get_playback_format()
    ma_device_get_capture_format()
    ma_device_get_playback_channels()
    ma_device_get_capture_channels()
    ma_device_get_playback_channel_map()
    ma_device_get_capture_channel_map()
This commit is contained in:
David Reid
2026-02-16 10:36:38 +10:00
parent ebbe9707e2
commit e0e05c7b8c
+61
View File
@@ -9415,6 +9415,16 @@ the two. Use `ma_device_type_playback` for the playback side, or `ma_device_type
*/
MA_API ma_format ma_device_get_format(const ma_device* pDevice, ma_device_type deviceType);
/*
The equivalent to `ma_device_get_format(pDevice, ma_device_type_playback)`
*/
MA_API ma_format ma_device_get_playback_format(const ma_device* pDevice);
/*
The equivalent to `ma_device_get_format(pDevice, ma_device_type_capture)`
*/
MA_API ma_format ma_device_get_capture_format(const ma_device* pDevice);
/*
Retrieve the channel count of the device.
@@ -9443,6 +9453,16 @@ the two. Use `ma_device_type_playback` for the playback side, or `ma_device_type
*/
MA_API ma_uint32 ma_device_get_channels(const ma_device* pDevice, ma_device_type deviceType);
/*
The equivalent to `ma_device_get_channels(pDevice, ma_device_type_playback)`.
*/
MA_API ma_uint32 ma_device_get_playback_channels(const ma_device* pDevice);
/*
The equivalent to `ma_device_get_channels(pDevice, ma_device_type_capture)`.
*/
MA_API ma_uint32 ma_device_get_capture_channels(const ma_device* pDevice);
/*
Retrieve the sample rate of the device.
@@ -9492,6 +9512,16 @@ the two. Use `ma_device_type_playback` for the playback side, or `ma_device_type
*/
MA_API void ma_device_get_channel_map(const ma_device* pDevice, ma_device_type deviceType, ma_channel* pChannelMap, size_t channelMapCap);
/*
The equivalent to `ma_device_get_channel_map(pDevice, ma_device_type_playback, pChannelMap, channelMapCap)`
*/
MA_API void ma_device_get_playback_channel_map(const ma_device* pDevice, ma_channel* pChannelMap, size_t channelMapCap);
/*
The equivalent to `ma_device_get_channel_map(pDevice, ma_device_type_capture, pChannelMap, channelMapCap)`
*/
MA_API void ma_device_get_capture_channel_map(const ma_device* pDevice, ma_channel* pChannelMap, size_t channelMapCap);
/*
Retrieve the internal format of the device.
@@ -49810,6 +49840,16 @@ MA_API ma_format ma_device_get_format(const ma_device* pDevice, ma_device_type d
}
}
MA_API ma_format ma_device_get_playback_format(const ma_device* pDevice)
{
return ma_device_get_format(pDevice, ma_device_type_playback);
}
MA_API ma_format ma_device_get_capture_format(const ma_device* pDevice)
{
return ma_device_get_format(pDevice, ma_device_type_capture);
}
MA_API ma_uint32 ma_device_get_channels(const ma_device* pDevice, ma_device_type deviceType)
{
if (pDevice == NULL) {
@@ -49823,6 +49863,16 @@ MA_API ma_uint32 ma_device_get_channels(const ma_device* pDevice, ma_device_type
}
}
MA_API ma_uint32 ma_device_get_playback_channels(const ma_device* pDevice)
{
return ma_device_get_channels(pDevice, ma_device_type_playback);
}
MA_API ma_uint32 ma_device_get_capture_channels(const ma_device* pDevice)
{
return ma_device_get_channels(pDevice, ma_device_type_capture);
}
MA_API ma_uint32 ma_device_get_sample_rate(const ma_device* pDevice)
{
if (pDevice == NULL) {
@@ -49859,6 +49909,17 @@ MA_API void ma_device_get_channel_map(const ma_device* pDevice, ma_device_type d
}
}
MA_API void ma_device_get_playback_channel_map(const ma_device* pDevice, ma_channel* pChannelMap, size_t channelMapCap)
{
return ma_device_get_channel_map(pDevice, ma_device_type_playback, pChannelMap, channelMapCap);
}
MA_API void ma_device_get_capture_channel_map(const ma_device* pDevice, ma_channel* pChannelMap, size_t channelMapCap)
{
return ma_device_get_channel_map(pDevice, ma_device_type_capture, pChannelMap, channelMapCap);
}
MA_API ma_format ma_device_get_internal_format(const ma_device* pDevice, ma_device_type deviceType)
{
if (pDevice == NULL) {