Java examples for javax.sound.midi:MidiSystem
get Midi Out Device
/******************************************************************************* * Copyright (c) 2013 Shuichi Miura.// ww w.j a v a 2s .co m * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Public License v3.0 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/gpl.html * * Contributors: * Shuichi Miura - initial API and implementation ******************************************************************************/ //package com.java2s; import javax.sound.midi.MidiDevice; import javax.sound.midi.MidiSystem; import javax.sound.midi.MidiUnavailableException; public class Main { public static MidiDevice getMidiOutDevice(String deviceName) throws MidiUnavailableException { MidiDevice.Info[] infoArray = MidiSystem.getMidiDeviceInfo(); for (MidiDevice.Info info : infoArray) { MidiDevice device = MidiSystem.getMidiDevice(info); int recMax = device.getMaxReceivers(); if (recMax == 0) { continue; } if (info.getName().equals(deviceName)) { return MidiSystem.getMidiDevice(info); } } return null; } }