home *** CD-ROM | disk | FTP | other *** search
/ Sound Sensations! / sound_sensations.iso / demos / midif / lefty.c < prev    next >
Text File  |  1988-09-03  |  1KB  |  38 lines

  1. /********************************************************************
  2. *  lefty                01 Aug 88            Copyright (c) cMIDI 1988  
  3. *  cMIDI function library demonstration.  File 4 of 20.
  4. *
  5. *********************************************************************/
  6. #include <cmidi.h>
  7. #include <stdio.h>
  8.  
  9. main()
  10.    {
  11.    struct cm_message packet;
  12.  
  13.    /* Open cmidi and enable the queue for channel midi messages. */
  14.    CmidiOpen();
  15.    MpuSwitch( MPU_X_MIDI_THRU_OFF );
  16.    QueueMidiChan( ON );
  17.    if (ERRORQUEUED()) { CmidiClose( CLOSE_PRINT_ERRORS ); exit( 1 );}
  18.  
  19.    printf("\nPlay the keyboard. Hit any key when finished.\n");
  20.  
  21.    /* Until any keyboard character is entered */
  22.    while ( !kbhit() )
  23.       {
  24.       if (MIDICHANQUEUED())
  25.          {
  26.          packet = RxMidiChan();
  27.          if (ISNOTEONOROFF(packet))
  28.             packet.data1 = 124 - packet.data1;
  29.          TxMidiChan( packet );
  30.          }
  31.       }
  32.    
  33.    /* Close cmidi. */
  34.    CmidiClose( CLOSE_RESET_MPU );
  35.    }
  36.