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

When Manufacturer is a Uint8Array, sendSysex fails with error #124

Closed
squeedee opened this issue Sep 19, 2020 · 3 comments
Closed

When Manufacturer is a Uint8Array, sendSysex fails with error #124

squeedee opened this issue Sep 19, 2020 · 3 comments
Assignees
Labels
Type: enhancement Request for improvement
Milestone

Comments

@squeedee
Copy link

Using:

const MFR_ID = new Uint8Array([0x00, 0x20, 0x29])
output.sendSysex(MFR_ID, [0x01])

I get:

Uncaught RangeError: Data bytes must be integers between 0 (0x00) and 255 (0xFF)

Tracing it down:

manufacturer = [].concat(manufacturer);

[].concat(new Uint8Array([0x00, 0x20, 0x29])) 
=> [Uint8Array(3)]

I guess from the javascript implementation side, this is understandable and this might be a hard fix, but It'd be nice if i could use the same constant

const MFR_ID = new Uint8Array([0x00, 0x20, 0x29])

for later equality tests (I use lodash.isEqual) on incoming data.

@squeedee
Copy link
Author

squeedee commented Sep 19, 2020

Workaround for anyone else finding this issue:

output.sendSysex(Array.from(MFR_ID), ...)

I think this is ES6+ only.

@djipco djipco self-assigned this Sep 19, 2020
@djipco
Copy link
Owner

djipco commented Sep 19, 2020

Adding library-wide support for Uint8Array is something that's been on my todo list. It will not be incorporated in version 2.5.x but it should make it inside version 3. Thanks for your input regarding this.

@djipco djipco closed this as completed Sep 19, 2020
@djipco djipco added the Type: enhancement Request for improvement label Sep 19, 2020
@djipco djipco added this to the 3.0 milestone Sep 19, 2020
@djipco
Copy link
Owner

djipco commented Sep 27, 2021

The send() and sendSysex() methods in version 3.0.0-alpha.13 now have full support for data specified as Uint8Array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: enhancement Request for improvement
Projects
None yet
Development

No branches or pull requests

2 participants