本文整理汇总了Java中javax.sound.midi.Transmitter.close方法的典型用法代码示例。如果您正苦于以下问题:Java Transmitter.close方法的具体用法?Java Transmitter.close怎么用?Java Transmitter.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.sound.midi.Transmitter
的用法示例。
在下文中一共展示了Transmitter.close方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: close
import javax.sound.midi.Transmitter; //导入方法依赖的package包/类
/**
* Closes the MIDI transmitter.
*
* @param transmitter the MIDI transmitter.
*/
public static void close(Transmitter transmitter) {
try {
if (transmitter != null) {
transmitter.close();
}
} catch (Exception e) {
logger.warn("close", e);
}
}
示例2: removeReceiverFromDevice
import javax.sound.midi.Transmitter; //导入方法依赖的package包/类
/**
* Removes a midi receiver from a midi device
*
* @param device
* The midi device
* @param receiver
* The midi receiver
* @throws MidiUnavailableException
* If midi device is not available
*/
public static void removeReceiverFromDevice(MidiDevice device,
String receiverName) throws MidiUnavailableException {
List<Transmitter> transmitters = device.getTransmitters();
for (Transmitter transmitter : transmitters) {
if (receiverName.equals(transmitter.getReceiver().getClass()
.getName())) {
transmitter.getReceiver().close();
transmitter.setReceiver(null);
transmitter.close();
}
}
}
示例3: closeAllTransmittersAndReceivers
import javax.sound.midi.Transmitter; //导入方法依赖的package包/类
/**
* Closes all transmitters and receivers of the midi device
*
* @param device
*/
public static void closeAllTransmittersAndReceivers(MidiDevice device) {
for (Transmitter transmitter : device.getTransmitters()) {
transmitter.close();
}
for (Receiver receiver : device.getReceivers()) {
receiver.close();
}
}
示例4: close
import javax.sound.midi.Transmitter; //导入方法依赖的package包/类
/**
* Closes the Core MIDI Device, which also closes all its transmitters
*
*/
@Override
public void close() {
if (isOpen.compareAndSet(true, false)) {
try {
// If the port is created then disconnect from it
if (input.get() != null) {
try {
input.get().disconnectSource(this);
} finally {
input.set(null);
}
}
// Close all our transmitters, which will also clear the list.
// We iterate on a copy of the transmitter list to avoid issues with concurrent modification.
for (Transmitter transmitter : getTransmitters()) {
transmitter.close();
}
} catch (CoreMidiException e) {
e.printStackTrace();
}
}
}