"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/instrum.c" between
libtimidity-0.2.6.tar.gz and libtimidity-0.2.7.tar.gz

About: libTiMidity is a MIDI to WAVE converter library that uses Gravis Ultrasound-compatible patch files to generate digital audio data from General MIDI files.

instrum.c  (libtimidity-0.2.6):instrum.c  (libtimidity-0.2.7)
skipping to change at line 189 skipping to change at line 189
#else #else
#define TMPSIZE TIM_MAXPATH #define TMPSIZE TIM_MAXPATH
#endif #endif
MidInstrument *ip; MidInstrument *ip;
MidSample *sp; MidSample *sp;
FILE *fp; FILE *fp;
char tmp[TMPSIZE]; char tmp[TMPSIZE];
int i,j; int i,j;
static const char *patch_ext[] = PATCH_EXT_LIST; static const char *patch_ext[] = PATCH_EXT_LIST;
TIMI_UNUSED(percussion);
*out = NULL; *out = NULL;
if (!name) return; if (!name) return;
/* Open patch file */ /* Open patch file */
if ((fp=timi_openfile(name)) == NULL) if ((fp=timi_openfile(name)) == NULL)
{ {
/* Try with various extensions */ /* Try with various extensions */
for (i=0; patch_ext[i]; i++) for (i=0; patch_ext[i]; i++)
{ {
if (strlen(name)+strlen(patch_ext[i])<sizeof(tmp)) if (strlen(name)+strlen(patch_ext[i])<sizeof(tmp))
skipping to change at line 256 skipping to change at line 257
ip->sample = (MidSample *) timi_calloc(sizeof(MidSample) * ip->samples); ip->sample = (MidSample *) timi_calloc(sizeof(MidSample) * ip->samples);
if (!ip->sample) goto nomem; if (!ip->sample) goto nomem;
for (i=0; i<ip->samples; i++) for (i=0; i<ip->samples; i++)
{ {
uint8 fractions; uint8 fractions;
sint32 tmplong; sint32 tmplong;
uint16 tmpshort; uint16 tmpshort;
uint8 tmpchar; uint8 tmpchar;
#define READ_CHAR(thing) \ #define READ_CHAR(thing) \
if (1 != fread(&tmpchar, 1, 1, fp)) goto badread; \ if (1 != fread(&tmpchar, 1, 1, fp)) goto badread; \
thing = tmpchar; thing = tmpchar;
#define READ_SHORT(thing) \ #define READ_SHORT(thing) \
if (1 != fread(&tmpshort, 2, 1, fp)) goto badread;\ if (1 != fread(&tmpshort, 2, 1, fp)) goto badread; \
thing = SWAPLE16(tmpshort); thing = SWAPLE16(tmpshort);
#define READ_LONG(thing) \ #define READ_LONG(thing) \
if (1 != fread(&tmplong, 4, 1, fp)) goto badread; \ if (1 != fread(&tmplong, 4, 1, fp)) goto badread; \
thing = SWAPLE32(tmplong); thing = SWAPLE32(tmplong);
fseek(fp, 7, SEEK_CUR); /* Skip the wave name */ fseek(fp, 7, SEEK_CUR); /* Skip the wave name */
if (1 != fread(&fractions, 1, 1, fp)) if (1 != fread(&fractions, 1, 1, fp))
goto badread; goto badread;
sp=&(ip->sample[i]); sp=&(ip->sample[i]);
READ_LONG(sp->data_length); READ_LONG(sp->data_length);
READ_LONG(sp->loop_start); READ_LONG(sp->loop_start);
 End of changes. 2 change blocks. 
9 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)