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

Re: [Sc-devel] Serious bugs in Buffer :loadCollection and :sendCollection



OK, committed.

Dan

2008/2/4, Dan Stowell <danstowell@xxxxxxxxx>:
> Hi -
>
> First the mildest bug: Buffer:loadCollection or :sendCollection warns
> if the collection is bigger than the buffer can hold - but it doesn't
> take account of multichannel, so it can easily print unwarranted
> warnings if your buffer is not mono.
>
> While looking at this I found more serious problems. sendCollection's
> second argument should be the start *frame*, but its effect is to set
> the start *sample*. Watch it go wrong:
>
> q = Buffer.alloc(s, 10, 4); // Quadraphonics
> q.zero;
> q.plot; // empty, yes? good
>
> // "5" here should be the start frame, so this 4-value array should
> set one full frame
> q.sendCollection([0.2, 0.4, 0.6, 0.8], 5);
> // But it's actually the start sample, so the array is spread over 2 frames
> q.plot;
>
> // Try it with loadCollection instead, this time frame-alignment is as expected
> q.zero
> q.loadCollection([0.2, 0.4, 0.6, 0.8], 5);
> q.plot;
>
>
>
> Oh and another problem. Buffer.sendCollection (i.e. the class-method
> not the instance-method) mishandles multichannel too:
>
> // Let's create a 2-channel buffer, with 6 samples.
> // Therefore 3 frames, yes?
> t = Buffer.sendCollection(s, [0.2, 0.4, 0.6, 0.8, 1.0, 0.8], 2);
> // No:
> t.plot
> t.numFrames
>
>
> Patch attached should fix this (run "patch -p4 < patchBuffer.patch"),
> not committing it yet though since we're in RC stages ;) However,
> either I'm going mad or these are quite significant problems (and I
> don't understand why they haven't been found before). Thoughts?
>
> Dan
>
>


-- 
http://www.mcld.co.uk