Web design templates - Chapter 22 Java Media Framework and Java Sound
Chapter 22 Java Media Framework and Java Sound (on CD) 1297 59 // assign first channel as default channel 60 channel = channels[ 0 ]; 61 } 62 63 else 64 System.err.println( “No Synthesizer” ); 65 } 66 67 // synthesizer, receiver or transmitter unavailable 68 catch ( MidiUnavailableException noMidiException ) { 69 noMidiException.printStackTrace(); 70 } 71 72 } // end constructor 73 74 // return available instruments 75 public Instrument[] getInstruments() 76 { 77 return instruments; 78 } 79 80 // return synthesizer’s transmitter 81 public Transmitter getTransmitter() 82 { 83 return transmitter; 84 } 85 86 // sound note on through channel 87 public void midiNoteOn( int note, int volume ) 88 { 89 channel.noteOn( note, volume ); 90 } 91 92 // sound note off through channel 93 public void midiNoteOff( int note ) 94 { 95 channel.noteOff( note ); 96 } 97 98 // change to selected instrument 99 public void changeInstrument( int index ) 100 { 101 Patch patch = instruments[ index ].getPatch(); 102 103 channel.programChange( patch.getBank(), 104 patch.getProgram() ); 105 } 106 107 // send custom MIDI messages through transmitter 108 public void sendMessage( int command, int note, int volume ) 109 { Fig. 22.9 MidiSynthesizercan generate notes and send them to another MIDI device (part 3 of 4).
From our experience, we are can tell you that you can find a reliable and cheap webhost service at Java Web Hosting services.