Fills MIDI output Names and input Names, with the names of devices made from their descriptions and names - Java javax.sound.midi

Java examples for javax.sound.midi:MidiDevice

Description

Fills MIDI output Names and input Names, with the names of devices made from their descriptions and names

Demo Code

/*//from   w w w. j a  va 2  s . 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.*;

public class Main {
    private static MidiDevice.Info[] outputMidiDeviceInfo;
    private static MidiDevice.Info[] inputMidiDeviceInfo;
    private static String[] outputNames;
    private static String[] inputNames;

    /** Fills outputNames and inputNames, with the names of devices
     * made from their descriptions and names */
    private static void createNames() { // wirski@op.pl
        outputNames = new String[outputMidiDeviceInfo.length];
        for (int i = 0; i < outputMidiDeviceInfo.length; i++) {
            outputNames[i] = outputMidiDeviceInfo[i].getDescription()
                    + outputMidiDeviceInfo[i].getName();
        }
        inputNames = new String[inputMidiDeviceInfo.length];
        for (int i = 0; i < inputMidiDeviceInfo.length; i++) {
            inputNames[i] = inputMidiDeviceInfo[i].getDescription()
                    + inputMidiDeviceInfo[i].getName();
        }
    }
}

Related Tutorials