pheromone-party
Member
Hello!
I'm working on a project that includes writing a custom library object and I've hit a bit of a wall in my understanding of how the library works.
The thing that's confusing me at the moment are these lines in the effect_multiply.cpp file:
As far as I understand, 'pa' is a pointer to the 'data' variable (array?) of a block. I would understand if 'end' was just set to the length of that array, as then the loop would just move through each value before exiting. But why add AUDIO_BLOCK_SAMPLES? And why divide by 2?
Ultimately, I think my question might stem from some confusion about how audio_block_t works and the way it relates to the update function of the objects. At the moment, I'm seeing it as a buffer that gets called, read-through, modified and output once per update cycle. So any loops within the update cycle would be reading through the individual samples of the buffer. Is this correct? If so, how does it relate to lines I posted above?
Sorry if this is an obvious question! I'm taking my first steps with 'proper' C++ here, so there's a few bits of knowledge I might be missing.
Thanks a lot x
I'm working on a project that includes writing a custom library object and I've hit a bit of a wall in my understanding of how the library works.
The thing that's confusing me at the moment are these lines in the effect_multiply.cpp file:
Code:
end = pa + AUDIO_BLOCK_SAMPLES/2;
while (pa < end) {
As far as I understand, 'pa' is a pointer to the 'data' variable (array?) of a block. I would understand if 'end' was just set to the length of that array, as then the loop would just move through each value before exiting. But why add AUDIO_BLOCK_SAMPLES? And why divide by 2?
Ultimately, I think my question might stem from some confusion about how audio_block_t works and the way it relates to the update function of the objects. At the moment, I'm seeing it as a buffer that gets called, read-through, modified and output once per update cycle. So any loops within the update cycle would be reading through the individual samples of the buffer. Is this correct? If so, how does it relate to lines I posted above?
Sorry if this is an obvious question! I'm taking my first steps with 'proper' C++ here, so there's a few bits of knowledge I might be missing.
Thanks a lot x