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

SequencePlayer cannot schedule events out of order

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Not an Issue
    • Affects Version/s: 1.0
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:

      Description

      mail from tim thompson:

      From: "Tim Thompson" <###@###.###>
      To: <###@###.###>
      Cc: "Michael Bundschuh" <Michael.Bundschuh@Eng>
      Subject: feedback on Java Sound API
      Date: Thu, 24 Dec 1998 22:11:07 -0800
      MIME-Version: 1.0
      Content-Transfer-Encoding: 7bit
      X-Priority: 3
      X-MSMail-Priority: Normal
      X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0

      Hi,
            I'm evaluating the Java Sound API - specifically
      the MIDI parts. I'm trying to use the Java Sound API to
      replace the native methods I've used for MIDI I/O.
      In order to get the scheduling service
      I need, I'm using the SequencePlayer, and writing
      individual Buffers (with MidiMessages) to it.
      (I don't want to just play a MIDI File, I want to do
      interactive MIDI.)

      The ability to schedule individual messages (with
      TimeStamp info) is what I need, and it looks like the
      write() method of SequencePlayer provides this capability.

      First, the values I have to give to Buffer.setTimeStamp()
      seem very high - it says they should be ticks, but I have
      to give it a value of 2500000 to get any delay at all.
      is it microseconds?

      The main problem I have is that it appears as if the
      write() method of SequencePlayer inserts the messages
      into a list, and assumes that they are being written in
      monotonically-increasing-TimeStamp order.
      Therefore if I I do a write() of Buffers with timestamps of:

         a note-on message with timestamp 0
         a note-off message with timestamp 2500000
         a note-on message with timestamp 0
         a note-off message with timestamp 2500000

      the third message will not get sent until after the second
      message is sent.

      Is this the intended behaviour of SequencePlayer.write()?

      If so, it's usefulness is very limited for interactive MIDI things.
      It's close, though - all it needs to do is an insertion sort
      on the messages it is given. This only needs to be done if
      the message's timestamp is less than the last message in
      the current list - otherwise it can be added to the end (as I
      assume it's currently doing). So, only applications that
      actually need this scheduling feature will suffer any sorting
      overhead. (the only overhead for all applications will be the
      need for SequencePlayer to maintain
      the "last message timestamp"). Applications that
      use the load(MediaStream) method won't be affected,
      and Applications that use DirectPlayer won't be affected either.

      Basically I want the ability to schedule individual MIDI
      messages independently. In order to do this, do I have
      to create a separate SequencerPlayer for every message?
      In the applications I want to consider, it is not possible
      to determine everything beforehand - it's all generated
      on-the-fly. Let me know what you think the best method
      is to get independently-scheduled individual MIDI messages.

      Thanks, and congratulations on the first release of the
      Java Sound API - I'm looking forward to the things people
      (including me) develop with it.

           ...Tim ###@###.###...

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              kkytlesunw Kara Kytle (Inactive)
              Reporter:
              kkytlesunw Kara Kytle (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: