Patch: multi-channel audio files and floating-pt audio I/O


#1

Hello all,

Here’s a patch to the audio file I/O classes to add support for:

  1. Many (> 2) channel audio files

and

  1. 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);

and

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)

and

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… :wink:

Stephen Pope


#2

I just up-loaded new versions of these files to FASTLabInc.com after locating a squashing a minor bug.

stp


#3

Hi all,

I updated the files with the diffs relative to the 1.50 release.

stp