/[classpath]/classpath/javax/sound/midi/MidiSystem.java
ViewVC logotype

Diff of /classpath/javax/sound/midi/MidiSystem.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by green, Mon Sep 26 16:35:00 2005 UTC revision 1.2 by green, Mon Sep 26 17:24:00 2005 UTC
# Line 71  public class MidiSystem Line 71  public class MidiSystem
71     */     */
72    public static MidiDevice.Info[] getMidiDeviceInfo()    public static MidiDevice.Info[] getMidiDeviceInfo()
73    {    {
74      Iterator deviceProviders = ServiceFactory.lookupProviders(MidiDeviceProvider.class);      Iterator deviceProviders =
75            ServiceFactory.lookupProviders(MidiDeviceProvider.class);
76      List infoList = new ArrayList();      List infoList = new ArrayList();
77            
78      while (deviceProviders.hasNext())      while (deviceProviders.hasNext())
# Line 82  public class MidiSystem Line 83  public class MidiSystem
83          infoList.add(infos[--i]);          infoList.add(infos[--i]);
84      }      }
85            
86      return (MidiDevice.Info[]) infoList.toArray(new MidiDevice.Info[infoList.size()]);      return (MidiDevice.Info[])
87            infoList.toArray(new MidiDevice.Info[infoList.size()]);
88    }    }
89        
90    /**    /**
# Line 94  public class MidiSystem Line 96  public class MidiSystem
96     * @throws IllegalArgumentException if the device described by info is not found     * @throws IllegalArgumentException if the device described by info is not found
97     */     */
98    public static MidiDevice getMidiDevice(MidiDevice.Info info)    public static MidiDevice getMidiDevice(MidiDevice.Info info)
99      throws MidiUnavailableException, IllegalArgumentException      throws MidiUnavailableException
100    {    {
101      Iterator deviceProviders = ServiceFactory.lookupProviders(MidiDeviceProvider.class);      Iterator deviceProviders =
102            ServiceFactory.lookupProviders(MidiDeviceProvider.class);
103            
104      if (! deviceProviders.hasNext())      if (! deviceProviders.hasNext())
105        throw new MidiUnavailableException("No MIDI device providers available.");        throw new MidiUnavailableException("No MIDI device providers available.");
# Line 109  public class MidiSystem Line 112  public class MidiSystem
112          return provider.getDevice(info);          return provider.getDevice(info);
113      } while (deviceProviders.hasNext());      } while (deviceProviders.hasNext());
114            
115      throw new IllegalArgumentException("MIDI device " + info + " not available.");      throw new IllegalArgumentException("MIDI device "
116                                           + info + " not available.");
117    }    }
118        
119    /**    /**
# Line 259  public class MidiSystem Line 263  public class MidiSystem
263        if (sb != null)        if (sb != null)
264          return sb;          return sb;
265      }      }
266      throw new InvalidMidiDataException("Cannot read soundbank from file " + file);      throw new InvalidMidiDataException("Cannot read soundbank from file "
267                                           + file);
268    }    }
269    
270    /**    /**
# Line 281  public class MidiSystem Line 286  public class MidiSystem
286        if (sb != null)        if (sb != null)
287          return sb;          return sb;
288      }      }
289      throw new InvalidMidiDataException("Cannot read MidiFileFormat from stream");      throw new InvalidMidiDataException("Can't read MidiFileFormat from stream");
290    }    }
291    
292    /**    /**
# Line 325  public class MidiSystem Line 330  public class MidiSystem
330        if (sb != null)        if (sb != null)
331          return sb;          return sb;
332      }      }
333      throw new InvalidMidiDataException("Cannot read MidiFileFormat from file " + file);      throw new InvalidMidiDataException("Can't read MidiFileFormat from file "
334                                           + file);
335    }    }
336        
337        
# Line 452  public class MidiSystem Line 458  public class MidiSystem
458     * @throws IllegalArgumentException if fileType is not supported for in     * @throws IllegalArgumentException if fileType is not supported for in
459     */     */
460    public static int write(Sequence in, int fileType, OutputStream out)    public static int write(Sequence in, int fileType, OutputStream out)
461      throws IOException, IllegalArgumentException      throws IOException
462    {    {
463      Iterator writers = ServiceFactory.lookupProviders(MidiFileWriter.class);      Iterator writers = ServiceFactory.lookupProviders(MidiFileWriter.class);
464      while (writers.hasNext())      while (writers.hasNext())
# Line 462  public class MidiSystem Line 468  public class MidiSystem
468        if (fw.isFileTypeSupported(fileType, in))        if (fw.isFileTypeSupported(fileType, in))
469          return fw.write(in, fileType, out);          return fw.write(in, fileType, out);
470      }      }
471      throw new IllegalArgumentException("File type " + fileType + " is not supported");      throw new IllegalArgumentException("File type "
472                                           + fileType + " is not supported");
473    }    }
474    
475    /**    /**
# Line 476  public class MidiSystem Line 483  public class MidiSystem
483     * @throws IllegalArgumentException if fileType is not supported for in     * @throws IllegalArgumentException if fileType is not supported for in
484     */     */
485    public static int write(Sequence in, int fileType, File out)    public static int write(Sequence in, int fileType, File out)
486      throws IOException, IllegalArgumentException      throws IOException
487    {    {
488      Iterator writers = ServiceFactory.lookupProviders(MidiFileWriter.class);      Iterator writers = ServiceFactory.lookupProviders(MidiFileWriter.class);
489      while (writers.hasNext())      while (writers.hasNext())
# Line 486  public class MidiSystem Line 493  public class MidiSystem
493        if (fw.isFileTypeSupported(fileType, in))        if (fw.isFileTypeSupported(fileType, in))
494          return fw.write(in, fileType, out);          return fw.write(in, fileType, out);
495      }      }
496      throw new IllegalArgumentException("File type " + fileType + " is not supported");      throw new IllegalArgumentException("File type "
497                                           + fileType + " is not supported");
498    }    }
499  }  }
500    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26