/** * Attempt to disable the high resolution timer by closing the {@link MidiDevice}. */ public static synchronized void disable() { if (MIDI_DEVICE != null && MIDI_DEVICE.isOpen()) { MIDI_DEVICE.close(); } isEnabled = false; } }
/** * Attempt to enable the {@link MidiDevice} which requires the high resolution timer. */ public static synchronized void enable() { if (null != MIDI_DEVICE && !MIDI_DEVICE.isOpen()) { try { MIDI_DEVICE.open(); } catch (final MidiUnavailableException ignore) { isEnabled = false; return; } isEnabled = true; } }
/** * Attempt to disable the high resolution timer by closing the {@link MidiDevice}. */ public static synchronized void disable() { if (MIDI_DEVICE != null && MIDI_DEVICE.isOpen()) { MIDI_DEVICE.close(); } isEnabled = false; } }
/** * Attempt to disable the high resolution timer by closing the {@link MidiDevice}. */ public static synchronized void disable() { if (MIDI_DEVICE != null && MIDI_DEVICE.isOpen()) { MIDI_DEVICE.close(); } isEnabled = false; } }
/** * Closes the MIDI device. * * @param device the MIDI device. */ public static void close(MidiDevice device) { try { if (device != null && device.isOpen()) { device.close(); } } catch (Exception e) { logger.warn("close", e); } }
/** * Attempt to enable the {@link MidiDevice} which requires the high resolution timer. */ public static synchronized void enable() { if (null != MIDI_DEVICE && !MIDI_DEVICE.isOpen()) { try { MIDI_DEVICE.open(); } catch (final MidiUnavailableException ignore) { isEnabled = false; return; } isEnabled = true; } }
/** * Attempt to enable the {@link MidiDevice} which requires the high resolution timer. */ public static synchronized void enable() { if (null != MIDI_DEVICE && !MIDI_DEVICE.isOpen()) { try { MIDI_DEVICE.open(); } catch (final MidiUnavailableException ignore) { isEnabled = false; return; } isEnabled = true; } }
public void ensureDevClosed() { try { if (myDevice != null) { if (myDevice.isOpen()) { myDevice.close(); } } } catch (Throwable t) { getLogger().error("Problem closing device for: {}", this, t); } }
public boolean ensureDevOpen() { try { if (myDevice != null) { if (!(myDevice.isOpen())) { myDevice.open(); } return true; } else { return false; } } catch (Throwable t) { getLogger().error("Problem opening device for: {}", this, t); return false; } }
/** * Opens the MIDI device. * * @param device the MIDI device. */ public static void open(MidiDevice device) { if (device != null && !device.isOpen()) { try { device.open(); } catch (MidiUnavailableException e) { throw SpongeUtils.wrapException(e); } } }
/** {@inheritDoc} */ @Override public void close() throws IOException { if (configuration == null) { return; } if (openedOutputDevice) { MidiDevice outputDevice = configuration.getOutputDevice(); if (outputDevice != null && outputDevice.isOpen()) { outputDevice.close(); } } if (openedInputDevice) { MidiDevice inputDevice = configuration.getInputDevice(); if (inputDevice != null && inputDevice.isOpen()) { inputDevice.close(); } } }
public static Transmitter getTransmitter(MidiDevice current) { if (current.getMaxTransmitters() != 0) { try { if (!current.isOpen()) { current.open(); } } catch (MidiUnavailableException e) { return null; } try { return current.getTransmitter(); } catch (MidiUnavailableException e) { current.close(); } } return null; }
public static Receiver getReceiver(MidiDevice current) { if (current.getMaxReceivers() != 0) { try { if (!current.isOpen()) { current.open(); } } catch (MidiUnavailableException e) { return null; } try { return current.getReceiver(); } catch (MidiUnavailableException e) { current.close(); } } return null; }
if (! output.isOpen()) { output.open();
while (sequencer.isOpen()){}
if(seqr.isOpen()) seqr.stop();