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

AudioFormat does not handle uncommon bit sizes correctly

XMLWordPrintable

    • mantis
    • generic
    • generic



      Name: fb126949 Date: 09/27/2002


      if you want to create e.g. a mono PCM AudioFormat with 18 bits sample size, the frame size should be 3 bytes. But the second constructor of AudioFormat creates an instance of AudioFormat with a 2 byte frame size.

      The following code demonstrates the problem:

      int bits = 18;
      AudioFormat format = new AudioFormat(44100.0f, bits, 1, true, false);
      if (format.getFrameSize() * 8 < bits) {
      System.out.println("bits = "+bits+" do not fit into a "+format.getFrameSize()+" bytes sample!");
      throw new Exception("Test failed");
      } else
      System.out.println("bits = "+bits+" fit OK into a "+format.getFrameSize()+" bytes sample!");
      System.out.println("Test passed");



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

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: