/* CPINST.C * The routine that implements the 'Copy Instrument' message. * * Copyright (C) 1991 by Andrew Arensburger. Permission is granted to * use, copy and/or distribute this file freely for non-commercial purposes, * as long as this notice remains intact. Any commercial use is prohibited * without express permission from the author. * * If you make any changes, fix bugs, etc., please send them to me that I * might coordinate fixes and improvements. */ #include #include "eps.h" /* CP_INSTRUMENT * Copy an instrument from 'inst' to 'dest'. * Returns 0 on no error, or a negative error code. */ int cp_instrument(chan,inst,dest) int chan; /* MIDI channel */ edit_spec *inst; /* Source instrument */ edit_spec *dest; /* Destination instrument */ { int i; /* Send instruction to copy an instrument */ send_head(chan); /* Send SysEx head */ mpu_sbyte(CPY_INST); /* 'Copy Instrument' message */ send12(inst->inst_num); /* Source instrument number */ send12(inst->layer_num);/* Source layer number */ send12(inst->ws_num); /* Source wavesample number */ send12(dest->inst_num); /* Destination instrument number */ send12(dest->layer_num);/* Destination layer number */ send12(dest->ws_num); /* Destination wavesample number */ send_tail(); /* Send SysEx tail */ if (timeout(SHORT_TIMEOUT)) return(-1); /* Short timeout occurred */ /* Receive response to see if everything went well */ i = recv_response(NULL); wait(BREATHER); if (i == ACK) return(0); /* All went well */ else return(-1); /* There was some error */ }