Skip to content

Commit

Permalink
fix: Added support for AudioBlockView changes to dsp modules (delay, …
Browse files Browse the repository at this point in the history
…PCM).
  • Loading branch information
AkiyukiOkayasu committed Dec 16, 2021
1 parent a13b358 commit ff3859b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
11 changes: 5 additions & 6 deletions include/ame_Delay.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,19 @@ class Delay
}

/// Process audio effect.
template <typename SampleType>
void process (AudioBlockView<SampleType>& block)
template <typename SampleType, size_t N>
void process (AudioBlockView<SampleType, N>& block)
{
assert (block.getNumChannels() <= MaximumChannels);

auto buffer = block.getWritePointer();
uint_fast32_t i = 0;
for (uint_fast32_t samp = 0; samp < block.getNumSamples(); ++samp)
for (uint_fast32_t samp = 0; samp < block.getNumSamplesPerChannel(); ++samp)
{
for (uint_fast32_t ch = 0; ch < block.getNumChannels(); ++ch)
{
const float input = buffer[i];
const float input = block.view[i];
delayLine[ch][writePos.get()] = input;
buffer[i] = lerp (delayLine[ch][readPos.get()], delayLine[ch][readPos.get (-1)], fractional);
block.view[i] = lerp (delayLine[ch][readPos.get()], delayLine[ch][readPos.get (-1)], fractional);
++i;
}
++readPos;
Expand Down
9 changes: 5 additions & 4 deletions include/ame_Pcm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@ class WavPlayer
@tparam FloatType float or double
@param block dest
*/
template <typename FloatType>
void process (AudioBlockView<FloatType>& block)
template <typename FloatType, size_t N>
void process (AudioBlockView<FloatType, N>& block)
{
if (playing.load() == false)
{
Expand All @@ -298,7 +298,8 @@ class WavPlayer
case fmt::wFormatTag::PCM:
{
auto offset = (bitRate / 8) * numChannels * readPosition.load();
for (uint_fast32_t samp = 0; samp < block.getNumSamples(); ++samp)
const auto nSamp = block.getNumSamplesPerChannel();
for (uint_fast32_t samp = 0; samp < nSamp; ++samp)
{
if (readPosition + samp >= numSamples)
{
Expand All @@ -320,7 +321,7 @@ class WavPlayer
block.addSample (ch, samp, s);
}
}
readPosition += block.getNumSamples();
readPosition += nSamp;
break;
}
case fmt::wFormatTag::ImaAdpcm:
Expand Down

0 comments on commit ff3859b

Please sign in to comment.