import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.sound.midi.MidiChannel; import javax.sound.midi.MidiSystem; import javax.sound.midi.Synthesizer; import javax.swing.JApplet; @SuppressWarnings("serial") public class kolmkola extends JApplet implements MouseListener{ public kolmkola(){ } public static void main(String[] arg) throws Exception{ Synthesizer synthesizer = MidiSystem.getSynthesizer(); synthesizer.open(); MidiChannel kanal = synthesizer.getChannels()[0]; // kanal 0; int helistik = 0; int korgus1 = 0; int korgus2 = 0; int korgus3 = 0; String shelistik = "C"; if(shelistik.equals("C")){ helistik = 60; } if(shelistik.equals("D")){ helistik = 62; } if(shelistik.equals("E")){ helistik = 64; } if(shelistik.equals("F")){ helistik = 65; } if(shelistik.equals("G")){ helistik = 67; } if(shelistik.equals("A")){ helistik = 69; } if(shelistik.equals("B")){ helistik = 71; } if(shelistik.equals("C2")){ helistik = 72; } korgus1 = helistik; korgus2 = helistik+4; korgus3 = helistik+7; int valjus = 65; //keskmine kanal.noteOn(korgus1, valjus); kanal.noteOn(korgus2, valjus); kanal.noteOn(korgus3, valjus); Thread.sleep(3000); /* kanal.noteOff(korgus1); kanal.noteOff(korgus2); kanal.noteOff(korgus3);*/ kanal.allNotesOff(); System.exit(0); } public void mouseClicked(MouseEvent arg0) {} public void mouseEntered(MouseEvent arg0) {} public void mouseExited(MouseEvent arg0) {} public void mousePressed(MouseEvent arg0) {} public void mouseReleased(MouseEvent arg0) {} }