home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sound Sensations!
/
sound_sensations.iso
/
demos
/
midif
/
monitor.c
< prev
next >
Wrap
Text File
|
1988-09-03
|
1KB
|
53 lines
/*********************************************************************
*
* monitor 01 Aug 88 Copyright (c) 1988 cMIDI
*
* cMIDI function library demonstration. File 3 of 20.
*
*********************************************************************/
#include <stdio.h>
#include <cmidi.h>
#define RECEIVE_TIME_OUT 10
main()
{
unsigned char data;
int i, quit=0;
/* Open cmidi and put mpu in uart mode. */
CmidiOpen();
if (ERRORQUEUED()) {CmidiClose( CLOSE_PRINT_ERRORS ); exit( 1 );}
printf("\nPlay the keyboard. Pause for 10 seconds when finished\n\n");
MpuSwitch( MPU_X_UART_MODE );
/* Until time to quit */
while (!quit)
{
for (i=1; i<=16; i++)
{
/* Read data. */
data = MpuUartModeRx( RECEIVE_TIME_OUT );
MpuUartModeTx( data );
/* If a run-time error has occurred */
if (ERRORQUEUED())
{
quit = 1;
break;
}
/* Print 16 bytes of data per line. */
printf( "%2.2X ",data );
if (i==8) printf(" ");
}
printf( "\n" );
}
MpuReset();
/* Close cmidi */
printf( "\n" );
CmidiClose( CLOSE_RESET_MPU );
}