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

sun.audio.AudioStreamSequence is broken in JDK1.2.x

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.3.0
    • 1.2.1
    • client-libs
    • kestrel
    • generic
    • generic



      Name: dbT83986 Date: 05/14/99


      There is a bug in the `sun.audio.AudioContainerInputStream'
      that prevents legacy sound playing in an order
      sequence via `AudioStreamSequence'.

      I think the ACIS is trying to reinterpret (figure out) the type
      audio file twice. Once in the AudioStream and once again
      during the Enumeration of AudioStreamSequence for each
      AudioStream however the seek pointer has not been __rewound__
      to beginning of the input stream!

      BTW: Yes by the way I know that Java Sound is coming soon.
      Let how it can render the quality that gonna be required.

      Peter

      > ===============================================================
      >
      >
      > I have an application that uses the sun.audio.* sound classes in JDK1.1 but
      > does not work on JDK1.2. I think the `AudioStreamSequence' does not work in
      > JDK1.2 at all. I know that sun.audio.* is deprecated but there another way
      > to play audio sounds in sequence (__without the Java Media Framework;-).
      >
      > I am using JDK1.2.1 on Windows NT 4
      >
      > This my test case java class.
      >
      > The Sun audio files actually make a song using a set of riffs. Replace them
      > with something else to test or I can supply a big zip.
      >
      > ___________________________________________________________________________
      > Reply From ###@###.###
      >
      >
      > It does not play on my jdk1.2/green/alpha-linux. ( the demo Animator works
      > ( whi ch
      > is non-swing) & the demo demos/Mix/JavaSound works ( all 9 sound samples )
      > ) Drom the dump ( kill -8 initiated ) it seems to be waiting for more data!
      > Apparently this code from a dos/win machine ?
      > gat
      >
      > ###@###.### wrote:
      >
      > > `audiofr.zip' from my FreeInstaller application (305k!)
      > > and dont forget to tell me if the code worked on JDK1.2/Linux!!! >
      > > P
      >
      >
      > From what I can see of the java/sun code the error is from the start()
      > retrying to
      > figure out what type of sound clips they are. They have already been
      > analysized once, and the file position is not at 0 anymore. There is code
      > in the start() to check this, but the enumeration is hosing this feature.
      >

      > BTW so its not really a .au format error if i didn't make myself clear.
      >
      > Hope this helps more
      > gat
      >
      > [gat@LX sound]$ java_g AudioTest
      > AudioDevice.open(), playing = false
      > Closing device.
      > Waiting for updates.
      > AudioDevice.openChannel(sun.audio.AudioStreamSequence@2c6d4e75): could not
      > creat e
      > stream
      > sun.audio.BadAudioHeaderException: Unknownheader
      > at
      > sun.audio.AudioContainerInputStream.getStream(AudioContainerInputStream.jav
      > a:783 )
      > at sun.audio.AudioDevice.openChannel(AudioDevice.java:109) at
      > sun.audio.AudioPlayer.start(AudioPlayer.java:129)
      > at AudioTest.main(AudioTest.java:64)
      > Press any key to end
      >
      > ___________________________________________________________________________
      >

      I can supply a WinZipped File with the three audio clips upon request.


      // AudioTest.java
      // Audio Files in contained in a ZIP file `audiofr.zip'

      import java.io.*;
      import java.util.*;
      import sun.audio.*;

      public class AudioTest {
          
          public static void main( String [] args ) {
      String audioClip1 = "appres\\audio\\rock-fill.au";
      String audioClip2 = "appres\\audio\\rock-verse.au";
      String audioClip3 = "appres\\audio\\rock-frettap7.au";

      try {
      // This is dumb ass code, basically we maintaining a list of
      // audio file pointers in the stream to each audio clip.
      // Trust me, it makes sense that JavaSoft wrote it this way!
      AudioStream [] audioStream = new AudioStream[16];
      int n=0;
      audioStream[n++] = new AudioStream( new FileInputStream( audioClip1 ));
      audioStream[n++] = new AudioStream( new FileInputStream( audioClip2 ));
      audioStream[n++] = new AudioStream( new FileInputStream( audioClip2 ));
      audioStream[n++] = new AudioStream( new FileInputStream( audioClip3 ));
      audioStream[n++] = new AudioStream( new FileInputStream( audioClip1 ));
      audioStream[n++] = new AudioStream( new FileInputStream( audioClip2 ));
      audioStream[n++] = new AudioStream( new FileInputStream( audioClip2 ));
      audioStream[n++] = new AudioStream( new FileInputStream( audioClip2 ));
      audioStream[n++] = new AudioStream( new FileInputStream( audioClip1 ));
      audioStream[n++] = new AudioStream( new FileInputStream( audioClip1 ));
      audioStream[n++] = new AudioStream( new FileInputStream( audioClip2 ));
      audioStream[n++] = new AudioStream( new FileInputStream( audioClip3 ));


      // Create the audio stream sequence object
      Vector v = new Vector(); for (int q=0; q<audioStream.length; ++q )
      if ( audioStream[q] != null )
      v.addElement(audioStream[q]);

      AudioStreamSequence audiostream =
      new AudioStreamSequence(v.elements());


      // Audio player should play the audio stream sequence
      // but doesn't. Why????
      AudioPlayer.player.start( audiostream );

      System.out.println( "Press any key to end"); System.in.read();

      }
      catch (IOException ioe) {
      System.out.println(ioe);
      }

      // Force garbage collection now if possible System.gc();
      try { Thread.sleep(1000); } catch (InterruptedException ie) { ; }
          }
      }

      // fini
      (Review ID: 63193)
      ======================================================================

            jborgerssunw Jan Borgersen (Inactive)
            dblairsunw Dave Blair (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: