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

Removing a Midi Device produces a crash #24

Open
raduvarga opened this issue Dec 27, 2020 · 8 comments
Open

Removing a Midi Device produces a crash #24

raduvarga opened this issue Dec 27, 2020 · 8 comments

Comments

@raduvarga
Copy link
Contributor

raduvarga commented Dec 27, 2020

The problem is here:

Assertion failed: file WebMIDIKit/MIDIPortMap.swift, line 72

The code:

assert(port.state == .connected)

Is this assertion necessary?

@adamnemecek
Copy link
Owner

what code causes this crash?

@raduvarga
Copy link
Contributor Author

raduvarga commented Jan 6, 2021

Just physically removing a controller, no code of my own.
I ended up just commenting that line.
BTW, there were a few other lines that had to be fixed, the code did not compile at the beginning. Should I make a PR with those changes?

@adamnemecek
Copy link
Owner

adamnemecek commented Jan 6, 2021

Oh yeah that makes sense actually. Yeah start a PR. Yeah the repo hasn’t been updated in some time.

@raduvarga
Copy link
Contributor Author

raduvarga commented Jan 26, 2021

Just found another crashing line, in Enum.swift line 32:

fatalError("You didn't initialize a virtual port")

This happens when closing a Virtual midi port. I've added a fix for the crash to the current PR.
I'm however not sure how to recognize the Virtual ports as input and output. When they connect, they recognize fine, only when disconnecting the type is returned as other.

@adamnemecek
Copy link
Owner

I think that there isn’t support for virtual ports right now.

@raduvarga
Copy link
Contributor Author

Understood, but crashing the whole app when disconnecting a midi port is still not desired.

The Virtual ports actually do work (they show as Input and Output when connected), it's just hard to recognize when they disconnect, which is actually not that bad. I will try to see if I can figure this out.

@adamnemecek
Copy link
Owner

It’s an implementation of the webmidi standard. You might be right, I should be caching the values. Do you want to do a pr?

@adamnemecek
Copy link
Owner

Pull request.

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

2 participants