Hi,
In the code below, the first loop is OK whilst the second one crashes on little endian platforms (at line 209 in juce_AudioDataConverters.h). Is there a good reason for that ?
This phenomena occurs in juce_linux_ALSA, causing crashes (line 327 in juce_linux_ALSA.cpp) when the device is non-interleaved (the AudioData::Converter is always created with AudioData::Interleaved as destination format, which I believe is the origin of the issue).
My workaround is too pass the ‘isInterleaved’ flag up to the createConverter functions (around lines 396). Could you please have a look at that ?
And while we’re here: the maximum number of channels is restricted to 32 (line 78 in juce_linux_ALSA.cpp), which is annoying. RME cards have 192 channels and they are well supported in ALSA (that’s the one I’m using at the moment). So, could you please remove the limitation in line 78 (or maybe make something like 256 instead of 32).
Thanks in advance
const unsigned int numChannels = 2;
const unsigned int numSamples = 512;
AudioSampleBuffer buffer( numChannels, numSamples );
float* const* const data = buffer.getArrayOfWritePointers();
for (unsigned int i = 0; i < numChannels; ++i)
{
jassert( data[i] != nullptr );
AudioDataConverters::convertFloatToInt32LE( data[i], data[i], numSamples );
}
typedef AudioData::Pointer <AudioData::Float32, AudioData::LittleEndian, AudioData::NonInterleaved, AudioData::Const> SourceType;
typedef AudioData::Pointer <AudioData::Int32, AudioData::LittleEndian, AudioData::Interleaved, AudioData::NonConst> DestType;
AudioData::ConverterInstance < SourceType, DestType > converter ( 1, numChannels );
for (unsigned int i = 0; i < numChannels; ++i)
{
jassert( data[i] != nullptr );
converter.convertSamples( data[i], data[i], numSamples );
}