How to properly release a MIDI device object?

3 次查看(过去 30 天)
Hi!
I'm using an external MIDI keyboard, which I'm accessing through
device = mididevice('Teensy MIDI');
after running my code, I can't rerun it without Matlab hanging, and I can't close Matlab since it hangs all the same, and I end up killing it.
I'm pretty sure it's due to the MIDI device not being properly released, combined with the code starting by calling
clear all
when I try to manually 'clear device' I get the same behavior.
I've tried 'release' as well, but to no avail...
Thanks!

回答(1 个)

Brandon Stevens
Brandon Stevens 2022-11-11
There are a few ways you can 'release' a MIDI device depending on how you are using it in your code.
If you also use an audio device writer object when accesing your keyboard, you can use 'release' on that system object. For an example, check out the one on this page:
I would not expect just having a mididevice interface to cause MATLAB to hang.
If you have any follow-up questions, please reach out to MathWorks Technical Support

类别

Help CenterFile Exchange 中查找有关 Musical Instrument Digital Interface (MIDI) 的更多信息

标签

产品


版本

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by