home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sound Sensations!
/
sound_sensations.iso
/
demos
/
midif
/
octaplay.c
< prev
next >
Wrap
Text File
|
1988-09-03
|
1KB
|
45 lines
/*********************************************************************
*
* octaplay 01 Aug 88 Copyright (c) 1988 cMIDI
*
* cMIDI function library demonstration. File 5 of 20.
*
*********************************************************************/
#include <cmidi.h>
#include <stdio.h>
main()
{
struct cm_message packet;
/* Open cmidi and enable the queue for channel midi messages. */
CmidiOpen();
MpuSwitch( MPU_X_MIDI_THRU_OFF );
MpuSwitchCommand( MPU_X_CHANNEL_REF_TABLE_A_OFF );
MpuSwitchCommand( MPU_X_CHANNEL_REF_TABLE_B_OFF );
MpuSwitchCommand( MPU_X_CHANNEL_REF_TABLE_C_OFF );
MpuSwitchCommand( MPU_X_CHANNEL_REF_TABLE_D_OFF );
QueueMidiChan( ON );
if (ERRORQUEUED()) {CmidiClose(CLOSE_PRINT_ERRORS|CLOSE_RESET_MPU); exit();}
printf("\nPlay the keyboard. Hit any key when finished.\n");
/* Until any keys is hit */
while (!kbhit())
{
/* For each note received */
if (MIDICHANQUEUED())
{
TxMidiChan( packet=RxMidiChan() );
if (ISNOTEONOROFF(packet))
{
packet.data1 += 12;
TxMidiChan( packet );
}
}
}
/* Close cmidi. */
CmidiClose( CLOSE_PRINT_ERRORS | CLOSE_RESET_MPU );
}