Update documentation to suggest getters instead of direct struct access.

This is for the format, channels, sample rate and channel map.
This commit is contained in:
David Reid
2026-02-16 14:48:00 +10:00
parent e0e05c7b8c
commit 0d7a9f960f
+10 -9
View File
@@ -8672,7 +8672,8 @@ then be set directly on the structure. Below are the members of the `ma_device_c
Must be `ma_device_type_playback`, `ma_device_type_capture`, `ma_device_type_duplex` of `ma_device_type_loopback`. Must be `ma_device_type_playback`, `ma_device_type_capture`, `ma_device_type_duplex` of `ma_device_type_loopback`.
sampleRate sampleRate
The sample rate, in hertz. The most common sample rates are 48000 and 44100. Setting this to 0 will use the device's native sample rate. The sample rate, in hertz. The most common sample rates are 48000 and 44100. Setting this to 0 will use the device's native sample rate. This can be
retrieved after initialization from the device object directly with `ma_device_get_sample_rate()`.
periodSizeInFrames periodSizeInFrames
The desired size of a period in PCM frames. If this is 0, `periodSizeInMilliseconds` will be used instead. If both are 0 the default buffer size will The desired size of a period in PCM frames. If this is 0, `periodSizeInMilliseconds` will be used instead. If both are 0 the default buffer size will
@@ -8734,15 +8735,15 @@ then be set directly on the structure. Below are the members of the `ma_device_c
playback.format playback.format
The sample format to use for playback. When set to `ma_format_unknown` the device's native format will be used. This can be retrieved after The sample format to use for playback. When set to `ma_format_unknown` the device's native format will be used. This can be retrieved after
initialization from the device object directly with `device.playback.format`. initialization from the device object directly with `ma_device_get_playback_format()`.
playback.channels playback.channels
The number of channels to use for playback. When set to 0 the device's native channel count will be used. This can be retrieved after initialization The number of channels to use for playback. When set to 0 the device's native channel count will be used. This can be retrieved after initialization
from the device object directly with `device.playback.channels`. from the device object directly with `ma_device_get_playback_channels()`.
playback.pChannelMap playback.pChannelMap
The channel map to use for playback. When left empty, the device's native channel map will be used. This can be retrieved after initialization from the The channel map to use for playback. When left empty, the device's native channel map will be used. This can be retrieved after initialization from the
device object direct with `device.playback.pChannelMap`. When set, the buffer should contain `channels` items. device object direct with `ma_device_get_playback_channel_map()`. When set, the buffer should contain `channels` items.
playback.shareMode playback.shareMode
The preferred share mode to use for playback. Can be either `ma_share_mode_shared` (default) or `ma_share_mode_exclusive`. Note that if you specify The preferred share mode to use for playback. Can be either `ma_share_mode_shared` (default) or `ma_share_mode_exclusive`. Note that if you specify
@@ -8755,15 +8756,15 @@ then be set directly on the structure. Below are the members of the `ma_device_c
capture.format capture.format
The sample format to use for capture. When set to `ma_format_unknown` the device's native format will be used. This can be retrieved after The sample format to use for capture. When set to `ma_format_unknown` the device's native format will be used. This can be retrieved after
initialization from the device object directly with `device.capture.format`. initialization from the device object directly with `ma_device_get_capture_format()`.
capture.channels capture.channels
The number of channels to use for capture. When set to 0 the device's native channel count will be used. This can be retrieved after initialization The number of channels to use for capture. When set to 0 the device's native channel count will be used. This can be retrieved after initialization
from the device object directly with `device.capture.channels`. from the device object directly with `ma_device_get_capture_channels()`.
capture.pChannelMap capture.pChannelMap
The channel map to use for capture. When left empty, the device's native channel map will be used. This can be retrieved after initialization from the The channel map to use for capture. When left empty, the device's native channel map will be used. This can be retrieved after initialization from the
device object direct with `device.capture.pChannelMap`. When set, the buffer should contain `channels` items. device object direct with `ma_device_get_capture_channel_map()`. When set, the buffer should contain `channels` items.
capture.shareMode capture.shareMode
The preferred share mode to use for capture. Can be either `ma_share_mode_shared` (default) or `ma_share_mode_exclusive`. Note that if you specify The preferred share mode to use for capture. Can be either `ma_share_mode_shared` (default) or `ma_share_mode_exclusive`. Note that if you specify
@@ -8850,8 +8851,8 @@ Starting with Windows 10, miniaudio will use low-latency shared mode where possi
When sending or receiving data to/from a device, miniaudio will internally perform a format conversion to convert between the format specified by the config When sending or receiving data to/from a device, miniaudio will internally perform a format conversion to convert between the format specified by the config
and the format used internally by the backend. If you pass in 0 for the sample format, channel count, sample rate _and_ channel map, data transmission will run and the format used internally by the backend. If you pass in 0 for the sample format, channel count, sample rate _and_ channel map, data transmission will run
on an optimized pass-through fast path. You can retrieve the format, channel count and sample rate by inspecting the `playback/capture.format`, on an optimized pass-through fast path. You can retrieve the format, channel count and sample rate with `ma_device_get_playback_format()`,
`playback/capture.channels` and `sampleRate` members of the device object. `ma_device_get_capture_format()`, `ma_device_get_playback_channels()`, `ma_device_get_capture_channels()` and `ma_device_get_sample_rate()`.
When compiling for UWP you must ensure you call this function on the main UI thread because the operating system may need to present the user with a message When compiling for UWP you must ensure you call this function on the main UI thread because the operating system may need to present the user with a message
asking for permissions. Please refer to the official documentation for ActivateAudioInterfaceAsync() for more information. asking for permissions. Please refer to the official documentation for ActivateAudioInterfaceAsync() for more information.