M
Momo
A Java program that I've written that makes sounds works fine when I
test it with appletviewer, but not when I use a browser (Firefox or
Explorer). The difference is that when I call the MidiSystem
synthesizer with getAvailableInstruments, I get a bunch of instruments
(411) when running it with appletviewer, but none when using a browser.
Why the difference? A short program that demonstrates my problem is
below.
Momo
import javax.swing.*;
import javax.sound.midi.*;
public class SimpleSound extends JApplet
{
public void init()
{
try {
Synthesizer synth=MidiSystem.getSynthesizer();
synth.open();
Instrument[] instr=synth.getAvailableInstruments();
JOptionPane.showMessageDialog(null,"instr.length="+instr.length);
}
catch (MidiUnavailableException e) {
}
}
}
test it with appletviewer, but not when I use a browser (Firefox or
Explorer). The difference is that when I call the MidiSystem
synthesizer with getAvailableInstruments, I get a bunch of instruments
(411) when running it with appletviewer, but none when using a browser.
Why the difference? A short program that demonstrates my problem is
below.
Momo
import javax.swing.*;
import javax.sound.midi.*;
public class SimpleSound extends JApplet
{
public void init()
{
try {
Synthesizer synth=MidiSystem.getSynthesizer();
synth.open();
Instrument[] instr=synth.getAvailableInstruments();
JOptionPane.showMessageDialog(null,"instr.length="+instr.length);
}
catch (MidiUnavailableException e) {
}
}
}