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

default sequencer does not set the tempo factor

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      mantis
    • CPU:
      generic
    • OS:
      generic

      Description



      Name: vtR10009 Date: 07/18/2002


        Default sequencer does not allow to set tempo factor, tempo in BPM and
      tempo in MPQ when the sequence is not set.

      This bug causes failure of new JCK test:
        api/javax_sound/midi/Sequencer/index.html#Tempo
        
      To reproduce the bug run the following test with JDK build 1.4.1-rc-b16:
      ------------------------------- test.java --------------------------------
      import javax.sound.midi.*;

      public class test{

          public static void main(String args[]) {
              boolean failed = false;
              Sequencer seq = null;

              try {
                  seq = MidiSystem.getSequencer();
                  seq.open();
          
                  seq.setTempoInMPQ(3.0f);
                  if (seq.getTempoInMPQ() != 3.0f) {
                      System.err.println("getTempoInMPQ() returns wrong value : "
                              + seq.getTempoInMPQ());
                      failed = true;
                  }
          
                  seq.setTempoFactor(2.0f);
                  if (seq.getTempoFactor() != 2.0f) {
                      System.err.println("getTempoFactor() returns: " +
      seq.getTempoFactor());
                      failed = true;
                  }

                  float bpmTempo = 120.0f;
                  seq.setTempoInBPM(bpmTempo);
                  if (seq.getTempoInMPQ() != (60000000.0f/seq.getTempoInBPM())) {
                      System.err.println("getTempoInMPQ() returns: " +
      seq.getTempoInMPQ());
                      System.err.println("getTempoInBPM() returns: " +
      seq.getTempoInBPM());
                      failed = true;
                  }

              } catch (MidiUnavailableException mue) {
                  System.err.println("MidiUnavailableException was thrown: " + mue);
                  System.err.println("could not test.");
              } finally {
                  if (seq != null) seq.close();
              }
              
              if( failed ) {
                  System.err.println("test failed");
                  System.exit(1);
              } else {
                  System.out.println("OKAY");
                  System.exit(0);
              }
              
          }
      }

      ---------------------------Logs-------------------------------------------
      novo101:templates$ javac test.java; java -showversion test
      java version "1.4.1-rc"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-rc-b16)
      Java HotSpot(TM) Client VM (build 1.4.1-rc-b16, mixed mode)

      getTempoInMPQ() return wrong value : 0.0
      getTempoFactor() returns: 0.0
      getTempoInMPQ() returns: 0.0
      getTempoInBPM() returns: 0.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: