[Audio-engine-dev] Possible bugs

Andreas Wenger info at xenoage.com
Wed Feb 6 09:08:10 PST 2008


Hi,


I'm no experienced Java Sound user, so please forgive me if the following
"bugs" are not caused by Gervill but my own program.

I tried to integrate Gervill into my program Xenoage Player, which
is a free MIDI player for MusicXML files, http://www.xenoage.com/player/


First:

This works:
> sequencer = MidiSystem.getSequencer();
> synthesizer = MidiSystem.getSynthesizer();
But this fails (works perfectly with old Java Sound):

> sequencer = MidiSystem.getSequencer(false);
> synthesizer = MidiSystem.getSynthesizer();
> Transmitter seqTransmitter = sequencer.getTransmitter();
> seqTransmitter.setReceiver(synthesizer.getReceiver());
with
> java.lang.NullPointerException
>     at com.sun.media.sound.SoftReceiver.<init>(Unknown Source)
>     at com.sun.media.sound.SoftSynthesizer.getReceiver(Unknown Source)
>     at com.xenoage.player.Player.<init>(Player.java:79)
Line 79 is "seqTransmitter.setReceiver(synthesizer.getReceiver());"


Second:

This is the way I change the playback volume (maybe this is bad code,
but it was the only way it worked for me with old Java Sound):

> MidiChannel[] channels = synthesizer.getChannels();
> //...
> for (int i = 0; i < channels.length; i++)
> {
>   channels[i].controlChange(7, (int) (volume * max));
> }
This doesn't change the volume, while old Java Sound does.


If it helps, code is available by SVN, see the website.
If these are no bugs, please forgive me ;-)

Bye,


Andi








More information about the audio-engine-dev mailing list