You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I have 2 selectors, and they both select (different) ports on the same device, when one of the spinners changes selection, the close() method is called on the device. But this device is being used by the other selector, is it reference counted internally? What does it mean to close it, while a port might be still in use elsewhere?
Good question. This needs to be investigated.
The text was updated successfully, but these errors were encountered:
If the same port is being used for both input and output, we should not open the device twice. We should instead open the device only once and use the same device for both the input and output ports.
Below is what close looks like internally. We should not two separate port selectors call close at the same time. We should expose something like MidiInputOutputPortSelector if developers need to use the same port for both input and output in the same app.
@Override
public void close() throws IOException {
synchronized (mGuard) {
if (mIsClosed) return;
mGuard.close();
try {
// close input port
mInputPortDeviceServer.closePort(mInputPortToken);
// close output port
mDeviceServer.closePort(mOutputPortToken);
} catch (RemoteException e) {
Log.e(TAG, "RemoteException in MidiConnection.close");
}
mIsClosed = true;
}
}
Mario wrote:
Good question. This needs to be investigated.
The text was updated successfully, but these errors were encountered: