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

setMicrosecondPosition() does not work

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      tiger
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description


      Name: vtR10009 Date: 12/07/2001


        setMicrosecondPosition() method does not set position in the sequence.
        getMicrosecondPosition() returns 0.
      This bug causes failure of JCK test:
      api/javax_sound/midi/Sequencer/index.html#Sequencer

      To reproduce the bug run the following test with JDK 1.4.0-rc-b88 build:
      ------------------------------- test.java --------------------------------
      import javax.sound.midi.*;
      import java.io.File;
      import java.io.IOException;
      public class test{
          public static void main(String args[])
          {
              boolean failed = false;
              Sequencer seq = null;
              File seqfile = null;

              try {
                  seq = MidiSystem.getSequencer();
                  seq.open();
                  seqfile = new File("metatest.mid");
                  seq.setSequence(MidiSystem.getSequence(seqfile));
                  seq.setMicrosecondPosition(seq.getMicrosecondLength() - 1);
                  if (seq.getMicrosecondPosition() != (seq.getMicrosecondLength() -
      1)) {
                      System.out.println("getMicrosecondLength() was : "
                              + seq.getMicrosecondLength());
                      System.out.println("getMicrosecondPosition() return wrong value
      : "
                              + seq.getMicrosecondPosition());
                      failed = true;
                  }
                  seq.setSequence(MidiSystem.getSequence(seqfile));
                  seq.setTickPosition(seq.getTickLength() - 1);
                  if (seq.getTickPosition() != (seq.getTickLength() - 1)) {
                      System.out.println("getTickLength() was : " +
      seq.getTickLength());
                      System.out.println("getTickPosition() return wrong value : "
                              + seq.getTickPosition());
                      failed = true;
                  }
              } catch (MidiUnavailableException mue) {
                  System.out.println("MidiUnavailableException was thrown: " + mue);
                  System.out.println("could not test.");
                  return;
              } catch (InvalidMidiDataException imEx) {
                  imEx.printStackTrace();
                  System.out.println("InvalidMidiDataException was thrown.");
                  failed = true;
              } catch (IOException ioe) {
                  System.out.println("Could not open the midi file.");
                  failed = true;
              } finally {
                  if (seq != null) seq.close();
              }

              if (failed == true) {
                  System.out.println("test failed");
              } else {
                  System.out.println("OKAY");
             }
          }
      }
      ---------------------------Logs-------------------------------------------
      $ java -version
      java version "1.4.0-rc"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-rc-b88)
      Java HotSpot(TM) Client VM (build 1.4.0-rc-b88, mixed mode)
      $ javac test.java
      $ java test
      getMicrosecondLength() was : 31904280
      getMicrosecondPosition() return wrong value : 0
      getTickLength() was : 980138
      getTickPosition() return wrong value : 0
      test failed

      --------------------------------------------------------------------------
      ======================================================================

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: