[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] Problem with buffer allocation



Ahhh now I see.
Thanks!

Ludvig

sc3.1 wrote:
don't forget to use {} inside the collect!

4.collect({Buffer.alloc(s,512,1)});

if you don't use {} then the code between the () is only evaluated once.

Jeff



On Jul 21, 2009, at 8:02 PM, Ludvig wrote:

Hello

I tried to allocate some buffers with this code...

4.collect(Buffer.alloc(s,512,1));

It works but all the buffers get the same bufnum. For each time I run the line I get a group of 4 buffers sharing the next number. If I boot the server and run this code:

4.do({
  4.collect(Buffer.alloc(s,512,1)).do({|b| b.bufnum.postln})
});

I get this in the post window:

0
0
0
0
1
1
1
1
2
2
2
2
3
3
3
3
4

It is pretty late so I am probably missing something trivial but I just can't figure out what. Any hints? I could just go [Buffer.alloc(s,512,1),...] of course but I really would like to understand why my code doesn't work.

Thanks,
Ludvig



_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/



_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/