// // Programmer: Craig Stuart Sapp // Creation Date: Sat Jan 1 20:29:45 PST 2005 // Last Modified: Sat Jan 1 21:56:38 PST 2005 // Filename: ...midiio/doc/windowsmidi/keymidi/keymidi3.cpp // URL: http://midiio.sapp.org/doc/windowsmidi/keymidi2/keymidi3.cpp // Syntax: C++; improv library // // Description: The example program shows how to open MIDI output, // send a MIDI message, and close MIDI output using the // MidiIO C++ library instead of accessing the Windows // multimedia library directly. // #include /* basic MIDI synthezier Input/Output interface */ Voice voice; int notekey = 60; int velocity = 100; void description(void) { cout << "Turns a note on/off when a computer key is pressed" << endl; cout << "Press Q to quit" << endl; } void initialization(void) { description(); voice.setPort(synth.getOutputPort()); } void keyboardchar(int key) { if (voice.status()) { voice.off(); cout << "Note turned OFF." << endl; } else { voice.play(0, notekey, velocity); cout << "Note turned ON." << endl; } } void finishup(void) { voice.off(); } void mainloopalgorithms(void) { }