Skip to content
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

Merged
merged 2 commits into from
Aug 5, 2017

Conversation

vivid-synth
Copy link
Member

(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?)

@nhthn nhthn added the comp: class library SC class library label Dec 10, 2016
@@ -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,
Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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.)

@telephon
Copy link
Member

telephon commented May 5, 2017

I think it's fine for now.

@mossheim
Copy link
Contributor

mossheim commented Jul 20, 2017

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?

@mossheim mossheim merged commit a28de85 into supercollider:master Aug 5, 2017
@mossheim
Copy link
Contributor

mossheim commented Aug 5, 2017

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp: class library SC class library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants