From eee86a0ae196cc101fe190e2f5574f0742b2f00d Mon Sep 17 00:00:00 2001 From: David Reid Date: Wed, 19 Feb 2025 08:28:01 +1000 Subject: [PATCH] Fix the C++ build for some examples. --- examples/data_source_chaining.c | 8 ++++---- examples/hilo_interop.c | 2 +- examples/resource_manager_advanced.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/data_source_chaining.c b/examples/data_source_chaining.c index a66258ee..c9126976 100644 --- a/examples/data_source_chaining.c +++ b/examples/data_source_chaining.c @@ -135,15 +135,15 @@ int main(int argc, char** argv) deviceConfig.dataCallback = data_callback; deviceConfig.pUserData = NULL; - if (ma_device_init(NULL, &deviceConfig, &device) != MA_SUCCESS) { + result = ma_device_init(NULL, &deviceConfig, &device); + if (result != MA_SUCCESS) { printf("Failed to open playback device.\n"); - result = -1; goto done_decoders; } - if (ma_device_start(&device) != MA_SUCCESS) { + result = ma_device_start(&device); + if (result != MA_SUCCESS) { printf("Failed to start playback device.\n"); - result = -1; goto done; } diff --git a/examples/hilo_interop.c b/examples/hilo_interop.c index 4a82f89d..ea115660 100644 --- a/examples/hilo_interop.c +++ b/examples/hilo_interop.c @@ -46,7 +46,7 @@ void capture_data_callback(ma_device* pDevice, void* pFramesOut, const void* pFr } /* Copy the data from the capture buffer to the ring buffer. */ - ma_copy_pcm_frames(pMappedBuffer, ma_offset_pcm_frames_const_ptr_f32(pFramesIn, framesWritten, pDevice->capture.channels), framesToWrite, pDevice->capture.format, pDevice->capture.channels); + ma_copy_pcm_frames(pMappedBuffer, ma_offset_pcm_frames_const_ptr_f32((const float*)pFramesIn, framesWritten, pDevice->capture.channels), framesToWrite, pDevice->capture.format, pDevice->capture.channels); result = ma_pcm_rb_commit_write(&rb, framesToWrite); if (result != MA_SUCCESS) { diff --git a/examples/resource_manager_advanced.c b/examples/resource_manager_advanced.c index 25b37e78..292aa99e 100644 --- a/examples/resource_manager_advanced.c +++ b/examples/resource_manager_advanced.c @@ -110,7 +110,7 @@ MA_API ma_result ma_data_source_read_pcm_frames_and_mix_f32(ma_data_source* pDat result = ma_data_source_read_pcm_frames_f32_ex(pDataSource, temp, framesToRead, &framesJustRead, format, channels); - ma_mix_pcm_frames_f32(ma_offset_pcm_frames_ptr(pFramesOut, totalFramesRead, ma_format_f32, channels), temp, framesJustRead, channels, volume); + ma_mix_pcm_frames_f32(ma_offset_pcm_frames_ptr_f32(pFramesOut, totalFramesRead, channels), temp, framesJustRead, channels, volume); totalFramesRead += framesJustRead; if (result != MA_SUCCESS) {