Category : C Source Code
Archive   : MPUSR2.ZIP
Filename : READTEST.C

 
Output of file : READTEST.C contained in archive : MPUSR2.ZIP
/*

TEST MIDI.C Midi Read functionality.


*/

#include
#include
#include "std.h"
#include "midi.h"
#include


#define PROGNAME "READTEST"

#define printf cprintf
#define CR "\r\n"

void midiError(int midi_error_code) {
printf(PROGNAME ": %s\n",MidiErrorString(midi_error_code));
exit(9);
}

void PrintMidiMessage(MidiMessageT *msg) {
UCHAR midi_msg[3];

GetMidiMessageData(msg,&midi_msg[0],&midi_msg[1],&midi_msg[2]);
printf("%s" CR,MidiName(midi_msg));
}
#pragma argsused
int main(int argc, char**argv) {
int result;
MidiChannelT *channel;
MidiMessageT *msg;

directvideo = 1;
fprintf(stderr,"MIDIDBG v1.1 - Trace all MIDI commands on the screen" CR
"Copyright (c) 1990, Robin Davies" CR
CR
);
channel = CreateMidiChannel(
0, // base_address
0, // int #
32760, // buffer size
STOP_MODE, // Operating mode
MPU_INTERNAL_CLOCK, // internal clock
60, // Beats per minute
MPU_TIMEBASE_192, // Timebase
0, // Metronome beats per measure
MPU_RX_ALL | MPU_DEFAULT_THRU, // rx/thru messages
-1, // midi_channel_mask (rx all midi channels)
1, // Record tracks
&result
);

if (channel == NULL) {
midiError(result);
}

SetMidiOperatingMode(channel,RECORD_MODE);
while (YES) {
msg = ReceiveMidiMessage(channel);
if ((result = MidiStatus(channel)) != 0) {
midiError(result);
}
if (msg != NULL) {
PrintMidiMessage(msg);
FreeMidiMessage(msg);
} else {
if (kbhit())
break;
}
}
DestroyMidiChannel(channel);
getch();
return 0;
}


  3 Responses to “Category : C Source Code
Archive   : MPUSR2.ZIP
Filename : READTEST.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/