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

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

TEST MIDI.C Midi Read and Write functionality.


*/

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


#define PROGNAME "DELAYTST"

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

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

#pragma argsused
int main(int argc, char**argv) {
int i;
long t;
int result;
MidiChannelT *channel;
MidiMessageT *msg;

directvideo = 1;
fprintf(stderr,"DELAYTST v1.0 - Echo incoming events with delay\n"
"by Larry Troxler" CR
CR
);
channel = CreateMidiChannel(
0, // base_address
0, // int #
8192, // buffer size
RECORDPLAY_MODE, // Operating mode
MPU_INTERNAL_CLOCK, // internal clock
120, // 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, // Playback tracks
&result
);

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

while (YES) {
msg = ReceiveMidiMessage(channel);
if ((result = MidiStatus(channel)) != 0) {
midiError(result);
}
if (msg != NULL && msg != ((MidiMessageT*)(-1))) {
ScheduleMidiMessage(
channel,
0,
GetMidiMessageReceiveTime(msg) + 1024,
msg
);
} else {
if (kbhit())
break;
}
}
DestroyMidiChannel(channel);
getch();
return 0;
}


  3 Responses to “Category : C Source Code
Archive   : MPUSR2.ZIP
Filename : DELAYTST.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/