AVAudioPCMBuffer feature request discussion

I want to request a change to AVAudioPCMBuffer from Apple but I just wanted to rubber duck a little before submitting the request.


It seems to me that AVAudioPCMBuffer wraps AudioBufferList pretty well in everything but changing the mData pointers. Everything I need to change on a buffer I can do via AVAudioPCMBuffer except that. For that I have to get AVAudioPCMBuffer.mutableAudioBufferList then cast it with UnsafeMutableAudioBufferListPointer()

to then point the buffers at new memory.


I wish I could do that by doing

AVAudioPCMBuffer.floatChannelData[bufferIndex] = newPointer


"Where would I need this?" You say.


AURenderPullInputBlock needs a ABL with valid mData but may return the ABL pointing to its own mData, so then the next cycle I need to point it back at my valid mData.


How I have to do now:

        let mblp = UnsafeMutableAudioBufferListPointer(AVAudioPCMBuffer.mutableAudioBufferList)
        for index in 0 ..< mblp.count {
            mblp[index].mData = originalmData[index]
        }


How I would like it to be:

        for index in 0 ..< AVAudioPCMBuffer.format.channelCount {
            AVAudioPCMBuffer.floatChannelData[index] = originalmData[index]
        }



Any thoughts?