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

throw error when midi not connected #38

Open
mrbbp opened this issue Sep 11, 2024 · 1 comment
Open

throw error when midi not connected #38

mrbbp opened this issue Sep 11, 2024 · 1 comment

Comments

@mrbbp
Copy link

mrbbp commented Sep 11, 2024

hello, it not really an issue.
i would like to intercept the error when no midi are connected to computer and let the script to follow his way.
with the try catch instruction, we have to provide exception, but i'm not able to designate the type of error for the catchparameter.
any help?
thanks

@mrbbp
Copy link
Author

mrbbp commented Sep 12, 2024

The MidiBus Warning: The chosen input device numbered [1] was not added because it doesn't exist
The MidiBus Warning: The chosen output device numbered [2] was not added because it doesn't exist

and script stop without error.

try {
  // List all available Midi devices on STDOUT. This will show each device's index and name.
  MidiBus.list(); 
  //                   Parent In Out
  //                     |    |  |
  //myBus = new MidiBus(this, 0, 1);
  //Create a new MidiBus using the device index to select the Midi input and output devices respectively.
  delay(100);
  myBus = new MidiBus(this, 1, 2);
  // initialise les valeurs du device
  myBus.sendNoteOff(new Note(0,64,127));
  } catch (NullPointerException e) {
    e.printStackTrace();
  }

how can we test code without a midi device connected to computer?

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

No branches or pull requests

1 participant