src/share/classes/javax/sound/midi/MidiSystem.java

Print this page

        

*** 185,205 **** * @return an array of <code>MidiDevice.Info</code> objects, one * for each installed MIDI device. If no such devices are installed, * an array of length 0 is returned. */ public static MidiDevice.Info[] getMidiDeviceInfo() { ! List allInfos = new ArrayList(); ! List providers = getMidiDeviceProviders(); for(int i = 0; i < providers.size(); i++) { ! MidiDeviceProvider provider = (MidiDeviceProvider) providers.get(i); MidiDevice.Info[] tmpinfo = provider.getDeviceInfo(); for (int j = 0; j < tmpinfo.length; j++) { allInfos.add( tmpinfo[j] ); } } ! MidiDevice.Info[] infosArray = (MidiDevice.Info[]) allInfos.toArray(new MidiDevice.Info[0]); return infosArray; } /** --- 185,205 ---- * @return an array of <code>MidiDevice.Info</code> objects, one * for each installed MIDI device. If no such devices are installed, * an array of length 0 is returned. */ public static MidiDevice.Info[] getMidiDeviceInfo() { ! List<MidiDevice.Info> allInfos = new ArrayList<>(); ! List<MidiDeviceProvider> providers = getMidiDeviceProviders(); for(int i = 0; i < providers.size(); i++) { ! MidiDeviceProvider provider = providers.get(i); MidiDevice.Info[] tmpinfo = provider.getDeviceInfo(); for (int j = 0; j < tmpinfo.length; j++) { allInfos.add( tmpinfo[j] ); } } ! MidiDevice.Info[] infosArray = allInfos.toArray(new MidiDevice.Info[0]); return infosArray; } /**
*** 212,225 **** * @throws IllegalArgumentException if the info object does not represent * a MIDI device installed on the system * @see #getMidiDeviceInfo */ public static MidiDevice getMidiDevice(MidiDevice.Info info) throws MidiUnavailableException { ! List providers = getMidiDeviceProviders(); for(int i = 0; i < providers.size(); i++) { ! MidiDeviceProvider provider = (MidiDeviceProvider) providers.get(i); if (provider.isDeviceSupported(info)) { MidiDevice device = provider.getDevice(info); return device; } } --- 212,225 ---- * @throws IllegalArgumentException if the info object does not represent * a MIDI device installed on the system * @see #getMidiDeviceInfo */ public static MidiDevice getMidiDevice(MidiDevice.Info info) throws MidiUnavailableException { ! List<MidiDeviceProvider> providers = getMidiDeviceProviders(); for(int i = 0; i < providers.size(); i++) { ! MidiDeviceProvider provider = providers.get(i); if (provider.isDeviceSupported(info)) { MidiDevice device = provider.getDevice(info); return device; } }
*** 526,539 **** throws InvalidMidiDataException, IOException { SoundbankReader sp = null; Soundbank s = null; ! List providers = getSoundbankReaders(); for(int i = 0; i < providers.size(); i++) { ! sp = (SoundbankReader)providers.get(i); s = sp.getSoundbank(stream); if( s!= null) { return s; } --- 526,539 ---- throws InvalidMidiDataException, IOException { SoundbankReader sp = null; Soundbank s = null; ! List<SoundbankReader> providers = getSoundbankReaders(); for(int i = 0; i < providers.size(); i++) { ! sp = providers.get(i); s = sp.getSoundbank(stream); if( s!= null) { return s; }
*** 557,570 **** throws InvalidMidiDataException, IOException { SoundbankReader sp = null; Soundbank s = null; ! List providers = getSoundbankReaders(); for(int i = 0; i < providers.size(); i++) { ! sp = (SoundbankReader)providers.get(i); s = sp.getSoundbank(url); if( s!= null) { return s; } --- 557,570 ---- throws InvalidMidiDataException, IOException { SoundbankReader sp = null; Soundbank s = null; ! List<SoundbankReader> providers = getSoundbankReaders(); for(int i = 0; i < providers.size(); i++) { ! sp = providers.get(i); s = sp.getSoundbank(url); if( s!= null) { return s; }
*** 589,602 **** throws InvalidMidiDataException, IOException { SoundbankReader sp = null; Soundbank s = null; ! List providers = getSoundbankReaders(); for(int i = 0; i < providers.size(); i++) { ! sp = (SoundbankReader)providers.get(i); s = sp.getSoundbank(file); if( s!= null) { return s; } --- 589,602 ---- throws InvalidMidiDataException, IOException { SoundbankReader sp = null; Soundbank s = null; ! List<SoundbankReader> providers = getSoundbankReaders(); for(int i = 0; i < providers.size(); i++) { ! sp = providers.get(i); s = sp.getSoundbank(file); if( s!= null) { return s; }
*** 639,653 **** * @see InputStream#mark */ public static MidiFileFormat getMidiFileFormat(InputStream stream) throws InvalidMidiDataException, IOException { ! List providers = getMidiFileReaders(); MidiFileFormat format = null; for(int i = 0; i < providers.size(); i++) { ! MidiFileReader reader = (MidiFileReader) providers.get(i); try { format = reader.getMidiFileFormat( stream ); // throws IOException break; } catch (InvalidMidiDataException e) { continue; --- 639,653 ---- * @see InputStream#mark */ public static MidiFileFormat getMidiFileFormat(InputStream stream) throws InvalidMidiDataException, IOException { ! List<MidiFileReader> providers = getMidiFileReaders(); MidiFileFormat format = null; for(int i = 0; i < providers.size(); i++) { ! MidiFileReader reader = providers.get(i); try { format = reader.getMidiFileFormat( stream ); // throws IOException break; } catch (InvalidMidiDataException e) { continue;
*** 685,699 **** * @see #getMidiFileFormat(File) */ public static MidiFileFormat getMidiFileFormat(URL url) throws InvalidMidiDataException, IOException { ! List providers = getMidiFileReaders(); MidiFileFormat format = null; for(int i = 0; i < providers.size(); i++) { ! MidiFileReader reader = (MidiFileReader) providers.get(i); try { format = reader.getMidiFileFormat( url ); // throws IOException break; } catch (InvalidMidiDataException e) { continue; --- 685,699 ---- * @see #getMidiFileFormat(File) */ public static MidiFileFormat getMidiFileFormat(URL url) throws InvalidMidiDataException, IOException { ! List<MidiFileReader> providers = getMidiFileReaders(); MidiFileFormat format = null; for(int i = 0; i < providers.size(); i++) { ! MidiFileReader reader = providers.get(i); try { format = reader.getMidiFileFormat( url ); // throws IOException break; } catch (InvalidMidiDataException e) { continue;
*** 731,745 **** * @see #getMidiFileFormat(URL) */ public static MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException { ! List providers = getMidiFileReaders(); MidiFileFormat format = null; for(int i = 0; i < providers.size(); i++) { ! MidiFileReader reader = (MidiFileReader) providers.get(i); try { format = reader.getMidiFileFormat( file ); // throws IOException break; } catch (InvalidMidiDataException e) { continue; --- 731,745 ---- * @see #getMidiFileFormat(URL) */ public static MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException { ! List<MidiFileReader> providers = getMidiFileReaders(); MidiFileFormat format = null; for(int i = 0; i < providers.size(); i++) { ! MidiFileReader reader = providers.get(i); try { format = reader.getMidiFileFormat( file ); // throws IOException break; } catch (InvalidMidiDataException e) { continue;
*** 786,800 **** * @see InputStream#mark */ public static Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException { ! List providers = getMidiFileReaders(); Sequence sequence = null; for(int i = 0; i < providers.size(); i++) { ! MidiFileReader reader = (MidiFileReader) providers.get(i); try { sequence = reader.getSequence( stream ); // throws IOException break; } catch (InvalidMidiDataException e) { continue; --- 786,800 ---- * @see InputStream#mark */ public static Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException { ! List<MidiFileReader> providers = getMidiFileReaders(); Sequence sequence = null; for(int i = 0; i < providers.size(); i++) { ! MidiFileReader reader = providers.get(i); try { sequence = reader.getSequence( stream ); // throws IOException break; } catch (InvalidMidiDataException e) { continue;
*** 830,844 **** * @throws IOException if an I/O exception occurs while accessing the URL */ public static Sequence getSequence(URL url) throws InvalidMidiDataException, IOException { ! List providers = getMidiFileReaders(); Sequence sequence = null; for(int i = 0; i < providers.size(); i++) { ! MidiFileReader reader = (MidiFileReader) providers.get(i); try { sequence = reader.getSequence( url ); // throws IOException break; } catch (InvalidMidiDataException e) { continue; --- 830,844 ---- * @throws IOException if an I/O exception occurs while accessing the URL */ public static Sequence getSequence(URL url) throws InvalidMidiDataException, IOException { ! List<MidiFileReader> providers = getMidiFileReaders(); Sequence sequence = null; for(int i = 0; i < providers.size(); i++) { ! MidiFileReader reader = providers.get(i); try { sequence = reader.getSequence( url ); // throws IOException break; } catch (InvalidMidiDataException e) { continue;
*** 874,888 **** * @throws IOException if an I/O exception occurs */ public static Sequence getSequence(File file) throws InvalidMidiDataException, IOException { ! List providers = getMidiFileReaders(); Sequence sequence = null; for(int i = 0; i < providers.size(); i++) { ! MidiFileReader reader = (MidiFileReader) providers.get(i); try { sequence = reader.getSequence( file ); // throws IOException break; } catch (InvalidMidiDataException e) { continue; --- 874,888 ---- * @throws IOException if an I/O exception occurs */ public static Sequence getSequence(File file) throws InvalidMidiDataException, IOException { ! List<MidiFileReader> providers = getMidiFileReaders(); Sequence sequence = null; for(int i = 0; i < providers.size(); i++) { ! MidiFileReader reader = providers.get(i); try { sequence = reader.getSequence( file ); // throws IOException break; } catch (InvalidMidiDataException e) { continue;
*** 903,929 **** * @return array of unique file types. If no file types are supported, * an array of length 0 is returned. */ public static int[] getMidiFileTypes() { ! List providers = getMidiFileWriters(); ! Set allTypes = new HashSet(); // gather from all the providers for (int i = 0; i < providers.size(); i++ ) { ! MidiFileWriter writer = (MidiFileWriter) providers.get(i); int[] types = writer.getMidiFileTypes(); for (int j = 0; j < types.length; j++ ) { allTypes.add(new Integer(types[j])); } } int resultTypes[] = new int[allTypes.size()]; int index = 0; ! Iterator iterator = allTypes.iterator(); while (iterator.hasNext()) { ! Integer integer = (Integer) iterator.next(); resultTypes[index++] = integer.intValue(); } return resultTypes; } --- 903,929 ---- * @return array of unique file types. If no file types are supported, * an array of length 0 is returned. */ public static int[] getMidiFileTypes() { ! List<MidiFileWriter> providers = getMidiFileWriters(); ! Set<Integer> allTypes = new HashSet<>(); // gather from all the providers for (int i = 0; i < providers.size(); i++ ) { ! MidiFileWriter writer = providers.get(i); int[] types = writer.getMidiFileTypes(); for (int j = 0; j < types.length; j++ ) { allTypes.add(new Integer(types[j])); } } int resultTypes[] = new int[allTypes.size()]; int index = 0; ! Iterator<Integer> iterator = allTypes.iterator(); while (iterator.hasNext()) { ! Integer integer = iterator.next(); resultTypes[index++] = integer.intValue(); } return resultTypes; }
*** 935,948 **** * @return <code>true</code> if the file type is supported, * otherwise <code>false</code> */ public static boolean isFileTypeSupported(int fileType) { ! List providers = getMidiFileWriters(); for (int i = 0; i < providers.size(); i++ ) { ! MidiFileWriter writer = (MidiFileWriter) providers.get(i); if( writer.isFileTypeSupported(fileType)) { return true; } } return false; --- 935,948 ---- * @return <code>true</code> if the file type is supported, * otherwise <code>false</code> */ public static boolean isFileTypeSupported(int fileType) { ! List<MidiFileWriter> providers = getMidiFileWriters(); for (int i = 0; i < providers.size(); i++ ) { ! MidiFileWriter writer = providers.get(i); if( writer.isFileTypeSupported(fileType)) { return true; } } return false;
*** 957,983 **** * @return the set of unique supported file types. If no file types are supported, * returns an array of length 0. */ public static int[] getMidiFileTypes(Sequence sequence) { ! List providers = getMidiFileWriters(); ! Set allTypes = new HashSet(); // gather from all the providers for (int i = 0; i < providers.size(); i++ ) { ! MidiFileWriter writer = (MidiFileWriter) providers.get(i); int[] types = writer.getMidiFileTypes(sequence); for (int j = 0; j < types.length; j++ ) { allTypes.add(new Integer(types[j])); } } int resultTypes[] = new int[allTypes.size()]; int index = 0; ! Iterator iterator = allTypes.iterator(); while (iterator.hasNext()) { ! Integer integer = (Integer) iterator.next(); resultTypes[index++] = integer.intValue(); } return resultTypes; } --- 957,983 ---- * @return the set of unique supported file types. If no file types are supported, * returns an array of length 0. */ public static int[] getMidiFileTypes(Sequence sequence) { ! List<MidiFileWriter> providers = getMidiFileWriters(); ! Set<Integer> allTypes = new HashSet<>(); // gather from all the providers for (int i = 0; i < providers.size(); i++ ) { ! MidiFileWriter writer = providers.get(i); int[] types = writer.getMidiFileTypes(sequence); for (int j = 0; j < types.length; j++ ) { allTypes.add(new Integer(types[j])); } } int resultTypes[] = new int[allTypes.size()]; int index = 0; ! Iterator<Integer> iterator = allTypes.iterator(); while (iterator.hasNext()) { ! Integer integer = iterator.next(); resultTypes[index++] = integer.intValue(); } return resultTypes; }
*** 991,1004 **** * @return <code>true</code> if the file type is supported for this * sequence, otherwise <code>false</code> */ public static boolean isFileTypeSupported(int fileType, Sequence sequence) { ! List providers = getMidiFileWriters(); for (int i = 0; i < providers.size(); i++ ) { ! MidiFileWriter writer = (MidiFileWriter) providers.get(i); if( writer.isFileTypeSupported(fileType,sequence)) { return true; } } return false; --- 991,1004 ---- * @return <code>true</code> if the file type is supported for this * sequence, otherwise <code>false</code> */ public static boolean isFileTypeSupported(int fileType, Sequence sequence) { ! List<MidiFileWriter> providers = getMidiFileWriters(); for (int i = 0; i < providers.size(); i++ ) { ! MidiFileWriter writer = providers.get(i); if( writer.isFileTypeSupported(fileType,sequence)) { return true; } } return false;
*** 1018,1033 **** * @see #isFileTypeSupported(int, Sequence) * @see #getMidiFileTypes(Sequence) */ public static int write(Sequence in, int fileType, OutputStream out) throws IOException { ! List providers = getMidiFileWriters(); //$$fb 2002-04-17: Fix for 4635287: Standard MidiFileWriter cannot write empty Sequences int bytesWritten = -2; for (int i = 0; i < providers.size(); i++ ) { ! MidiFileWriter writer = (MidiFileWriter) providers.get(i); if( writer.isFileTypeSupported( fileType, in ) ) { bytesWritten = writer.write(in, fileType, out); break; } --- 1018,1033 ---- * @see #isFileTypeSupported(int, Sequence) * @see #getMidiFileTypes(Sequence) */ public static int write(Sequence in, int fileType, OutputStream out) throws IOException { ! List<MidiFileWriter> providers = getMidiFileWriters(); //$$fb 2002-04-17: Fix for 4635287: Standard MidiFileWriter cannot write empty Sequences int bytesWritten = -2; for (int i = 0; i < providers.size(); i++ ) { ! MidiFileWriter writer = providers.get(i); if( writer.isFileTypeSupported( fileType, in ) ) { bytesWritten = writer.write(in, fileType, out); break; }
*** 1052,1067 **** * @see #isFileTypeSupported(int, Sequence) * @see #getMidiFileTypes(Sequence) */ public static int write(Sequence in, int type, File out) throws IOException { ! List providers = getMidiFileWriters(); //$$fb 2002-04-17: Fix for 4635287: Standard MidiFileWriter cannot write empty Sequences int bytesWritten = -2; for (int i = 0; i < providers.size(); i++ ) { ! MidiFileWriter writer = (MidiFileWriter) providers.get(i); if( writer.isFileTypeSupported( type, in ) ) { bytesWritten = writer.write(in, type, out); break; } --- 1052,1067 ---- * @see #isFileTypeSupported(int, Sequence) * @see #getMidiFileTypes(Sequence) */ public static int write(Sequence in, int type, File out) throws IOException { ! List<MidiFileWriter> providers = getMidiFileWriters(); //$$fb 2002-04-17: Fix for 4635287: Standard MidiFileWriter cannot write empty Sequences int bytesWritten = -2; for (int i = 0; i < providers.size(); i++ ) { ! MidiFileWriter writer = providers.get(i); if( writer.isFileTypeSupported( type, in ) ) { bytesWritten = writer.write(in, type, out); break; }
*** 1073,1100 **** } // HELPER METHODS ! ! private static List getMidiDeviceProviders() { ! return getProviders(MidiDeviceProvider.class); } ! ! private static List getSoundbankReaders() { ! return getProviders(SoundbankReader.class); } ! ! private static List getMidiFileWriters() { ! return getProviders(MidiFileWriter.class); } ! ! private static List getMidiFileReaders() { ! return getProviders(MidiFileReader.class); } /** Attempts to locate and return a default MidiDevice of the specified * type. --- 1073,1100 ---- } // HELPER METHODS ! @SuppressWarnings("unchecked") ! private static List<MidiDeviceProvider> getMidiDeviceProviders() { ! return (List<MidiDeviceProvider>) getProviders(MidiDeviceProvider.class); } ! @SuppressWarnings("unchecked") ! private static List<SoundbankReader> getSoundbankReaders() { ! return (List<SoundbankReader>) getProviders(SoundbankReader.class); } ! @SuppressWarnings("unchecked") ! private static List<MidiFileWriter> getMidiFileWriters() { ! return (List<MidiFileWriter>) getProviders(MidiFileWriter.class); } ! @SuppressWarnings("unchecked") ! private static List<MidiFileReader> getMidiFileReaders() { ! return (List<MidiFileReader>) getProviders(MidiFileReader.class); } /** Attempts to locate and return a default MidiDevice of the specified * type.
*** 1107,1117 **** * * @param deviceClass The requested device type, one of Synthesizer.class, * Sequencer.class, Receiver.class or Transmitter.class. * @throws MidiUnavalableException on failure. */ ! private static MidiDevice getDefaultDeviceWrapper(Class deviceClass) throws MidiUnavailableException{ try { return getDefaultDevice(deviceClass); } catch (IllegalArgumentException iae) { MidiUnavailableException mae = new MidiUnavailableException(); --- 1107,1117 ---- * * @param deviceClass The requested device type, one of Synthesizer.class, * Sequencer.class, Receiver.class or Transmitter.class. * @throws MidiUnavalableException on failure. */ ! private static MidiDevice getDefaultDeviceWrapper(Class<?> deviceClass) throws MidiUnavailableException{ try { return getDefaultDevice(deviceClass); } catch (IllegalArgumentException iae) { MidiUnavailableException mae = new MidiUnavailableException();
*** 1126,1137 **** * * @param deviceClass The requested device type, one of Synthesizer.class, * Sequencer.class, Receiver.class or Transmitter.class. * @throws IllegalArgumentException on failure. */ ! private static MidiDevice getDefaultDevice(Class deviceClass) { ! List providers = getMidiDeviceProviders(); String providerClassName = JDK13Services.getDefaultProviderClassName(deviceClass); String instanceName = JDK13Services.getDefaultInstanceName(deviceClass); MidiDevice device; if (providerClassName != null) { --- 1126,1137 ---- * * @param deviceClass The requested device type, one of Synthesizer.class, * Sequencer.class, Receiver.class or Transmitter.class. * @throws IllegalArgumentException on failure. */ ! private static MidiDevice getDefaultDevice(Class<?> deviceClass) { ! List<MidiDeviceProvider> providers = getMidiDeviceProviders(); String providerClassName = JDK13Services.getDefaultProviderClassName(deviceClass); String instanceName = JDK13Services.getDefaultInstanceName(deviceClass); MidiDevice device; if (providerClassName != null) {
*** 1177,1189 **** @param providerClassName The class name of the provider to be returned. @param provider The list of MidiDeviceProviders that is searched. @return A MidiDeviceProvider of the requested class, or null if none is found. */ ! private static MidiDeviceProvider getNamedProvider(String providerClassName, List providers) { for(int i = 0; i < providers.size(); i++) { ! MidiDeviceProvider provider = (MidiDeviceProvider) providers.get(i); if (provider.getClass().getName().equals(providerClassName)) { return provider; } } return null; --- 1177,1190 ---- @param providerClassName The class name of the provider to be returned. @param provider The list of MidiDeviceProviders that is searched. @return A MidiDeviceProvider of the requested class, or null if none is found. */ ! private static MidiDeviceProvider getNamedProvider(String providerClassName, ! List<MidiDeviceProvider> providers) { for(int i = 0; i < providers.size(); i++) { ! MidiDeviceProvider provider = providers.get(i); if (provider.getClass().getName().equals(providerClassName)) { return provider; } } return null;
*** 1198,1208 **** @return A MidiDevice matching the requirements, or null if none is found. */ private static MidiDevice getNamedDevice(String deviceName, MidiDeviceProvider provider, ! Class deviceClass) { MidiDevice device; // try to get MIDI port device = getNamedDevice(deviceName, provider, deviceClass, false, false); if (device != null) { --- 1199,1209 ---- @return A MidiDevice matching the requirements, or null if none is found. */ private static MidiDevice getNamedDevice(String deviceName, MidiDeviceProvider provider, ! Class<?> deviceClass) { MidiDevice device; // try to get MIDI port device = getNamedDevice(deviceName, provider, deviceClass, false, false); if (device != null) {
*** 1230,1240 **** @return A MidiDevice matching the requirements, or null if none is found. */ private static MidiDevice getNamedDevice(String deviceName, MidiDeviceProvider provider, ! Class deviceClass, boolean allowSynthesizer, boolean allowSequencer) { MidiDevice.Info[] infos = provider.getDeviceInfo(); for (int i = 0; i < infos.length; i++) { if (infos[i].getName().equals(deviceName)) { --- 1231,1241 ---- @return A MidiDevice matching the requirements, or null if none is found. */ private static MidiDevice getNamedDevice(String deviceName, MidiDeviceProvider provider, ! Class<?> deviceClass, boolean allowSynthesizer, boolean allowSequencer) { MidiDevice.Info[] infos = provider.getDeviceInfo(); for (int i = 0; i < infos.length; i++) { if (infos[i].getName().equals(deviceName)) {
*** 1257,1268 **** @param deviceClass The requested device type, one of Synthesizer.class, Sequencer.class, Receiver.class or Transmitter.class. @return A Mixer matching the requirements, or null if none is found. */ private static MidiDevice getNamedDevice(String deviceName, ! List providers, ! Class deviceClass) { MidiDevice device; // try to get MIDI port device = getNamedDevice(deviceName, providers, deviceClass, false, false); if (device != null) { --- 1258,1269 ---- @param deviceClass The requested device type, one of Synthesizer.class, Sequencer.class, Receiver.class or Transmitter.class. @return A Mixer matching the requirements, or null if none is found. */ private static MidiDevice getNamedDevice(String deviceName, ! List<MidiDeviceProvider> providers, ! Class<?> deviceClass) { MidiDevice device; // try to get MIDI port device = getNamedDevice(deviceName, providers, deviceClass, false, false); if (device != null) {
*** 1290,1305 **** @param deviceClass The requested device type, one of Synthesizer.class, Sequencer.class, Receiver.class or Transmitter.class. @return A Mixer matching the requirements, or null if none is found. */ private static MidiDevice getNamedDevice(String deviceName, ! List providers, ! Class deviceClass, boolean allowSynthesizer, boolean allowSequencer) { for(int i = 0; i < providers.size(); i++) { ! MidiDeviceProvider provider = (MidiDeviceProvider) providers.get(i); MidiDevice device = getNamedDevice(deviceName, provider, deviceClass, allowSynthesizer, allowSequencer); if (device != null) { --- 1291,1306 ---- @param deviceClass The requested device type, one of Synthesizer.class, Sequencer.class, Receiver.class or Transmitter.class. @return A Mixer matching the requirements, or null if none is found. */ private static MidiDevice getNamedDevice(String deviceName, ! List<MidiDeviceProvider> providers, ! Class<?> deviceClass, boolean allowSynthesizer, boolean allowSequencer) { for(int i = 0; i < providers.size(); i++) { ! MidiDeviceProvider provider = providers.get(i); MidiDevice device = getNamedDevice(deviceName, provider, deviceClass, allowSynthesizer, allowSequencer); if (device != null) {
*** 1316,1326 **** Sequencer.class, Receiver.class or Transmitter.class. @return A MidiDevice is considered appropriate, or null if no appropriate device is found. */ private static MidiDevice getFirstDevice(MidiDeviceProvider provider, ! Class deviceClass) { MidiDevice device; // try to get MIDI port device = getFirstDevice(provider, deviceClass, false, false); if (device != null) { --- 1317,1327 ---- Sequencer.class, Receiver.class or Transmitter.class. @return A MidiDevice is considered appropriate, or null if no appropriate device is found. */ private static MidiDevice getFirstDevice(MidiDeviceProvider provider, ! Class<?> deviceClass) { MidiDevice device; // try to get MIDI port device = getFirstDevice(provider, deviceClass, false, false); if (device != null) {
*** 1346,1356 **** Sequencer.class, Receiver.class or Transmitter.class. @return A MidiDevice is considered appropriate, or null if no appropriate device is found. */ private static MidiDevice getFirstDevice(MidiDeviceProvider provider, ! Class deviceClass, boolean allowSynthesizer, boolean allowSequencer) { MidiDevice.Info[] infos = provider.getDeviceInfo(); for (int j = 0; j < infos.length; j++) { MidiDevice device = provider.getDevice(infos[j]); --- 1347,1357 ---- Sequencer.class, Receiver.class or Transmitter.class. @return A MidiDevice is considered appropriate, or null if no appropriate device is found. */ private static MidiDevice getFirstDevice(MidiDeviceProvider provider, ! Class<?> deviceClass, boolean allowSynthesizer, boolean allowSequencer) { MidiDevice.Info[] infos = provider.getDeviceInfo(); for (int j = 0; j < infos.length; j++) { MidiDevice device = provider.getDevice(infos[j]);
*** 1369,1380 **** @param deviceClass The requested device type, one of Synthesizer.class, Sequencer.class, Receiver.class or Transmitter.class. @return A MidiDevice that is considered appropriate, or null if none is found. */ ! private static MidiDevice getFirstDevice(List providers, ! Class deviceClass) { MidiDevice device; // try to get MIDI port device = getFirstDevice(providers, deviceClass, false, false); if (device != null) { --- 1370,1381 ---- @param deviceClass The requested device type, one of Synthesizer.class, Sequencer.class, Receiver.class or Transmitter.class. @return A MidiDevice that is considered appropriate, or null if none is found. */ ! private static MidiDevice getFirstDevice(List<MidiDeviceProvider> providers, ! Class<?> deviceClass) { MidiDevice device; // try to get MIDI port device = getFirstDevice(providers, deviceClass, false, false); if (device != null) {
*** 1400,1415 **** @param deviceClass The requested device type, one of Synthesizer.class, Sequencer.class, Receiver.class or Transmitter.class. @return A MidiDevice that is considered appropriate, or null if none is found. */ ! private static MidiDevice getFirstDevice(List providers, ! Class deviceClass, boolean allowSynthesizer, boolean allowSequencer) { for(int i = 0; i < providers.size(); i++) { ! MidiDeviceProvider provider = (MidiDeviceProvider) providers.get(i); MidiDevice device = getFirstDevice(provider, deviceClass, allowSynthesizer, allowSequencer); if (device != null) { return device; --- 1401,1416 ---- @param deviceClass The requested device type, one of Synthesizer.class, Sequencer.class, Receiver.class or Transmitter.class. @return A MidiDevice that is considered appropriate, or null if none is found. */ ! private static MidiDevice getFirstDevice(List<MidiDeviceProvider> providers, ! Class<?> deviceClass, boolean allowSynthesizer, boolean allowSequencer) { for(int i = 0; i < providers.size(); i++) { ! MidiDeviceProvider provider = providers.get(i); MidiDevice device = getFirstDevice(provider, deviceClass, allowSynthesizer, allowSequencer); if (device != null) { return device;
*** 1439,1449 **** classes (Sequencer and Synthesizer), this flag has no effect. @return true if the device is considered appropriate according to the rules given above, false otherwise. */ private static boolean isAppropriateDevice(MidiDevice device, ! Class deviceClass, boolean allowSynthesizer, boolean allowSequencer) { if (deviceClass.isInstance(device)) { // This clause is for deviceClass being either Synthesizer // or Sequencer. --- 1440,1450 ---- classes (Sequencer and Synthesizer), this flag has no effect. @return true if the device is considered appropriate according to the rules given above, false otherwise. */ private static boolean isAppropriateDevice(MidiDevice device, ! Class<?> deviceClass, boolean allowSynthesizer, boolean allowSequencer) { if (deviceClass.isInstance(device)) { // This clause is for deviceClass being either Synthesizer // or Sequencer.
*** 1477,1485 **** * Obtains the set of services currently installed on the system * using the SPI mechanism in 1.3. * @return a List of instances of providers for the requested service. * If no providers are available, a List of length 0 will be returned. */ ! private static List getProviders(Class providerClass) { return JDK13Services.getProviders(providerClass); } } --- 1478,1486 ---- * Obtains the set of services currently installed on the system * using the SPI mechanism in 1.3. * @return a List of instances of providers for the requested service. * If no providers are available, a List of length 0 will be returned. */ ! private static List<?> getProviders(Class<?> providerClass) { return JDK13Services.getProviders(providerClass); } }