From adf2812d5741aa20eda37deeb6cfd9d335b26f2a Mon Sep 17 00:00:00 2001 From: Giulio Moro Date: Fri, 2 Feb 2024 22:52:09 +0000 Subject: [PATCH 1/2] Fixed MY_TYPE for RTAUDIO_SINT32 so that it's int32_t as `long` is 64-bit on some 64-bit systems Closes https://github.com/thestk/rtaudio/issues/420 --- tests/duplex.cpp | 2 +- tests/playsaw.cpp | 2 +- tests/record.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/duplex.cpp b/tests/duplex.cpp index 1257eea5..24609f88 100644 --- a/tests/duplex.cpp +++ b/tests/duplex.cpp @@ -25,7 +25,7 @@ typedef signed short MY_TYPE; typedef S24 MY_TYPE; #define FORMAT RTAUDIO_SINT24 -typedef signed long MY_TYPE; +typedef int32_t MY_TYPE; #define FORMAT RTAUDIO_SINT32 typedef float MY_TYPE; diff --git a/tests/playsaw.cpp b/tests/playsaw.cpp index c23163ef..ddef6689 100644 --- a/tests/playsaw.cpp +++ b/tests/playsaw.cpp @@ -28,7 +28,7 @@ typedef S24 MY_TYPE; #define FORMAT RTAUDIO_SINT24 #define SCALE 8388607.0 -typedef signed long MY_TYPE; +typedef int32_t MY_TYPE; #define FORMAT RTAUDIO_SINT32 #define SCALE 2147483647.0 diff --git a/tests/record.cpp b/tests/record.cpp index c5f9cb51..5bd56186 100644 --- a/tests/record.cpp +++ b/tests/record.cpp @@ -27,7 +27,7 @@ typedef signed short MY_TYPE; typedef S24 MY_TYPE; #define FORMAT RTAUDIO_SINT24 -typedef signed long MY_TYPE; +typedef int32_t MY_TYPE; #define FORMAT RTAUDIO_SINT32 typedef float MY_TYPE; From 422d8b81b61bb4b261a36b4b7e3877f73fb5bef3 Mon Sep 17 00:00:00 2001 From: Giulio Moro Date: Fri, 2 Feb 2024 22:53:40 +0000 Subject: [PATCH 2/2] Use fixed-width integer types for MY_TYPE in examples for clarity and future compatibility --- tests/duplex.cpp | 4 ++-- tests/playraw.cpp | 6 +++--- tests/playsaw.cpp | 4 ++-- tests/record.cpp | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/duplex.cpp b/tests/duplex.cpp index 24609f88..1d680b0b 100644 --- a/tests/duplex.cpp +++ b/tests/duplex.cpp @@ -14,11 +14,11 @@ #include /* -typedef char MY_TYPE; +typedef int8_t MY_TYPE; #define FORMAT RTAUDIO_SINT8 */ -typedef signed short MY_TYPE; +typedef int16_t MY_TYPE; #define FORMAT RTAUDIO_SINT16 /* diff --git a/tests/playraw.cpp b/tests/playraw.cpp index 8a15a960..7f6ccc9b 100644 --- a/tests/playraw.cpp +++ b/tests/playraw.cpp @@ -16,12 +16,12 @@ #include /* -typedef char MY_TYPE; +typedef int8_t MY_TYPE; #define FORMAT RTAUDIO_SINT8 #define SCALE 127.0 */ -typedef signed short MY_TYPE; +typedef int16_t MY_TYPE; #define FORMAT RTAUDIO_SINT16 #define SCALE 32767.0 @@ -30,7 +30,7 @@ typedef S24 MY_TYPE; #define FORMAT RTAUDIO_SINT24 #define SCALE 8388607.0 -typedef signed int MY_TYPE; +typedef int32_t MY_TYPE; #define FORMAT RTAUDIO_SINT32 #define SCALE 2147483647.0 diff --git a/tests/playsaw.cpp b/tests/playsaw.cpp index ddef6689..ee61f064 100644 --- a/tests/playsaw.cpp +++ b/tests/playsaw.cpp @@ -14,12 +14,12 @@ #include /* -typedef char MY_TYPE; +typedef int8_t MY_TYPE; #define FORMAT RTAUDIO_SINT8 #define SCALE 127.0 */ -typedef signed short MY_TYPE; +typedef int16_t MY_TYPE; #define FORMAT RTAUDIO_SINT16 #define SCALE 32767.0 diff --git a/tests/record.cpp b/tests/record.cpp index 5bd56186..06d398c9 100644 --- a/tests/record.cpp +++ b/tests/record.cpp @@ -16,11 +16,11 @@ #include /* -typedef char MY_TYPE; +typedef int8_t MY_TYPE; #define FORMAT RTAUDIO_SINT8 */ -typedef signed short MY_TYPE; +typedef int16_t MY_TYPE; #define FORMAT RTAUDIO_SINT16 /*