Java 类javax.sound.midi.MidiDevice.Info 实例源码

项目:frinika    文件:FrinikaConfig.java   
public static Collection<String> getAvailableMidiInDevices() {
    ArrayList<String> a = new ArrayList<String>();
    Info infos[] = MidiSystem.getMidiDeviceInfo();
    for (Info info : infos) {
        try {
            MidiDevice dev=MidiSystem.getMidiDevice(info);
            if (dev.getMaxTransmitters() == 0 ) continue;
            String str = info.toString();
            a.add(str);
        } catch (MidiUnavailableException e) {
            // TODO Auto-generated catch block
            //e.printStackTrace();
        }

    }
    return a;
}
项目:maestro    文件:SynthesizerFactory.java   
/**
 * Find available AudioSynthesizer
 */
public static AudioSynthesizer findAudioSynthesizer() throws MidiUnavailableException
{
    // First check if default synthesizer is AudioSynthesizer.
    Synthesizer synth = MidiSystem.getSynthesizer();
    if (synth instanceof AudioSynthesizer)
        return (AudioSynthesizer) synth;

    // If default synhtesizer is not AudioSynthesizer, check others.
    for (Info info : MidiSystem.getMidiDeviceInfo())
    {
        MidiDevice dev = MidiSystem.getMidiDevice(info);
        if (dev instanceof AudioSynthesizer)
            return (AudioSynthesizer) dev;
    }

    // No AudioSynthesizer was found, return null.
    return null;
}
项目:computoser    文件:Midi2WavRenderer.java   
public static AudioSynthesizer findAudioSynthesizer() throws MidiUnavailableException, IOException, InvalidMidiDataException {
    // First check if default synthesizer is AudioSynthesizer.
    Synthesizer synth = MidiSystem.getSynthesizer();
    if (synth instanceof AudioSynthesizer) {
        return (AudioSynthesizer) synth;
    }

    // If default synhtesizer is not AudioSynthesizer, check others.
    Info[] infos = MidiSystem.getMidiDeviceInfo();
    for (int i = 0; i < infos.length; i++) {
        MidiDevice dev = MidiSystem.getMidiDevice(infos[i]);
        if (dev instanceof AudioSynthesizer) {
            return (AudioSynthesizer) dev;
        }
    }

    // No AudioSynthesizer was found, return null.
    return null;
}
项目:cn1    文件:MidiSystem.java   
public static MidiDevice.Info[] getMidiDeviceInfo() {
    /*
     * obtain the list of MidiDeviceProviders
     */
    List<?> deviceProviders = ProviderService.getProviders(midiDeviceProviderPath);
    //variable to save MidiDevice.Info
    List<MidiDevice.Info> infos = new ArrayList<MidiDevice.Info>();
    /*
     * look through list of providers and save info of devices
     */
    for (int i = 0; i < deviceProviders.size(); i++) {
        MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(i)).getDeviceInfo();
        for (Info element : deviceInfo) {
            infos.add(element);
        }
    }

    MidiDevice.Info[] temp = new MidiDevice.Info[infos.size()];
    return infos.toArray(temp);
}
项目:freeVM    文件:MidiSystem.java   
public static MidiDevice.Info[] getMidiDeviceInfo() {
    /*
     * obtain the list of MidiDeviceProviders
     */
    List<?> deviceProviders = ProviderService.getProviders(midiDeviceProviderPath);
    //variable to save MidiDevice.Info
    List<MidiDevice.Info> infos = new ArrayList<MidiDevice.Info>();
    /*
     * look through list of providers and save info of devices
     */
    for (int i = 0; i < deviceProviders.size(); i++) {
        MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(i)).getDeviceInfo();
        for (Info element : deviceInfo) {
            infos.add(element);
        }
    }

    MidiDevice.Info[] temp = new MidiDevice.Info[infos.size()];
    return infos.toArray(temp);
}
项目:freeVM    文件:MidiSystem.java   
public static MidiDevice.Info[] getMidiDeviceInfo() {
    /*
     * obtain the list of MidiDeviceProviders
     */
    List<?> deviceProviders = ProviderService.getProviders(midiDeviceProviderPath);
    //variable to save MidiDevice.Info
    List<MidiDevice.Info> infos = new ArrayList<MidiDevice.Info>();
    /*
     * look through list of providers and save info of devices
     */
    for (int i = 0; i < deviceProviders.size(); i++) {
        MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(i)).getDeviceInfo();
        for (Info element : deviceInfo) {
            infos.add(element);
        }
    }

    MidiDevice.Info[] temp = new MidiDevice.Info[infos.size()];
    return infos.toArray(temp);
}
项目:gervill    文件:SimpleMidiPlayer.java   
public static AudioSynthesizer findAudioSynthesizer()
        throws MidiUnavailableException {
    // First check if default synthesizer is AudioSynthesizer.
    Synthesizer synth = MidiSystem.getSynthesizer();
    if (synth instanceof AudioSynthesizer)
        return (AudioSynthesizer) synth;

    // If default synhtesizer is not AudioSynthesizer, check others.
    Info[] infos = MidiSystem.getMidiDeviceInfo();
    for (int i = 0; i < infos.length; i++) {
        MidiDevice dev = MidiSystem.getMidiDevice(infos[i]);
        if (dev instanceof AudioSynthesizer)
            return (AudioSynthesizer) dev;
    }

    // No AudioSynthesizer was found, return null.
    return null;
}
项目:gervill    文件:Midi2WavRender.java   
public static AudioSynthesizer findAudioSynthesizer()
        throws MidiUnavailableException {
    // First check if default synthesizer is AudioSynthesizer.
    Synthesizer synth = MidiSystem.getSynthesizer();
    if (synth instanceof AudioSynthesizer)
        return (AudioSynthesizer) synth;

    // If default synhtesizer is not AudioSynthesizer, check others.
    Info[] infos = MidiSystem.getMidiDeviceInfo();
    for (int i = 0; i < infos.length; i++) {
        MidiDevice dev = MidiSystem.getMidiDevice(infos[i]);
        if (dev instanceof AudioSynthesizer)
            return (AudioSynthesizer) dev;
    }

    // No AudioSynthesizer was found, return null.
    return null;
}
项目:Zong    文件:MidiToWaveRenderer.java   
public static AudioSynthesizer findAudioSynthesizer()
    throws MidiUnavailableException {
    // First check if default synthesizer is AudioSynthesizer.
    Synthesizer synth = MidiSystem.getSynthesizer();
    if (synth instanceof AudioSynthesizer)
        return (AudioSynthesizer) synth;

    // If default synhtesizer is not AudioSynthesizer, check others.
    Info[] infos = MidiSystem.getMidiDeviceInfo();
    for (val info : infos) {
        MidiDevice dev = MidiSystem.getMidiDevice(info);
        if (dev instanceof AudioSynthesizer)
            return (AudioSynthesizer) dev;
    }

    // No AudioSynthesizer was found, return null.
    return null;
}
项目:Zong    文件:SynthManager.java   
private AudioSynthesizer findAudioSynthesizer()
    throws MidiUnavailableException {
    //first check if default synthesizer is AudioSynthesizer.
    Synthesizer synth = MidiSystem.getSynthesizer();
    if (synth instanceof AudioSynthesizer)
        return (AudioSynthesizer) synth;

    //if default synthesizer is not AudioSynthesizer, check others.
    Info[] infos = MidiSystem.getMidiDeviceInfo();
    for (val info : infos) {
        MidiDevice dev = MidiSystem.getMidiDevice(info);
        if (dev instanceof AudioSynthesizer)
            return (AudioSynthesizer) dev;
    }

    //no AudioSynthesizer was found, return null.
    return null;
}
项目:red5-mobileconsole    文件:SharedMidiObject.java   
public static MidiDevice getMidiDevice(String name) {

        MidiDevice.Info[] info = MidiSystem.getMidiDeviceInfo();

        for (Info element : info) {
            if (element.getName().equals(name)) {
                try {
                    return MidiSystem.getMidiDevice(element);
                } catch (MidiUnavailableException e) {
                    log.error("{}", e);
                }
            }
        }

        return null;

    }
项目:red5-mobileconsole    文件:Test.java   
public static MidiDevice getMidiDevice(String name) {

        MidiDevice.Info[] info = MidiSystem.getMidiDeviceInfo();

        for (Info element : info) {
            if (element.getName().equals(name)) {
                try {
                    return MidiSystem.getMidiDevice(element);
                } catch (MidiUnavailableException e) {
                    log.error("{}", e);
                }
            }
        }

        return null;

    }
项目:sponge    文件:MidiUtils.java   
/**
 * Returns the map of all available MIDI devices.
 *
 * @return the map of all available MIDI devices.
 */
public static Map<MidiDevice.Info, MidiDevice> getDeviceMap() {
    Map<MidiDevice.Info, MidiDevice> result = new LinkedHashMap<>();

    try {
        for (Info info : MidiSystem.getMidiDeviceInfo()) {
            result.put(info, MidiSystem.getMidiDevice(info));
        }
    } catch (MidiUnavailableException e) {
        throw SpongeUtils.wrapException(e);
    }

    return result;
}
项目:jdk8u-jdk    文件:GetDevice.java   
public static void main(String[] args) throws Exception {
    SoftProvider provider = new SoftProvider();
    Info[] infos = provider.getDeviceInfo();
    assertTrue(infos.length > 0);
    for (int i = 0; i < infos.length; i++) {
        assertTrue(infos[i] != null);
        MidiDevice d = provider.getDevice(infos[i]);
        assertTrue(d instanceof SoftSynthesizer);
    }
    assertTrue(provider.getDevice(new FakeInfo()) == null);

}
项目:openjdk-jdk10    文件:GetDevice.java   
public static void main(String[] args) throws Exception {
    SoftProvider provider = new SoftProvider();
    Info[] infos = provider.getDeviceInfo();
    assertTrue(infos.length > 0);
    for (int i = 0; i < infos.length; i++) {
        assertTrue(infos[i] != null);
        MidiDevice d = provider.getDevice(infos[i]);
        assertTrue(d instanceof SoftSynthesizer);
    }
}
项目:openjdk9    文件:GetDevice.java   
public static void main(String[] args) throws Exception {
    SoftProvider provider = new SoftProvider();
    Info[] infos = provider.getDeviceInfo();
    assertTrue(infos.length > 0);
    for (int i = 0; i < infos.length; i++) {
        assertTrue(infos[i] != null);
        MidiDevice d = provider.getDevice(infos[i]);
        assertTrue(d instanceof SoftSynthesizer);
    }
}
项目:jdk8u_jdk    文件:GetDevice.java   
public static void main(String[] args) throws Exception {
    SoftProvider provider = new SoftProvider();
    Info[] infos = provider.getDeviceInfo();
    assertTrue(infos.length > 0);
    for (int i = 0; i < infos.length; i++) {
        assertTrue(infos[i] != null);
        MidiDevice d = provider.getDevice(infos[i]);
        assertTrue(d instanceof SoftSynthesizer);
    }
    assertTrue(provider.getDevice(new FakeInfo()) == null);

}
项目:lookaside_java-1.8.0-openjdk    文件:GetDevice.java   
public static void main(String[] args) throws Exception {
    SoftProvider provider = new SoftProvider();
    Info[] infos = provider.getDeviceInfo();
    assertTrue(infos.length > 0);
    for (int i = 0; i < infos.length; i++) {
        assertTrue(infos[i] != null);
        MidiDevice d = provider.getDevice(infos[i]);
        assertTrue(d instanceof SoftSynthesizer);
    }
    assertTrue(provider.getDevice(new FakeInfo()) == null);

}
项目:javify    文件:DSSIMidiDeviceProvider.java   
public MidiDevice getDevice(Info info)
{
  for (int i = 0; i < infos.length; i++)
  {
    if (info.equals(infos[i]))
    {
        return new DSSISynthesizer(infos[i],
                                   infos[i].soname,
                                   infos[i].index);
    }
  }
  throw new IllegalArgumentException("Don't recognize MIDI device " + info);
}
项目:javify    文件:AlsaMidiDeviceProvider.java   
public MidiDevice getDevice(Info info)
{
  for (int i = 0; i < infos.length; i++)
  {
    if (info.equals(infos[i]))
    {
      return infos[i].getDevice();
    }
  }
  throw new IllegalArgumentException("Don't recognize MIDI device " + info);
}
项目:jvm-stm    文件:DSSIMidiDeviceProvider.java   
public MidiDevice getDevice(Info info)
{
  for (int i = 0; i < infos.length; i++)
  {
    if (info.equals(infos[i]))
    {
        return new DSSISynthesizer(infos[i],
                                   infos[i].soname, 
                                   infos[i].index);
    }
  }
  throw new IllegalArgumentException("Don't recognize MIDI device " + info);
}
项目:jvm-stm    文件:AlsaMidiDeviceProvider.java   
public MidiDevice getDevice(Info info)
{
  for (int i = 0; i < infos.length; i++)
  {
    if (info.equals(infos[i]))
    {
      return infos[i].getDevice();
    }
  }
  throw new IllegalArgumentException("Don't recognize MIDI device " + info);
}
项目:infobip-open-jdk-8    文件:GetDevice.java   
public static void main(String[] args) throws Exception {
    SoftProvider provider = new SoftProvider();
    Info[] infos = provider.getDeviceInfo();
    assertTrue(infos.length > 0);
    for (int i = 0; i < infos.length; i++) {
        assertTrue(infos[i] != null);
        MidiDevice d = provider.getDevice(infos[i]);
        assertTrue(d instanceof SoftSynthesizer);
    }
    assertTrue(provider.getDevice(new FakeInfo()) == null);

}
项目:jdk8u-dev-jdk    文件:GetDevice.java   
public static void main(String[] args) throws Exception {
    SoftProvider provider = new SoftProvider();
    Info[] infos = provider.getDeviceInfo();
    assertTrue(infos.length > 0);
    for (int i = 0; i < infos.length; i++) {
        assertTrue(infos[i] != null);
        MidiDevice d = provider.getDevice(infos[i]);
        assertTrue(d instanceof SoftSynthesizer);
    }
    assertTrue(provider.getDevice(new FakeInfo()) == null);

}
项目:frinika    文件:ProjectContainer.java   
/**
 * Redirects midi events used for controls
 * 
 * If not consumed event is sent to midiReciever.
 *  
 * 
 * @param devInfo
 * @param arg0
 * @param arg1
 */
public void processMidiMessageFromDevice(Info devInfo, MidiMessage arg0, long arg1) {
    if (midiDeviceRouter != null && midiDeviceRouter.consume(devInfo, arg0, arg1)) {
        return;
    }
    try {
        sequencer.getReceiver().send(arg0, arg1);
    } catch (MidiUnavailableException ex) {
        Logger.getLogger(ProjectContainer.class.getName()).log(Level.SEVERE, null, ex);
    }
}
项目:frinika    文件:FrinikaJVSTSynthProvider.java   
@Override
public MidiDevice getDevice(Info info) {
    if(info.getClass().equals(FrinikaJVSTSynthProvider.FrinikaJVSTSynthProviderInfo.class))
    {
        return new FrinikaJVSTSynth();
    }
    return null;
}
项目:frinika    文件:FrinikaJVSTSynthProvider.java   
@Override
public boolean isDeviceSupported(Info info) {
    if(info.getClass().equals(FrinikaJVSTSynthProvider.FrinikaJVSTSynthProviderInfo.class))
    {
        return true;
    }
    return false;
}
项目:frinika    文件:CodeSynthProvider.java   
@Override
public MidiDevice getDevice(Info info) {
    if(info.getClass().equals(CodeSynthProvider.CodeSynthProviderInfo.class))
    {
        return new CodeSynth();
    }
    return null;
}
项目:frinika    文件:CodeSynthProvider.java   
@Override
public boolean isDeviceSupported(Info info) {
    if(info.getClass().equals(CodeSynthProvider.CodeSynthProviderInfo.class))
    {
        return true;
    }
    return false;
}
项目:frinika    文件:MidiInDeviceManager.java   
public static void open(Collection<String> openMidiIn) {
    if (isOpen) {
        return;
    }

    Vector<String> names = new Vector<String>();

    for (String name : openMidiIn) { //FrinikaConfig.getMidiInDeviceList()) {
        names.add(name);
    }

    Info infos[] = MidiSystem.getMidiDeviceInfo();

    for (Info info : infos) {
        MidiDevice dev;
        String str = info.toString();
        if (names.contains(str)) {
            try {
                dev = MidiSystem.getMidiDevice(info);
                if (dev.getMaxTransmitters() != 0) {
                    {
                        DeviceReceiver recv = new DeviceReceiver(dev);
                        deviceReceivers.add(recv);

                        dev.open();
                        dev.getTransmitter().setReceiver(recv);
                    // active_midiindevices.add(dev);
                    }
                }
            } catch (Throwable e1) {
                e1.printStackTrace();
            }
        }
    }

    isOpen = true;

}
项目:frinika    文件:MidiDeviceResolver.java   
static MidiDevice resolveDevice(String devName) {
    Info infos[]=MidiSystem.getMidiDeviceInfo();
    for (Info i:infos) {
        if (i.getName().equals(devName)) try {
            return MidiSystem.getMidiDevice(i);
        } catch (MidiUnavailableException ex) {
            Logger.getLogger(MidiDeviceResolver.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    return null;
}
项目:frinika    文件:MidiOutDeviceSelectPanel.java   
static Vector<MidiDevice.Info> getList() {
    Info infos[] = MidiSystem.getMidiDeviceInfo();

    Vector<MidiDevice.Info> list=new Vector<MidiDevice.Info>();
    for (Info info : infos) {
        MidiDevice dev;
        try {
            dev = MidiSystem.getMidiDevice(info);

            if (dev.getMaxReceivers() != 0) {
                list.add(dev.getDeviceInfo());
            }
        } catch (MidiUnavailableException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
    }

    return list;
    //          
    //          
    // for(final MidiDeviceHandle d:list){
    // if (d.getMidiDevice() == null) continue;
    // JCheckBox box=new
    // JCheckBox(d.toString(),names.contains(d.toString()));
    // boxes.add(box);
    // box.addActionListener(act);
    // add(box);
    // }

}
项目:frinika    文件:MidiOutDeviceSelectPanel.java   
public MidiDevice getSelected() {
    Info str = (Info) getSelectedItem();
    MidiDevice dev1 = null;
    try {
        dev1 = MidiSystem.getMidiDevice(str);
    } catch (MidiUnavailableException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return dev1;
}
项目:frinika    文件:MidiInDeviceSelectPanel.java   
public MidiDevice getSelected() {
    Info str = (Info) getSelectedItem();
    MidiDevice dev1 = null;
    try {
        dev1 = MidiSystem.getMidiDevice(str);
    } catch (MidiUnavailableException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return dev1;
}
项目:frinika    文件:FrinikaSynthRackProvider.java   
public MidiDevice getDevice(Info arg0) {
    if(!(arg0 instanceof SynthRack.SynthRackInfo)) return null;
    return new SynthRack(new VoiceServer(){

        @Override
        public void configureAudioOutput(JFrame frame) {
            // TODO Auto-generated method stub

        }});
    //return new SynthRack(FrinikaAudioSystem.getAudioServer(), null);
}
项目:jdk7-jdk    文件:GetDevice.java   
public static void main(String[] args) throws Exception {
    SoftProvider provider = new SoftProvider();
    Info[] infos = provider.getDeviceInfo();
    assertTrue(infos.length > 0);
    for (int i = 0; i < infos.length; i++) {
        assertTrue(infos[i] != null);
        MidiDevice d = provider.getDevice(infos[i]);
        assertTrue(d instanceof SoftSynthesizer);
    }
    assertTrue(provider.getDevice(new FakeInfo()) == null);

}
项目:openjdk-source-code-learn    文件:GetDevice.java   
public static void main(String[] args) throws Exception {
    SoftProvider provider = new SoftProvider();
    Info[] infos = provider.getDeviceInfo();
    assertTrue(infos.length > 0);
    for (int i = 0; i < infos.length; i++) {
        assertTrue(infos[i] != null);
        MidiDevice d = provider.getDevice(infos[i]);
        assertTrue(d instanceof SoftSynthesizer);
    }
    assertTrue(provider.getDevice(new FakeInfo()) == null);

}
项目:OLD-OpenJDK8    文件:GetDevice.java   
public static void main(String[] args) throws Exception {
    SoftProvider provider = new SoftProvider();
    Info[] infos = provider.getDeviceInfo();
    assertTrue(infos.length > 0);
    for (int i = 0; i < infos.length; i++) {
        assertTrue(infos[i] != null);
        MidiDevice d = provider.getDevice(infos[i]);
        assertTrue(d instanceof SoftSynthesizer);
    }
    assertTrue(provider.getDevice(new FakeInfo()) == null);

}
项目:cn1    文件:MidiDeviceProvider.java   
public boolean isDeviceSupported(MidiDevice.Info info) {
    MidiDevice.Info[] devices = getDeviceInfo();
    for (Info element : devices) {
        if (info.equals(element)) {
            return true;
        }
    }
    return false;
}
项目:cn1    文件:MidiSystem.java   
public static MidiDevice getMidiDevice(MidiDevice.Info info)
        throws MidiUnavailableException {
    //FIXME
    /*
     * this method must to throw out MidiUnavailableException if requested device
     * is not available
     */

    /* 
     * obtain the list of MidiDeviceProviders
     */
    List<?> deviceProviders = ProviderService.getProviders(midiDeviceProviderPath);
    /*
     * find device that describes by parameter info and return it
     */
    for (int i = 0; i < deviceProviders.size(); i++) {
        MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(i)).getDeviceInfo();
        for (Info element : deviceInfo) {
            if (element.equals(info)) {
                return ((MidiDeviceProvider) deviceProviders.get(i)).getDevice(info);
            }
        }
    }
    /*
     * if we can't find device with requested info, we throw out IllegalArgumentException
     */
    throw new IllegalArgumentException(Messages.getString("sound.1F", info.getName()));
}