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

MIDIOut: Index Out of Range error #4652

Closed
akstuhl opened this issue Nov 25, 2019 · 3 comments
Closed

MIDIOut: Index Out of Range error #4652

akstuhl opened this issue Nov 25, 2019 · 3 comments
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: sclang sclang C++ implementation (primitives, etc.). for changes to class lib use "comp: class library"

Comments

@akstuhl
Copy link

akstuhl commented Nov 25, 2019

The _SendMIDIOut primitive throws an Index Out of Range error when addressing an output port whose index is equal to or greater than the number of input ports. I believe this is because the method checks outputIndex >= gNumMIDIInPorts when it instead should check gNumMIDIOutPorts:

if (outputIndex < 0 || outputIndex >= gNumMIDIInPorts)

Environment

  • SuperCollider version: 3.10.3
  • Operating system: Mac OS 10.14.6
  • Other details (Qt version, audio driver, etc.): Two MIDI devices connected (BCR2000 and Launchpad). The BCR2000 has 2 input ports and 3 output ports. The Launchpad appears at the end of the MIDI destination lists.

Steps to reproduce

~midiout = MIDIOut.newByName("Launchpad S", "Launchpad S");
~midiout.touch;

Expected vs. actual behavior

Expected: touch MIDI device.
Actual: ERROR: Primitive '_SendMIDIOut' failed. Index out of range.

Removing the first MIDI device (the BCR2000) and re-initializing MIDI allows the same code to be run without error.

@akstuhl akstuhl added the bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. label Nov 25, 2019
@dmartinp
Copy link

I have run into this same error... Thanks for tracking this down.

@mossheim
Copy link
Contributor

thanks for the report @akstuhl -- your solution seems right to me, please file a PR if you have the time!

@nhthn nhthn changed the title MIDIOut MIDIOut: Index Out of Range error Nov 28, 2019
@nhthn nhthn added the comp: sclang sclang C++ implementation (primitives, etc.). for changes to class lib use "comp: class library" label Nov 28, 2019
@mossheim
Copy link
Contributor

mossheim commented May 7, 2020

fixed in #4910.

@mossheim mossheim closed this as completed May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: sclang sclang C++ implementation (primitives, etc.). for changes to class lib use "comp: class library"
Projects
None yet
Development

No branches or pull requests

4 participants