|
Description
|
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 :
customer 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)
======================================================================
|