From a611cf5f26a56da913cc15502b7df9662b51e2be Mon Sep 17 00:00:00 2001 From: David Reid Date: Tue, 6 Aug 2024 12:07:55 +1000 Subject: [PATCH] Add ma_device_id_equal(). --- miniaudio.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/miniaudio.h b/miniaudio.h index c890af8a..e658edc5 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -7020,6 +7020,8 @@ typedef union int nullbackend; /* The null backend uses an integer for device IDs. */ } ma_device_id; +MA_API ma_bool32 ma_device_id_equal(const ma_device_id* pA, const ma_device_id* pB); + typedef struct ma_context_config ma_context_config; typedef struct ma_device_config ma_device_config; @@ -41416,6 +41418,24 @@ MA_API ma_result ma_device_job_thread_next(ma_device_job_thread* pJobThread, ma_ } +MA_API ma_bool32 ma_device_id_equal(const ma_device_id* pA, const ma_device_id* pB) +{ + size_t i; + + if (pA == NULL || pB == NULL) { + return MA_FALSE; + } + + for (i = 0; i < sizeof(ma_device_id); i += 1) { + if (((const char*)pA)[i] != ((const char*)pB)[i]) { + return MA_FALSE; + } + } + + return MA_TRUE; +} + + MA_API ma_context_config ma_context_config_init(void) {