Here’s a patch to the audio file I/O classes to add support for:
- Many (> 2) channel audio files
- audio I/O to/from floating-point sample buffers.
There are typedefs in juce_AudioFormatReader.h for the following,
// These are taken from CSL - STP changes
typedef float sample; ///< short-hand for the base sample type (could be changed to double)
typedef sample* SampleBuffer; ///< 1-channel buffer data type – vector of (sample)
typedef SampleBuffer* SampleBufferArray; ///< Multi-channel buffer data type – vector of (sample *)
The new I/O calls in the audio format read/write objects look like,
bool readSamples (SampleBufferArray destSamples,
int numDestChannels, int startOffsetInDestBuffer,
int64 startSampleInFile, int numSamples);
bool write (SampleBufferArray data, int numSamples);
I include support for AIFF and WAV files as well as the CD and QT read/write objects.
I’ve tested it a bit in a few apps (like a sampler that reads 10-channel drum samples).
The files are at,
http://FASTLabInc.com/JUCE-audio-patch.txt.zip (just the diffs)
http://FASTLabInc.com/JUCE-audio-stp-new-code.tgz (the changed audio io files)
The diffs are relative to a month-old SVN check-out of JUCE.
Comments are invited…