API CHANGE: Remove ma_performance_profile.

This also removes the `performanceProfile` config option from
`ma_device_config`. Increase the period size if you want to be more
conservative.

Backends that have their own notion of a "latency hint" or the like will
have those options exposed via a backend-specific configuration option.
This commit is contained in:
David Reid
2025-07-15 14:35:24 +10:00
parent a014181372
commit f0ff4b6de3
3 changed files with 36 additions and 94 deletions
@@ -468,7 +468,7 @@ static void ma_stream_event_param_changed__pipewire(void* pUserData, ma_uint32 i
/* Now that we definitely know the sample rate, we can reliable configure the size of the buffer. */
bufferSizeInFrames = pDeviceStatePipeWire->paramChangedCallbackData.pDescriptor->periodSizeInFrames;
if (bufferSizeInFrames == 0) {
bufferSizeInFrames = ma_calculate_buffer_size_in_frames_from_descriptor(pDeviceStatePipeWire->paramChangedCallbackData.pDescriptor, (ma_uint32)audioInfo.rate, ma_performance_profile_low_latency);
bufferSizeInFrames = ma_calculate_buffer_size_in_frames_from_descriptor(pDeviceStatePipeWire->paramChangedCallbackData.pDescriptor, (ma_uint32)audioInfo.rate);
}
/* Update the descriptor. This is where the internal format/channels/rate is set. */
+2 -3
View File
@@ -447,8 +447,7 @@ static ma_result ma_device_init_internal__sdl(ma_device* pDevice, ma_context_sta
1) If periodSizeInFrames is not 0, use periodSizeInFrames; else
2) If periodSizeInMilliseconds is not 0, use periodSizeInMilliseconds; else
3) If both periodSizeInFrames and periodSizeInMilliseconds is 0, use the backend's default. If the backend does not allow a default
buffer size, use a default value of MA_DEFAULT_PERIOD_SIZE_IN_MILLISECONDS_LOW_LATENCY or
MA_DEFAULT_PERIOD_SIZE_IN_MILLISECONDS_CONSERVATIVE depending on the value of pConfig->performanceProfile.
buffer size, use a default value of MA_DEFAULT_PERIOD_SIZE_IN_MILLISECONDS.
Note that options 2 and 3 require knowledge of the sample rate in order to convert it to a frame count. You should try to keep the
calculation of the period size as accurate as possible, but sometimes it's just not practical so just use whatever you can.
@@ -456,7 +455,7 @@ static ma_result ma_device_init_internal__sdl(ma_device* pDevice, ma_context_sta
A helper function called ma_calculate_buffer_size_in_frames_from_descriptor() is available to do all of this for you which is what
we'll be using here.
*/
pDescriptor->periodSizeInFrames = ma_calculate_buffer_size_in_frames_from_descriptor(pDescriptor, pDescriptor->sampleRate, ma_performance_profile_low_latency);
pDescriptor->periodSizeInFrames = ma_calculate_buffer_size_in_frames_from_descriptor(pDescriptor, pDescriptor->sampleRate);
/* SDL wants the buffer size to be a power of 2 for some reason. */
if (pDescriptor->periodSizeInFrames > 32768) {