buffer question

Sep 24, 2010 at 4:13pm

buffer question

I am recording to 8 buffers in a patch and I have send them a clear message followed by a size 20000 message when I needed to delete them.
The size message is necessary because am cropping the first to the actual length and then resizing the 7 others to this size before recording to them.

This has worked great but I was wondering if it is the most CPU & thread efficient way of doing it.

Would it be enough if I just sended a size message since it is also somhow deleting the buffer ?

I have a feeling that the clear message is more heavy since it it is setting all the samples to zero.

Thanks,

Thomas

#52454
Sep 25, 2010 at 8:45am

Hello Thomas Sandberg,

I often do this kind of [cpuclock] test when i want to know how long time a process need ; that’s an easy way to get an idea about the CPU cost, almost in _max_ world (actually i do not use _MSP_ so much) … and it seems add “clearlow” message after/before “size” one is not heavy (but IMHO useless) ;

while “clear” message crash my macbook (10.4.11 / 5.1.5) ;-)

– Pasted Max Patch, click to expand. –
#188635
Sep 26, 2010 at 7:58pm

Thanks a lot for the test patch. I look forward to explore and test

I have omitted the clear message and use only the size 20000 message – and it works perfect.

But I am still wondering what the difference between “size” and “clear” is corewise. In the reference is says that “clear” is writing zeros to the buffer – but what is “size” really doing ? Is it also writing zeros or is it just removing the pointer to the sample array ?
Because then it might be more cpu gentle !!

thomas

#188636
Sep 27, 2010 at 8:35am

Hello Thomas Sandberg,

IMHO : “Size” just free the pointer and get another one with good size ; it might be a “_resizeptrclear” as samples seems to be zeroed ; but whitout the C code nothing is sure …

#188637

You must be logged in to reply to this topic.