-
Notifications
You must be signed in to change notification settings - Fork 757
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
Allow Buffer.write to send float arguments in place of ints #2547
Conversation
@@ -341,7 +341,7 @@ Buffer { | |||
startFrame = 0, leaveOpen = false, completionMessage; | |||
// doesn't change my path | |||
^["/b_write", bufnum, path, | |||
headerFormat, sampleFormat, numFrames, startFrame, | |||
headerFormat, sampleFormat, numFrames.asInt, startFrame.asInt, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not asInteger
? asInt
is more or less legacy AFAIK.
I wonder in general: are there other places we'd need to do the same? This may end up in a lot of overhead in sclang for messages that are sent in large numbers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But, in general I'd prefer first to have a discussion about the int vs float scsynth API. I don't think that we should have to add asInteger
all over the place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the conversion on the language side is appropriate. scsynth should not have to worry about conversing with messy untyped languages. I think it should not be responsible for doing conversions. OSC is typed and that is a good thing. (just my 2c. I'm on a static typing binge lately. it really makes life better.)
I think it's fine for now. |
I've reread the discussion at #1827 and this seems to be a good solution, both in my opinion and in the slight consensus reached in that thread. Since there was no link to the dev-list discussion there, I don't know if broader consensus was reached off-GH. @carlocapocasa @vivid-synth @telephon @Sciss , any opposition to merging this now? |
sorry, almost forgot about this one. I took the thumbs-up on my previous comment (and silence in response to the pings) as agreement to merging; if someone disagrees please speak up :) |
(Related to #1827 )
/b_write
expects an int argument but users may end up passing in another type of number.Regardless of if we allow scsynth to cast float inputs, we should also fix where sclang is sending the wrong thing.
(Note also
3.99999.asInt == 4
: maybe.round
is better?)