>Looks like JH has answered your main issue. Regarding s.bind, remember
>what it does: it colllects together all the OSC messages that your
>function creates, and bundles them all off once the function has
>completed. So it's illogical to use s.sync inside an s.bind, because
>the OSC message sent out by s.sync won't be sent until the function
>has completed, yet s.sync won't let the function complete until it's
>heard a reply back...
no, this is not correct. A sync inside a bind will separate the
bundles and automatically send the second part when the first is
received.
So it should work, I don't know why it wouldn't.
Take a look into the BundleNetAddr, maybe there is aome way to query
your intermediate state.
>Dan
>
>
>2008/7/20 thor <
th.list@...>:
>>
>> Hi all
>> I need to crop a buffer. That's not straight forward in SC because of memory
>> allocation on the buffer and such, so I'm wondering if the following is the
>> best
>> way to do this? Has anyone got a better method?
>> But there are also some problems. See my comments.
>> PS. I need the cropped buffer to have the same bufnum as the original
>> buffer.
>> cheers
>> thor
>>
>> (
>> Routine.run {
>> var cond;
>> cond = Condition.new;
>>
>> // original buffer
>> b = Buffer.read(s, "sounds/a11wlk01.wav");
>> "b.bufnum is: ".post; b.bufnum.postln;
>> s.sync(cond);
>> // temp buffer used in copying
>> c = Buffer.alloc(s, 88864, b.numChannels);
>> s.sync(cond);
>> b.copyData(c, 0, 100000, 88864); // my cropping
>> n = b.bufnum; // getting b's bufnum
>> s.sync(cond);
>> b.free;
>>
>> // cropped buffer with b's bufnum
>> d = Buffer.alloc(s, c.numFrames, c.numChannels, bufnum:n);
>> s.sync(cond);
>> c.copyData(d);
>> s.sync(cond);
>> c.free;
>> \cropping_DONE.postln;
>> };
>> )
>>
>> d.play // is the new buffer there? yes
>> d.bufnum // and it has the b.bufnum
>> c.postln;
>> c.play // c is freed. That's good.
>> c.bufnum
>> b.play // but I thought I'd freed b?
>> b.bufnum // and now b and d share same bufnum !!!
>> d.postln;
>> b.postln;
>> // and now I could do d.write(b...path) and I've changed the file forever
>> (I'll not do that to your file)
>>
>>
>>
>> // I remember Julian telling me about s.bind once, but this doesn't work:
>> // Should it not?
>> (
>> s.bind({
>> b = Buffer.read(s, "sounds/a11wlk01.wav");
>> "b.bufnum is: ".post; b.bufnum.postln;
>> s.sync;
>> // temp buffer used in copying
>> c = Buffer.alloc(s, 88864, b.numChannels);
>> s.sync;
>> b.copyData(c, 0, 100000, 88864); // my cropping
>> n = b.bufnum; // getting b's bufnum
>> s.sync;
>> b.free;
>> s.sync;
>>
>> // cropped buffer with b's bufnum
>> d = Buffer.alloc(s, c.numFrames, c.numChannels, bufnum:n);
>> s.sync;
>> c.copyData(d);
>> s.sync;
>> c.free;
>> })
>> )
>> d.play
>>
>
>
>
>--
>
http://www.mcld.co.uk>
>_______________________________________________
>sc-users mailing list
>
>info (subscribe and unsubscribe):
>
http://swiki.hfbk-hamburg.de:8888/MusicTechnology/880>archive:
http://www.listarc.bham.ac.uk/marchives/sc-users/>search:
http://www.listarc.bham.ac.uk/lists/sc-users/search/--
.
_______________________________________________
sc-users mailing list
info (subscribe and unsubscribe):
http://swiki.hfbk-hamburg.de:8888/MusicTechnology/880archive:
http://www.listarc.bham.ac.uk/marchives/sc-users/search:
http://www.listarc.bham.ac.uk/lists/sc-users/search/