mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-20 22:48:05 +02:00
Add documentation
Signed-off-by: Emily Mabrey <emabrey@tenacityaudio.org>
This commit is contained in:
parent
d7695f3c91
commit
68daa33bf1
@ -5,6 +5,11 @@
|
|||||||
#include "../libraries/lib-utility/MemoryX.h"
|
#include "../libraries/lib-utility/MemoryX.h"
|
||||||
#include <string>
|
#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
|
class AudioIOBufferHelper
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -26,7 +31,8 @@ class AudioIOBufferHelper
|
|||||||
|
|
||||||
|
|
||||||
tempBufs[0] = safenew float[(size_t)numPlaybackChannels * framesPerBuffer];
|
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++) {
|
for (unsigned int c = 1; c < numPlaybackChannels; c++) {
|
||||||
tempBufs[c] = tempBufs[c - 1] + framesPerBuffer;
|
tempBufs[c] = tempBufs[c - 1] + framesPerBuffer;
|
||||||
|
@ -4,6 +4,11 @@
|
|||||||
#include "../libraries/lib-utility/MemoryX.h"
|
#include "../libraries/lib-utility/MemoryX.h"
|
||||||
#include <string>
|
#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
|
class RealtimeEffectBufferHelper
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -19,7 +24,6 @@ class RealtimeEffectBufferHelper
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Allocate the in/out buffer arrays
|
|
||||||
float** ibuf;
|
float** ibuf;
|
||||||
float** obuf;
|
float** obuf;
|
||||||
float* temp;
|
float* temp;
|
||||||
@ -29,10 +33,9 @@ class RealtimeEffectBufferHelper
|
|||||||
this->chans = chans;
|
this->chans = chans;
|
||||||
this->numSamples = numSamples;
|
this->numSamples = numSamples;
|
||||||
|
|
||||||
// Allocate the in/out buffer arrays
|
// Allocate the in/out buffers
|
||||||
ibuf = safenew float* [chans];
|
ibuf = safenew float* [chans];
|
||||||
obuf = safenew float* [chans];
|
obuf = safenew float* [chans];
|
||||||
temp = safenew float[numSamples];
|
|
||||||
|
|
||||||
const size_t memcpy_size = (size_t)numSamples * chans * sizeof(float);
|
const size_t memcpy_size = (size_t)numSamples * chans * sizeof(float);
|
||||||
|
|
||||||
@ -42,16 +45,19 @@ class RealtimeEffectBufferHelper
|
|||||||
memset(ibuf[0], 0, memcpy_size);
|
memset(ibuf[0], 0, memcpy_size);
|
||||||
memset(obuf[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++) {
|
for (unsigned int i = 1; i < chans; i++) {
|
||||||
ibuf[i] = ibuf[i - 1] + numSamples;
|
ibuf[i] = ibuf[i - 1] + numSamples;
|
||||||
obuf[i] = obuf[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++) {
|
for (size_t j = 0; j < chans; j++) {
|
||||||
memcpy(ibuf[j], buffers[j], (size_t)numSamples * sizeof(float));
|
memcpy(ibuf[j], buffers[j], (size_t)numSamples * sizeof(float));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Allocate a temp buffer
|
||||||
|
temp = safenew float[numSamples];
|
||||||
}
|
}
|
||||||
|
|
||||||
~RealtimeEffectBufferHelper() {
|
~RealtimeEffectBufferHelper() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user