R
Rene Schmidt
Why doen't the following code work in Java 1.5. It used to work in Java 1.4,
but in 1.5 I get nothing but silence.
Thanks for any help.
---------------------- snip
import javax.sound.midi.*;
public class Test
{ static boolean Warning=false;
public static void beep (int note, int dur)
{ try
{ Synthesizer synth=MidiSystem.getSynthesizer();
synth.open();
MidiChannel[] channels=synth.getChannels();
MidiChannel channel=channels[0];
channel.programChange(0);
channel.noteOn(note,50);
Thread.sleep(dur);
channel.noteOff(50);
synth.close();
}
catch (Exception e)
{ System.out.println(e);
}
}
public static void main(String[] args)
{ beep(60,1000);
beep(62,1000);
beep(60,2000);
System.exit(0);
}
}
but in 1.5 I get nothing but silence.
Thanks for any help.
---------------------- snip
import javax.sound.midi.*;
public class Test
{ static boolean Warning=false;
public static void beep (int note, int dur)
{ try
{ Synthesizer synth=MidiSystem.getSynthesizer();
synth.open();
MidiChannel[] channels=synth.getChannels();
MidiChannel channel=channels[0];
channel.programChange(0);
channel.noteOn(note,50);
Thread.sleep(dur);
channel.noteOff(50);
synth.close();
}
catch (Exception e)
{ System.out.println(e);
}
}
public static void main(String[] args)
{ beep(60,1000);
beep(62,1000);
beep(60,2000);
System.exit(0);
}
}