Granjow / launchpad-mini

Node.js library for the Novation Launchpad Mini
145 stars 25 forks source link

User Error #6

Closed RGFTheCoder closed 4 years ago

RGFTheCoder commented 4 years ago

I have been messing around with this and realised that i need to call pad.disconnect() I've had to restart my computer twice. The API docs for disconnect() only say Disconnect. Is it syncronous or asyncronous?

Granjow commented 4 years ago

It is synchronous as it effectively only closes the two MIDI ports.

Can you explain when exactly you get the error message, and paste the error message? Does it happen when you open the same port twice without closing it in-between?

RGFTheCoder commented 4 years ago

I'm saying that when using this library, if you forget to call the disconnect method, the midi device is "in use" until you reboot. Maybe there could be a check when you exit node that disconnects the device if it remains connected.

Granjow commented 4 years ago

Ah. Yes, that is a good point. Will add that!

Granjow commented 4 years ago

I thought about it, and this is something that should be done by the consumer and not by launchpad-mini as the port is also opened in the consumer. Another issue is that when launchpad-mini adds an exit hook, it may potentially overwrite one defined by the user, or get overwritten by the user, so I think it would not work reliably anyway.

I updated the docs instead to highlight that disconnect() should be called.