Re-mapping channels with AudioSampleBuffer class


I have a small suggestion for a new method for the AudioSamplerBuffer class. I see no easy way to change the order of the channels without any re-allocation, so could it be possible to add such a function which allows changing the order of elements of the channels array?

For example, if one wants to convert a 5.1 OggVorbis file into a FLAC one, the formats have different standards channel mapping for 5.1, it requires to convert L-C-R-Ls-Rs-Lfe into L-R-C-Lfe-Ls-Rs.


I'm not sure whether that class could re-map its channels internally without re-allocation, but you could create a new AudioSampleBuffer which takes an array of pointers into the channels of the original one and re-map them as needed, which would have very little overhead.