diff options
author | JP Cimalando <jpcima@users.noreply.github.com> | 2018-06-07 07:21:29 +0200 |
---|---|---|
committer | JP Cimalando <jpcima@users.noreply.github.com> | 2018-06-08 00:24:39 +0200 |
commit | 7cfe4dbcef738681b5445aa14b35fc1a6f8ff001 (patch) | |
tree | 2a1bfd77d9a5759f566bed4834ce6721a301844d /src/chips/opl_chip_base.cpp | |
parent | d8142ef298fa4ce54a8dbf8977709b9209c148e6 (diff) | |
download | libADLMIDI-7cfe4dbcef738681b5445aa14b35fc1a6f8ff001.tar.gz libADLMIDI-7cfe4dbcef738681b5445aa14b35fc1a6f8ff001.tar.bz2 libADLMIDI-7cfe4dbcef738681b5445aa14b35fc1a6f8ff001.zip |
chips: create a common method set for generation and resampling
Diffstat (limited to 'src/chips/opl_chip_base.cpp')
-rw-r--r-- | src/chips/opl_chip_base.cpp | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/src/chips/opl_chip_base.cpp b/src/chips/opl_chip_base.cpp deleted file mode 100644 index 670a998..0000000 --- a/src/chips/opl_chip_base.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include "opl_chip_base.h" - -OPLChipBase::OPLChipBase() : - m_rate(44100) -{} - -OPLChipBase::OPLChipBase(const OPLChipBase &c): - m_rate(c.m_rate) -{} - -OPLChipBase::~OPLChipBase() -{} - -void OPLChipBase::setRate(uint32_t rate) -{ - m_rate = rate; -} - -void OPLChipBase::reset(uint32_t rate) -{ - setRate(rate); -} - -int OPLChipBase::generate32(int32_t *output, size_t frames) -{ - enum { maxFramesAtOnce = 256 }; - int16_t temp[2 * maxFramesAtOnce]; - for(size_t left = frames; left > 0;) { - size_t count = (left < static_cast<size_t>(maxFramesAtOnce)) ? left : static_cast<size_t>(maxFramesAtOnce); - generate(temp, count); - for(size_t i = 0; i < 2 * count; ++i) - output[i] = temp[i]; - left -= count; - output += 2 * count; - } - return (int)frames; -} - -int OPLChipBase::generateAndMix32(int32_t *output, size_t frames) -{ - enum { maxFramesAtOnce = 256 }; - int16_t temp[2 * maxFramesAtOnce]; - for(size_t left = frames; left > 0;) { - size_t count = (left < static_cast<size_t>(maxFramesAtOnce)) ? left : static_cast<size_t>(maxFramesAtOnce); - generate(temp, count); - for(size_t i = 0; i < 2 * count; ++i) - output[i] += temp[i]; - left -= count; - output += 2 * count; - } - return (int)frames; -} |