Try to make Buffer method arguments (numChannels, index, and numFrames-related arguments) consistent#7471
Conversation
numFrames and numChannels of Buffer.allocnumFrames and numChannels of Buffer.alloc
numFrames and numChannels of Buffer.alloc.asInteger to numFrames and numChannels of Buffer.alloc
|
Thanks for the PR!
|
Not at the moment, unfortunately. I may have run into similar problems in the past, but I did not file issues for them at the time, and I do not remember the specific cases well enough to list them now. So I do not currently have a comprehensive list of failing cases. When I took a closer look at the However, based on many parts of the While trying to improve the approach I described in my comment on issue #7462, I ran into a new error that I was not able to resolve, as described in the opening post of this PR. To keep this PR focused and easier to review, I decided not to include those broader changes here.
At the moment, this PR only fixes the error reproduced by the example code in #7462: // 6890.625 = 10 * 44100 / 64
b = Buffer.alloc(s, 6890.625, 10);
// actually, you don't need any data
a = { RecordBuf.ar(Array.fill(10, { WhiteNoise.ar }), b, loop: 0, doneAction: 2); Silent.ar(1) }.play;
b.getToFloatArray(wait: -1, timeout: 10, action: { |data| data.postln });If I get the chance, I would be happy to revisit the broader issue in a separate follow-up. I left many of the commits in place to show the steps I went through, the error I was not able to resolve, and the changes I had tried. However, I realise that this may have obscured what this PR actually fixes. Sorry about that. |
Got it! I think it would be good to trace this back and apply consistently where needed. Just leaving this comment here in case someone is able to pick this up. Let's keep this open for now, though eventually I'd prefer it is there was a comprehensive PR addressing all or most cases in the Buffer class. |
.asInteger to numFrames and numChannels of Buffer.allocnumChannels, index, and numFrames-related arguments) consistent
fixes #7462
Purpose and Motivation
I tried adding
.asIntegerin all possible places, but it produced the following error:After removing
.asIntegerfromBuffer.new, I was able to avoid this particular error. However, the same error still occurred when evaluating.free(an instance method ofBuffer).So, in the end, I applied this change only to
Buffer.alloc.Types of changes
To-do list