From 0bd662b2d7fc11c0b4c02372f97cf6062940c570 Mon Sep 17 00:00:00 2001 From: JP Cimalando Date: Tue, 10 Apr 2018 12:55:03 +0200 Subject: support for 32 bit mixing, and multiple sample formats --- src/adlmidi_private.hpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/adlmidi_private.hpp') diff --git a/src/adlmidi_private.hpp b/src/adlmidi_private.hpp index caaf4f9..63cadb3 100644 --- a/src/adlmidi_private.hpp +++ b/src/adlmidi_private.hpp @@ -131,6 +131,25 @@ typedef int32_t ssize_t; extern std::string ADLMIDI_ErrorString; +/* + Sample conversions to various formats +*/ +template +inline Real adl_cvtReal(int32_t x) +{ + return x * ((Real)1 / INT16_MAX); +} +inline int32_t adl_cvtS16(int32_t x) +{ + x = (x < INT16_MIN) ? INT16_MIN : x; + x = (x > INT16_MAX) ? INT16_MAX : x; + return x; +} +inline int32_t adl_cvtS8(int32_t x) +{ + return adl_cvtS16(x) / 256; +} + /* Smart pointer for C heaps, created with malloc() call. FAQ: Why not std::shared_ptr? Because of Android NDK now doesn't supports it @@ -909,7 +928,7 @@ public: #endif OPL3 opl; - int16_t outBuf[1024]; + int32_t outBuf[1024]; Setup m_setup; -- cgit v1.2.3