Add asInteger to numFrames & numChannels of Buffer.alloc & Buffer.getToFloatArray - #7472
Open
prko wants to merge 2 commits into
Conversation
asInteger to numFrames & numChannels of Buffer.alloc & Buffer.getToFloatArray
Contributor
Author
|
I would appreciate feedback on whether this PR could be merged after making the necessary changes, or if it should be closed due to a misunderstanding. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #7462
Purpose and Motivation
This PR resolves the error triggered by evaluating the following example code from #7462:
However, if this example code is not expected to throw an error without truncating
6890.625, then I have misunderstood the issue, and this PR should probably be closed.As far as I understand it, there are two possible ways to address the issue:
Add
.asIntegertovar countin thegetToFloatArraymethod.At the moment, the implementation applies
.asIntegerto(numFrames * numChannels), which may lead to an incorrect calculation.Add
.asIntegertonumFramesandnumChannelsinBuffer.alloc.The documentation says that
numFramesandnumChannelsare truncated, but the corresponding method does not currently do this. This commit would make the implementation consistent with the documentation.I put the second approach in a separate PR (#7471), but my impression is that it is better left as a draft for now. That is why I opened this new PR instead.
Types of changes
To-do list