Java examples for javax.sound.midi:MidiDevice
Returns an array of MidiDevice.Info for MIDI output device.
/*//from w ww . j a v a2s .c o m * Copyright 2004 Hiroo Hayashi * * This file is part of JSynthLib. * * JSynthLib is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2 of the License, * or(at your option) any later version. * * JSynthLib is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with JSynthLib; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ //package com.java2s; import javax.sound.midi.*; import java.util.*; public class Main { private final static boolean EMULATE_NO_MIDI_OUT = false; /** Returns an array of MidiDevice.Info for MIDI output device. */ private static MidiDevice.Info[] createOutputMidiDeviceInfo() throws MidiUnavailableException { ArrayList list = new ArrayList(); MidiDevice.Info[] infos = MidiSystem.getMidiDeviceInfo(); for (int i = 0; i < infos.length; i++) { // throws MidiUnavailableException MidiDevice device = MidiSystem.getMidiDevice(infos[i]); if (device.getMaxReceivers() != 0 && !(device instanceof Synthesizer) && !(device instanceof Sequencer) && !EMULATE_NO_MIDI_OUT) list.add(infos[i]); } return (MidiDevice.Info[]) list.toArray(new MidiDevice.Info[0]); } }