From the original SynthMaker forum (2004–2014), with its members’ names and dates.
angstrom ·
Hi all,
how do I drop a buffer in code
imagine I have something like this
float mem[44100];// heres a buffer
mem[index] = in;
index = index + 1;
index = (index<delaylength)&index;
out = mem[index];
I tried adding a green bool into a mono in called 'drop' and then a few variations on this kind of thing.
mem = (drop==1) & mem;
no joy though, in fact it really doesn't like that!
so go on - let me in on the secret of deleteing a buffer and starting again.
🙂
sambean ·
Could be your bool input?
Try converting it to float first, or change the line to (drop>0)&mem
Cheers
Sam
angstrom ·
thanks sam,
I tried an int and then a float conversion before I posted, I should have said it was actuallya float in of 0 or 1 rather than a true bool type.
anyway, adding anything with a mem reset in just stops the code.
Without the mem reset -
There is a counter in the code that drives a position bar, attaching a mono to float an t25 fives me a green counter from the code module. I can see the numbers counting up usually.
But, as soon as I try to add a reset on the mem[] ..
mem = ( anything) & mem;
the counter stops and all audio function from the code module fails.
I have tried other variations on the reset, but as the mem is an array it doesn't want to play by the rules of varibles, it seems.
stefan ·
Uhm... if mem is the actual array pointer you set the pointer to zero, and hence loose the actual reference to the memory you're using when you do mem = 0. That can't be what you want to do?
Is this in a mono section? If so, the best way to reset the memory is probably to disconnect this module from the section and then reconnect it. Atleast I think that should work.
angstrom ·
mem is the array name, index is the pointer.
roughly:
float mem[352800];
float index;
stage(1){
mem[index] = in;
index = index + 1;
mem = (drop>0) & mem;
index = (index<delay)&index;
out = mem[index];
}
I'm remaking my Angstrolooper, which was built in SE
Download VST installer
which has a problem when you 'drop' or reset the buffer that there is a nasty CPU spike and an audio ka-thunk as the chain is re-processed. (drop is the icon with the circle and strike through )
I am guessing that If I disconnect and re-connect the code module I will get the same nasty effect, I'll give it a try though.
stefan ·
index is not a pointer. index is an index. mem is an pointer.
when you set the mem variable to zero, you lose the pointer to the memory you created for the array, and hence you have no access to the array any longer. You can't do mem = 0 when you want to reset the _content_ in the array to zero, because what you do is that you actually sets the pointer to the array to zero. And hence, renders it unusable.
angstrom ·
right, OK - a terminology mix-up there, but that's what I thought. I was thinking of array and float as types rather than pointers.
I had a quick go at the disconnecting solution: using a Select on the audio output .
Unfortunately that didnt empty the buffer, it just temporarily cut the audio out. The buffer was still full of audio.
stefan ·
angstrom wrote: right, OK - a terminology mix-up there, but that's what I thought. I was thinking of array and float as types rather than pointers.
I had a quick go at disconnecting - using a select on the audio output . Unfortunately that didnt empty the buffer.
Ok. I was expecting it to. And I think that it should work like that, but since it doesn't I don't have any decent work-around for you. Sorry.
Wrote something here? To have a post removed or your name hidden, write to [email protected].