JDK-4902967 : Sequencer does not call its registered receivers
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.sound
  • Affected Version: 1.4.2
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2003-08-07
  • Updated: 2003-09-27
  • Resolved: 2003-09-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 tigerFixed
Description

Name: rmT116609			Date: 08/07/2003


FULL PRODUCT VERSION :
java version "1.4.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)

java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)

FULL OPERATING SYSTEM VERSION :
Microsoft Windows 2000 [Version 5.00.2195]

A DESCRIPTION OF THE PROBLEM :
If I connect to the internal Sequencer some Receiver
objects (they are connected to some Sequencer's
Transmitters), these Receiver objects receive nothing.

Sequencer sends data only to the internal Synthesizer
(though I have not explicitly connected it). Furthermore I
can't get this synthesizer disconnected from the sequencer.

I think this problem will be corrected when problem
4773012 (implement a new stand-alone sequencer) will
be solved. I've read it is planned for Java sdk 1.5.
When is this release planned ?


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Sequencer seq = MidiSystem.getSequencer();
2. seq.open();
3. MyReceiver rec = new MyReceiver(); // implements Receiver
4. seq.getTransmitter().setReceiver(rec);
5 ... // Load the sequencer with a Midi sequence
6. seq.start();


EXPECTED VERSUS ACTUAL BEHAVIOR :
The rec receiver receives nothing, but you can hear the
Midi sequencer played on the internal synth.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.sound.midi.*;


/**
 * Show the problem that the internal Sequencer never calls registered
receivers.
 * It only and always calls the internal Synthesizer instead.
 */
public class TestSequencer
{
    public static void main(String[] args)
    {
        try
        {
            // Prepare internal sequencer
            Sequencer sqr = MidiSystem.getSequencer();
            sqr.open();
            sqr.setTempoInBPM(120);

            // Prepare some music to play
            Sequence seq = new Sequence(Sequence.PPQ, 96);
            Track tck = seq.createTrack();
            ShortMessage note1 = new ShortMessage();
            ShortMessage note2 = new ShortMessage();
            ShortMessage note3 = new ShortMessage();
            note1.setMessage(ShortMessage.NOTE_ON, 1, 64, 100); // channel=1,
pitch=64, velocity=100
            note2.setMessage(ShortMessage.NOTE_ON, 1, 66, 100);
            note3.setMessage(ShortMessage.NOTE_ON, 1, 70, 100);
            tck.add(new MidiEvent(note1, 0));
            tck.add(new MidiEvent(note2, 100));
            tck.add(new MidiEvent(note3, 200));
            sqr.setSequence(seq);

            // Connect my receiver
            MyReceiver rcv = new MyReceiver();
            sqr.getTransmitter().setReceiver(rcv);


            // Start the song : synth will play but MyReceiver never called.
            sqr.start();
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }
}

// My receiver that print a line when something is receiver.
class MyReceiver implements Receiver
{
    public void send(MidiMessage msg, long timestamp)
    {
        System.out.println("MyReceiver received something !");
    }

    public void close()
    {
    }
}
---------- END SOURCE ----------

CUSTOMER WORKAROUND :
Use another Sequencer implementation...
(Incident Review ID: 178675) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger FIXED IN: tiger INTEGRATED IN: tiger tiger-b22
14-06-2004

PUBLIC COMMENTS Sequencer does not call its registered receivers
10-06-2004

EVALUATION ###@###.### 2003-08-07 Known problem, duplicate of 4269995. I leave this bug open so that a regression test needs to be written for tiger. ###@###.### 2003-09-26 Fixed with new real time sequencer implementation.
26-09-2003