The workspace buffers in
GranularProcessor are for recording audio, they don’t have anything to do with reading from/writing to the codec.
- The DMA controller handles transfers from/to the codec, and this happens in the following buffers:
Codec:: tx_dma_buffer_ and ```Codex:: rx_dma_buffer_````.
- Whenever we start transmitting/receiving one half of the buffer, we call whatever function is pointed at
FillBufferCallback and give it a pointer to the other half of the buffer, so that it is processed. That’s classic double buffering. Practically,
FillBufferCallback points to
FillBuffer does a couple of things (handling the VU-meter, reading CVs), then passes these pointers to
GranularProcessor::Process for the actual cloudsing.
- At this point, the samples go through a fairly involved list of steps (stereo to mono mixing, mixing with the feedback signal, possibly some downsampling when the quality setting is set to half-sample-rate, granularization, diffusion, pitch-shifting, filtering, reverb). But we don’t really care about the original DMA buffers – we immediately read from them and convert the data to floats; and in the end whatever floats we have are converted back to integers and stuffed into the DMA buffers.
If the “buffer” you’re concerned with is the granularization buffer, look into
GranularProcessor::ProcessGranular. You’ll see that the input samples are first recorded in the granular buffer (
buffer_16_[i].WriteFade), and then, depending on the playback mode, various parts of this buffer are read in complicated ways (typically
player_.Play(buffer_16_, parameters_, &output.l, size);).