Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6744764

LUE when opening a SourceDataLine on Windows 2003

XMLWordPrintable

    • generic
    • windows_2003

      An attempt to open a SourceDataLine leads to LineUnavailableException on Windows 2003 (first catch - JDK7 b32).
      See the example below.

      -------------------------------------------------------------------------------------
      package testapp.sound;

      import javax.sound.sampled.AudioSystem;
      import javax.sound.sampled.SourceDataLine;

      public class LUE {
          
          /** Creates a new instance of LUE */
          public static void main(String[] argv) {
              LUE inst = new LUE();
              
              try {
                  inst.m1();
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
          
          public void m1() throws Exception {
              // Retrieving a line for "any audio format"
              SourceDataLine line = AudioSystem.getSourceDataLine(null);
              System.out.println("Line: " + line.getLineInfo() );
              System.out.println("Java class of the line: " + line.getClass().getName());
              line.open();
          }
      }
      -------------------------------------------------------------------------------------

      The output:
      -------------------------------------------------------------------------------------
      $ java -cp classes/ testapp/sound/LUE
      Line: interface SourceDataLine supporting 8 audio formats, and buffers of at least 32 bytes
      Java class of the line: com.sun.media.sound.DirectAudioDevice$DirectSDL
      javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian not supported.
              at com.sun.media.sound.DirectAudioDevice$DirectDL.implOpen(DirectAudioDevice.java:511)
              at com.sun.media.sound.AbstractDataLine.open(AbstractDataLine.java:124)
              at com.sun.media.sound.AbstractDataLine.open(AbstractDataLine.java:416)
              at testapp.sound.LUE.m1(LUE.java:32)
              at testapp.sound.LUE.main(LUE.java:22)
      -------------------------------------------------------------------------------------

            Unassigned Unassigned
            ashusher Alexander Shusherov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: