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

Different tick length in Sequence and Sequencer

XMLWordPrintable



      Name: vtR10009 Date: 03/28/2002


      Two methods return time length of Midi Sequence in Java Sound API:
        javax.sound.midi.Sequencer.getTickLength()
        javax.sound.midi.Sequence.getTickLength()

      But these methods return different values for same sequence in
      JDK RI(1.4.1-beta-b06) and spec does not state anything that could
      imply the tick length may differ for particular Sequencer. Note, this
      bug is similar to bug#4659445 but the differrence between the values
      is much greater and I guess it is duplicate of #4659445.

      This bug causes failure of new JCK test:
        api/javax_sound/midi/Sequencer/index.html#Sequencer

      To reproduce the bug run the following test with JDK build 1.4.1-beta-b06:
      ------------------------------- test.java --------------------------------
      import javax.sound.midi.*;
      import java.io.*;

      public class test{
          public static void main(String args[])
          {
              boolean failed = false;
              File seqfile;
              Sequencer seq = null;
              Sequence midiData = null;
              
              try {
                  seq = MidiSystem.getSequencer();
                  seq.open();
                  seqfile = new File(".", args[0]);
                  midiData = MidiSystem.getSequence(seqfile);
                  seq.setSequence(midiData);
                  if (seq.getTickLength() != midiData.getTickLength()) {
                      System.err.println("Sequencer TickLength was : "
                              + seq.getTickLength());
                      System.err.println("Sequence TickLength was : "
                              + midiData.getTickLength());
                      failed = true;
                  }

              } catch (MidiUnavailableException munEx) {
                  munEx.printStackTrace();
              } catch (InvalidMidiDataException invmEx) {
                  invmEx.printStackTrace();
              } catch (IOException ioEx) {
                  ioEx.printStackTrace();
              }
          
              if( failed ) {
                  System.err.println("Test failed!");
              } else {
                  System.out.println("OKAY");
              }
              System.exit(0);
          }
      }
      ---------------------------Logs-------------------------------------------
      novo101:templates$ javac test.java; java -showversion test metatest.mid
      java version "1.4.1-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b06)
      Java HotSpot(TM) Client VM (build 1.4.1-beta-b06, mixed mode)

      Sequencer TickLength was : 980138
      Sequence TickLength was : 15302
      Test failed!

      ======================================================================

            fbomerssunw Florian Bomers (Inactive)
            vitcsunw Vitc Vitc (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: