/********************************************************************* * * echoplay 01 Aug 88 Copyright (c) cMIDI 1988 * * cMIDI function library demonstration. File 8 of 20. * *********************************************************************/ #include #include main( int argc, char *argv[] ) { int i, copies, delay; /* Open cmidi, and prepare the track(s). */ CmidiOpen(); TrackPtrRegister( 1 ,TRACK_PTR_PLAY ); TrackReadCmidiData( argv[1], 1 ); TrackPtrPlayListInsert( 1 ); if ((argc!=4) || ERRORQUEUED()) { printf( "Proper command line format: \n\n" " echoplay filename copies delay \n\n" " where \"filename\" specifies name of file containing track data\n" " \"copies\" specifies number of times track data is copied\n" " \"delay\" specifies # ms between start of successive copies\n"); CmidiClose(CLOSE_RESET_MPU); exit( 1 ); } copies = atoi( argv[2] ); delay = atoi( argv[3] )/5; for (i=2; i<=(copies+1); i++) { TrackPtrRegister( i ,TRACK_PTR_PLAY ); TrackPtrCopy( i, 1 ); TrackPtrPlayListInsert( i ); TrackPtrDelay( i, delay*(i-1) ); TrackPtrVelocityOn( i, -15*(i-1) ); } /* Start playing track(s). */ TrackPlay(); /* Wait until playing has finished, then close cmidi. */ while ( PLAYING() ); CmidiClose( CLOSE_RESET_MPU | CLOSE_PRINT_ERRORS ); }