dsp::AudioBlock
is really great since nearly everything I want to do with it works the same for SIMD data types as it does for scalar types. One notable exception is the copyFrom()
function. Quite often, I run into a situation like this:
template <typename SampleType>
class MyProcessor
{
...
template <typename ProcessContext, Type type>
void process (const ProcessContext& context) noexcept
{
const auto& inputBlock = context.getInputBlock();
auto& outputBlock = context.getOutputBlock();
if (context.isBypassed)
{
outputBlock.copyFrom (inputBlock);
return;
}
...
}
};
Then, if I try to use an instance of MyProcessor<dsp::SIMDRegister<float>>
, I end up with an error like this:
JUCE\modules\juce_dsp\containers/juce_AudioBlock.h(592,1) error C2440: 'reinterpret_cast': cannot convert from 'SampleType *' to 'float *'
with
[
SampleType=const juce::dsp::SIMDRegister<float>
]
For now I’ve implemented my own copy operation as a work-around, but it would really nice if copyFrom()
just worked out-of-the-box.