Example #1
0
static int process_sdta(int size, SFInfo *sf, FILE *fd)
{
	while (size > 0) {
		SFChunk chunk;

		/* read a sub chunk */
		READCHUNK(chunk, fd); size -= 8;
		if (feof(fd))
			return -1;

		switch (chunkid(chunk.id)) {
		case SNAM_ID:
			/* sample name list */
			load_sample_names(chunk.size, sf, fd);
			break;
		case SMPL_ID:
			/* sample data starts from here */
			sf->samplepos = ftell(fd);
			sf->samplesize = chunk.size;
			FSKIP(chunk.size, fd);
			break;
		default:
			FSKIP(chunk.size, fd);
			break;
		}
		size -= chunk.size;
	}
	return 0;
}
Example #2
0
int Instruments::process_sdta(int size, SFInfo *sf, struct timidity_file *fd)
{
	while (size > 0) {
		SFChunk chunk;

		/* read a sub chunk */
		if (READCHUNK(&chunk, fd) <= 0)
			return -1;
		size -= 8;

		ctl_cmsg(CMSG_INFO, VERB_DEBUG, " %c%c%c%c:",
			chunk.id[0], chunk.id[1], chunk.id[2], chunk.id[3]);
		switch (chunkid(chunk.id)) {
		case SNAM_ID:
			/* sample name list */
			load_sample_names(chunk.size, sf, fd);
			break;
		case SMPL_ID:
			/* sample data starts from here */
			sf->samplepos = tf_tell(fd);
			sf->samplesize = chunk.size;
			FSKIP(chunk.size, fd);
			break;
		default:
			FSKIP(chunk.size, fd);
			break;
		}
		size -= chunk.size;
	}
	return 0;
}