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

  1. /*********************************************************************
  2. *
  3. *  record               01 Aug 88            Copyright (c) 1988 cMIDI
  4. *
  5. *  cMIDI function library demonstration.  File 7 of 20.
  6. *
  7. *********************************************************************/
  8. #include <cmidi.h>
  9. #include <stdio.h>
  10.  
  11. main( int argc, char *argv[] )
  12.    {
  13.    int page;
  14.  
  15.    /* Read command line. */
  16.    if (argc < 2) 
  17.    {
  18.       printf("Must specify file for storing recorded track data.\n");
  19.       exit(1);
  20.    }
  21.  
  22.    /* Open cmidi. */
  23.    CmidiOpen();
  24.    printf("\nWait... ");
  25.    putch(13);
  26.  
  27.    /* Prepare to record. */
  28.    MpuSwitch(MPU_X_MIDI_BENDER_TO_PC_ON);
  29.    TrackPtrRegister( 1, TRACK_PTR_RECORD );
  30.  
  31.    /* Start recording track. */
  32.    printf("Start recording. Hit any key when finished.  ");
  33.    putch(13);
  34.    TrackRecord();
  35.  
  36.    /* Until any key entered */
  37.    while (!kbhit());
  38.    getch();
  39.  
  40.    /* Stop recording, write track to file, then close cmidi. */
  41.    TrackStop();
  42.    TrackWriteCmidiData( argv[1], 1 );
  43.    CmidiClose( CLOSE_PRINT_ERRORS | CLOSE_RESET_MPU );
  44.    printf("Track is recorded in %s.                     ",argv[1]);
  45.    }
  46.