New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Buffer:-query unexpectedly causes Buffer instance vars to be updated #6215
Comments
Deleted one message bc it was wrong. Buffer.new does not allocate in the server, so there is nothing to In general, Buffer.new should not be used because it results in a language-side object with no server-side referent. Buffer.alloc is the standard way. So I think the help example needs to be updated. |
I agree For example,
I made some related updates to docs in this PR that explains some of the gotchas related to the the mirrored lang/server objects and |
Revisiting this after working on the PR linked above makes me realize why this breaks... b = Buffer.new(s, 44100 * 8.0, 2);
-> Buffer(0, 352800.0, 2, 48000.0, nil) // lang-side state A call to b.query;
-> Buffer(0, 352800.0, 2, 48000.0, nil)
bufnum: 0
numFrames: 0
numChannels: 0
sampleRate: 0.0 so following this with a call to This is an unintended side-affect of the action of the OSC responders stored in buffer's entry in the |
I realized this later -- good catch. But: Why would one set up a Buffer object with |
Before this side effect was introduced, it would have been an illustrative example, but now... not so much. I'll remove it as part of the related PR I linked above. I'll update the name to reflect the new understanding of the problem: |
Update
The issue subsequently was clarified, see below.
In short, a side affect of calling
-query
is that Buffer's lang-side instance variables are updated, which was not the intention of the original implementation.If/when this is resolved, various warnings and clarifications added by this PR can be removed or updated.
Steps to reproduce
The behavior is observable using the code snippet in
Buffer:-alloc
help doc:Expected vs. actual behavior
Buffer should be allocated (fails in 3.13), the the state should be accurately returned when queried (not sure what the full query results should be for an nonallocated buffer).
It seems that either the buffer isn't allocated (3.12.2), the state isn't properly set, and/or
query
is returning erroneous results.SC 3.12.2 release
SC 3.13 release
I don't have time to dig deeper into the issue atm, but the problem seems specific to the instance method because
Buffer:*alloc
appears to be working fine:The text was updated successfully, but these errors were encountered: