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; }
/** * 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; }
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; }
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); }
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; }
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; }
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; }
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; }
/** * 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; }
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); }
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); } }
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); }
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); }
/** * 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); } }
@Override public MidiDevice getDevice(Info info) { if(info.getClass().equals(FrinikaJVSTSynthProvider.FrinikaJVSTSynthProviderInfo.class)) { return new FrinikaJVSTSynth(); } return null; }
@Override public boolean isDeviceSupported(Info info) { if(info.getClass().equals(FrinikaJVSTSynthProvider.FrinikaJVSTSynthProviderInfo.class)) { return true; } return false; }
@Override public MidiDevice getDevice(Info info) { if(info.getClass().equals(CodeSynthProvider.CodeSynthProviderInfo.class)) { return new CodeSynth(); } return null; }
@Override public boolean isDeviceSupported(Info info) { if(info.getClass().equals(CodeSynthProvider.CodeSynthProviderInfo.class)) { return true; } return false; }
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; }
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; }
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); // } }
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; }
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); }
public boolean isDeviceSupported(MidiDevice.Info info) { MidiDevice.Info[] devices = getDeviceInfo(); for (Info element : devices) { if (info.equals(element)) { return true; } } return false; }
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())); }