1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-29 23:29:41 +02:00

Add documentation

Signed-off-by: Emily Mabrey <emabrey@tenacityaudio.org>
This commit is contained in:
Emily Mabrey 2021-08-10 23:15:59 -04:00
parent d7695f3c91
commit 68daa33bf1
No known key found for this signature in database
GPG Key ID: 6F4EF47256A1B7DC
2 changed files with 18 additions and 6 deletions

View File

@ -5,6 +5,11 @@
#include "../libraries/lib-utility/MemoryX.h"
#include <string>
/**
\class AudioIOBufferHelper
\brief AudioIOBufferHelper is a class that hides the implementation details of exactly how buffers are allocated and managed
when they are used inside of the PortAudio callback in AudioIO.
**/
class AudioIOBufferHelper
{
@ -26,7 +31,8 @@ class AudioIOBufferHelper
tempBufs[0] = safenew float[(size_t)numPlaybackChannels * framesPerBuffer];
memset(tempBufs[0], 0, (size_t)numPlaybackChannels * (size_t)framesPerBuffer * sizeof(float));
const auto tempBufs_size = (size_t)numPlaybackChannels * (size_t)framesPerBuffer * sizeof(float);
memset(tempBufs[0], 0, tempBufs_size);
for (unsigned int c = 1; c < numPlaybackChannels; c++) {
tempBufs[c] = tempBufs[c - 1] + framesPerBuffer;

View File

@ -4,6 +4,11 @@
#include "../libraries/lib-utility/MemoryX.h"
#include <string>
/**
\class RealtimeEffectBufferHelper
\brief RealtimeEffectBufferHelper is a class that hides the implementation details of exactly how buffers are allocated and managed
when they are used inside of the real-time effect processing chain.
**/
class RealtimeEffectBufferHelper
{
@ -19,7 +24,6 @@ class RealtimeEffectBufferHelper
public:
// Allocate the in/out buffer arrays
float** ibuf;
float** obuf;
float* temp;
@ -29,10 +33,9 @@ class RealtimeEffectBufferHelper
this->chans = chans;
this->numSamples = numSamples;
// Allocate the in/out buffer arrays
// Allocate the in/out buffers
ibuf = safenew float* [chans];
obuf = safenew float* [chans];
temp = safenew float[numSamples];
const size_t memcpy_size = (size_t)numSamples * chans * sizeof(float);
@ -42,16 +45,19 @@ class RealtimeEffectBufferHelper
memset(ibuf[0], 0, memcpy_size);
memset(obuf[0], 0, memcpy_size);
// Allocate new output buffers and copy buffer input into newly allocated input buffers
// Do pointer arithmetic to fully setup input and output buffers
for (unsigned int i = 1; i < chans; i++) {
ibuf[i] = ibuf[i - 1] + numSamples;
obuf[i] = obuf[i - 1] + numSamples;
}
// Copy given buffer data into the input buffer
for (size_t j = 0; j < chans; j++) {
memcpy(ibuf[j], buffers[j], (size_t)numSamples * sizeof(float));
}
// Allocate a temp buffer
temp = safenew float[numSamples];
}
~RealtimeEffectBufferHelper() {