diff options
Diffstat (limited to 'src/adlmidi_private.hpp')
-rw-r--r-- | src/adlmidi_private.hpp | 21 |
1 files changed, 20 insertions, 1 deletions
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 @@ -132,6 +132,25 @@ typedef int32_t ssize_t; extern std::string ADLMIDI_ErrorString; /* + Sample conversions to various formats +*/ +template <class Real> +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; |