Minor cleanups to USB MIDI handling

In testing, the releaseInterface() call was found to be unreliable, so
this patch omits the call. Also minor copyright header fix.
master
Raph Levien 11 years ago
parent 9746d9626e
commit 26558930c0
  1. 6
      android/src/com/levien/synthesizer/android/ui/PianoActivity2.java
  2. 16
      android/src/com/levien/synthesizer/android/usb/UsbMidiDevice.java

@ -227,11 +227,13 @@ public class PianoActivity2 extends Activity {
usbMidiDevice_ = null; usbMidiDevice_ = null;
} }
if (usbMidiInterface_ != null) { if (usbMidiInterface_ != null) {
usbMidiConnection_.releaseInterface(usbMidiInterface_); // Note: releasing the interface seems to trigger bugs, so
// based on experimentation just closing seems more robust
//usbMidiConnection_.releaseInterface(usbMidiInterface_);
} }
usbMidiConnection_.close(); usbMidiConnection_.close();
usbMidiDeviceName_ = null;
usbMidiConnection_ = null; usbMidiConnection_ = null;
usbMidiDeviceName_ = null;
} }
if (device != null && intf != null) { if (device != null && intf != null) {
UsbManager usbManager = (UsbManager) getSystemService(Context.USB_SERVICE); UsbManager usbManager = (UsbManager) getSystemService(Context.USB_SERVICE);

@ -1,4 +1,18 @@
// TODO copyright /*
* Copyright 2013 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Class representing a USB MIDI keyboard // Class representing a USB MIDI keyboard

Loading…
Cancel
Save