Minor optimization to ma_copy_pcm_frames() and update to documentation.

This changes makes ma_copy_pcm_frames() a no-op when the input and
output buffers are both set to the same pointer. This is useful for
some in-place no-ops for effects and filters.
This commit is contained in:
David Reid
2020-06-06 18:16:45 +10:00
parent b287d94fe8
commit bc23d565e7
+10 -2
View File
@@ -7475,11 +7475,15 @@ static MA_INLINE ma_int32 ma_dither_s32(ma_dither_mode ditherMode, ma_int32 dith
}
/******************************************************************************
/**************************************************************************************************************************************************************
Atomics
******************************************************************************/
ma_atomic_increment/decrement_*() takes a pointer to the variable being incremented and returns the new value. Usage:
ma_uint32 newValue = ma_atomic_increment_32(&theValueToIncrement);
**************************************************************************************************************************************************************/
#if defined(__clang__)
#if defined(__has_builtin)
#if __has_builtin(__sync_swap)
@@ -30791,6 +30795,10 @@ MA_API ma_uint32 ma_calculate_buffer_size_in_frames_from_milliseconds(ma_uint32
MA_API void ma_copy_pcm_frames(void* dst, const void* src, ma_uint64 frameCount, ma_format format, ma_uint32 channels)
{
if (dst == src) {
return; /* No-op. */
}
ma_copy_memory_64(dst, src, frameCount * ma_get_bytes_per_frame(format, channels));
}