/*********************************************************************
*
*  play                 01 Aug 88            Copyright (c) 1988 cMIDI
*
*  cMIDI function library demonstration.  File 6 of 20.
*
*********************************************************************/
#include <stdio.h>
#include <cmidi.h>

main( int argc, char *argv[] )
   {

   /* Open cmidi, and prepare the track. */
   CmidiOpen();
   MpuSwitch( MPU_X_MIDI_BENDER_TO_PC_ON );
   TrackPtrRegister( 1, TRACK_PTR_PLAY );
   TrackReadCmidiData( argv[1], 1 );
   TrackPtrPlayListInsert( 1 );
   if (ERRORQUEUED())
      {
      printf("Must specify file containing track data.\n");
      CmidiClose( CLOSE_RESET_MPU );
      exit( 1 );
      }

   /* Start playing track. */
   TrackPlay();

   /* Wait until playing has finished, then close cmidi. */
   while ( PLAYING() );
   CmidiClose( CLOSE_RESET_MPU | CLOSE_PRINT_ERRORS );
   }
