/* CREPRE.C * The routine that implements the 'Create Preset' 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" /* CRE_PRESET * Create a new preset. * Returns 0 on no error, or a negative error code. */ int cre_preset(chan,pnum) int chan; /* MIDI channel */ int pnum; /* Preset number */ { int i; /* Send instruction to create a preset */ send_head(chan); /* Send SysEx head */ mpu_sbyte(CRE_PRESET); /* 'Create Preset' message */ send12(0x00); /* Instrument number (dummy) */ send12(0x00); /* Layer number (dummy) */ send12(0x00); /* Wavesample number (dummy) */ send12((ushort) pnum); /* Preset 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 */ }