当前位置: 首页>>代码示例>>C++>>正文


C++ LOAD_INIT函数代码示例

本文整理汇总了C++中LOAD_INIT函数的典型用法代码示例。如果您正苦于以下问题:C++ LOAD_INIT函数的具体用法?C++ LOAD_INIT怎么用?C++ LOAD_INIT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了LOAD_INIT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: emod_load

static int emod_load(struct module_data *m, HIO_HANDLE * f, const int start)
{
	iff_handle handle;
	int ret;

	LOAD_INIT();

	hio_read32b(f);		/* FORM */
	hio_read32b(f);
	hio_read32b(f);		/* EMOD */

	handle = iff_new();
	if (handle == NULL)
		return -1;

	/* IFF chunk IDs */
	ret = iff_register(handle, "EMIC", get_emic);
	ret |= iff_register(handle, "PATT", get_patt);
	ret |= iff_register(handle, "8SMP", get_8smp);

	if (ret != 0)
		return -1;

	/* Load IFF chunks */
	if (iff_load(handle, m, f, NULL) < 0) {
		iff_release(handle);
		return -1;
	}

	iff_release(handle);

	return 0;
}
开发者ID:GenericHero,项目名称:libxmp-3ds,代码行数:33,代码来源:emod_load.c

示例2: emod_load

static int emod_load(struct module_data *m, xmp_file f, const int start)
{
    iff_handle handle;

    LOAD_INIT();

    read32b(f);		/* FORM */
    read32b(f);
    read32b(f);		/* EMOD */

    handle = iff_new();
    if (handle == NULL)
	return -1;

    /* IFF chunk IDs */
    iff_register(handle, "EMIC", get_emic);
    iff_register(handle, "PATT", get_patt);
    iff_register(handle, "8SMP", get_8smp);

    /* Load IFF chunks */
    while (!xmp_feof(f)) {
	iff_chunk(handle, m, f, NULL);
    }

    iff_release(handle);

    return 0;
}
开发者ID:bithorder,项目名称:libxmp,代码行数:28,代码来源:emod_load.c

示例3: okt_load

static int okt_load(struct xmp_context *ctx, FILE *f, const int start)
{
    struct xmp_player_context *p = &ctx->p;
    struct xmp_mod_context *m = &p->m;

    LOAD_INIT();

    fseek(f, 8, SEEK_CUR);	/* OKTASONG */

    pattern = sample = 0;

    /* IFF chunk IDs */
    iff_register("CMOD", get_cmod);
    iff_register("SAMP", get_samp);
    iff_register("SPEE", get_spee);
    iff_register("SLEN", get_slen);
    iff_register("PLEN", get_plen);
    iff_register("PATT", get_patt);
    iff_register("PBOD", get_pbod);
    iff_register("SBOD", get_sbod);

    strcpy (m->type, "OKT (Oktalyzer)");

    MODULE_INFO();

    /* Load IFF chunks */
    while (!feof(f))
	iff_chunk(ctx, f);

    iff_release();

    reportv(ctx, 0, "\n");

    return 0;
}
开发者ID:44kksharma,项目名称:AndEngineMODPlayerExtension,代码行数:35,代码来源:okt_load.c

示例4: ftm_load

int ftm_load(xmp_file f)
{
	int i, j, k;
	struct xmp_event *event;
	struct ftm_header fh;
	struct ftm_instrument si;
	uint8 b1, b2, b3;

	LOAD_INIT();

	xmp_fread(&fh.id, 4, 1, f);
	if (memcmp(fh.id, "FTMN", 4))
		return -1;

	fh.ver = read8(f);
	fh.nos = read8(f);
	read16b(f);
	read32b(f);
	read32b(f);
	xmp_fread(&fh.title, 32, 1, f);
	xmp_fread(&fh.author, 32, 1, f);
	read16b(f);

	//mod->len = fh.len;
	//mod->pat = fh.pat;
	mod->ins = fh.nos;
	mod->smp = mod->ins;
	mod->trk = mod->pat * mod->chn;
	for (i = 0; i < mod->len; i++)
		mod->xxo[i] = fh.order[i];

	set_type(m, "Face The Music");
	MODULE_INFO();
	PATTERN_INIT();

	/* Load and convert patterns */
	if (V(0))
		report("Stored patterns: %d ", mod->pat);
	for (i = 0; i < mod->pat; i++) {
		PATTERN_ALLOC(i);
		mod->xxp[i]->rows = 64;
		TRACK_ALLOC(i);
		for (j = 0; j < 4; j++) {
		}

		reportv(ctx, 0, ".");
	}

	INSTRUMENT_INIT();
	reportv(ctx, 0, "\nStored samples : %d ", mod->smp);

	for (i = 0; i < mod->smp; i++) {
		reportv(ctx, 0, ".");
	}

	reportv(ctx, 0, "\n");
	mod->flg |= XXM_FLG_MODRNG;

	return 0;
}
开发者ID:bithorder,项目名称:libxmp,代码行数:60,代码来源:ftm_load.c

示例5: mfp_load

static int mfp_load(struct xmp_context *ctx, FILE *f, const int start)
{
	struct xmp_player_context *p = &ctx->p;
	struct xmp_mod_context *m = &p->m;
	int i, j, k, x, y;
	struct xxm_event *event;
	struct stat st;
	char smp_filename[PATH_MAX];
	FILE *s;
	int size1, size2;
	int pat_addr, pat_table[128][4];
	uint8 buf[1024], mod_event[4];
	int row;

	LOAD_INIT();

	sprintf(m->type, "Magnetic Fields Packer");
	MODULE_INFO();

	m->xxh->chn = 4;

	m->xxh->ins = m->xxh->smp = 31;
	INSTRUMENT_INIT();

	reportv(ctx, 1, "     Len  LBeg LEnd L Vol Fin\n");

	for (i = 0; i < 31; i++) {
		int loop_size;

		m->xxi[i] = calloc(sizeof(struct xxm_instrument), 1);
		
		m->xxs[i].len = 2 * read16b(f);
		m->xxi[i][0].fin = (int8)(read8(f) << 4);
		m->xxi[i][0].vol = read8(f);
		m->xxs[i].lps = 2 * read16b(f);
		loop_size = read16b(f);

		m->xxs[i].lpe = m->xxs[i].lps + 2 * loop_size;
		m->xxs[i].flg = loop_size > 1 ? WAVE_LOOPING : 0;
		m->xxi[i][0].pan = 0x80;
		m->xxi[i][0].sid = i;
		m->xxih[i].nsm = !!(m->xxs[i].len);
		m->xxih[i].rls = 0xfff;

		if (V(1) && m->xxs[i].len > 2) {
                	report("[%2X] %04x %04x %04x %c V%02x %+d %c\n",
                       		i, m->xxs[i].len, m->xxs[i].lps,
                        	m->xxs[i].lpe,
				loop_size > 1 ? 'L' : ' ',
                        	m->xxi[i][0].vol, m->xxi[i][0].fin >> 4,
                        	m->xxs[i].flg & WAVE_PTKLOOP ? '!' : ' ');
		}
	}
开发者ID:44kksharma,项目名称:AndEngineMODPlayerExtension,代码行数:53,代码来源:mfp_load.c

示例6: dbm_load

static int dbm_load(struct module_data *m, FILE *f, const int start)
{
	struct xmp_module *mod = &m->mod;
	iff_handle handle;
	char name[44];
	uint16 version;
	int i;
	struct local_data data;

	LOAD_INIT();

	read32b(f);		/* DBM0 */

	data.have_song = 0;
	version = read16b(f);

	fseek(f, 10, SEEK_CUR);
	fread(name, 1, 44, f);

	handle = iff_new();
	if (handle == NULL)
		return -1;

	/* IFF chunk IDs */
	iff_register(handle, "INFO", get_info);
	iff_register(handle, "SONG", get_song);
	iff_register(handle, "INST", get_inst);
	iff_register(handle, "PATT", get_patt);
	iff_register(handle, "SMPL", get_smpl);
	iff_register(handle, "VENV", get_venv);

	strncpy(mod->name, name, XMP_NAME_SIZE);
	snprintf(mod->type, XMP_NAME_SIZE, "DigiBooster Pro %d.%02x DBM0",
					version >> 8, version & 0xff);
	MODULE_INFO();

	/* Load IFF chunks */
	while (!feof(f)) {
		iff_chunk(handle, m, f, &data);
	}

	iff_release(handle);

	for (i = 0; i < mod->chn; i++)
		mod->xxc[i].pan = 0x80;

	return 0;
}
开发者ID:cmatsuoka,项目名称:chiptune.js,代码行数:48,代码来源:dbm_load.c

示例7: pt3_load

static int pt3_load(struct module_data *m, HIO_HANDLE *f, const int start)
{
    iff_handle handle;
    char buf[20];
    int ret;

    LOAD_INIT();

    hio_read32b(f);		/* FORM */
    hio_read32b(f);		/* size */
    hio_read32b(f);		/* MODL */
    hio_read32b(f);		/* VERS */
    hio_read32b(f);		/* VERS size */

    hio_read(buf, 1, 10, f);
    set_type(m, "%-6.6s IFFMODL", buf + 4);

    handle = iff_new();
    if (handle == NULL)
        return -1;

    /* IFF chunk IDs */
    ret = iff_register(handle, "INFO", get_info);
    ret |= iff_register(handle, "CMNT", get_cmnt);
    ret |= iff_register(handle, "PTDT", get_ptdt);

    if (ret != 0)
        return -1;

    iff_set_quirk(handle, IFF_FULL_CHUNK_SIZE);

    /* Load IFF chunks */
    if (iff_load(handle, m, f, NULL) < 0) {
        iff_release(handle);
        return -1;
    }

    iff_release(handle);

    /* Sanity check */
    if (m->mod.smp <= 0) {
        return -1;
    }

    return 0;
}
开发者ID:Justasic,项目名称:libxmp,代码行数:46,代码来源:pt3_load.c

示例8: okt_load

static int okt_load(struct module_data *m, HIO_HANDLE * f, const int start)
{
    iff_handle handle;
    struct local_data data;
    int ret;

    LOAD_INIT();

    hio_seek(f, 8, SEEK_CUR);	/* OKTASONG */

    handle = iff_new();
    if (handle == NULL)
        return -1;

    memset(&data, 0, sizeof(struct local_data));

    /* IFF chunk IDs */
    ret = iff_register(handle, "CMOD", get_cmod);
    ret |= iff_register(handle, "SAMP", get_samp);
    ret |= iff_register(handle, "SPEE", get_spee);
    ret |= iff_register(handle, "SLEN", get_slen);
    ret |= iff_register(handle, "PLEN", get_plen);
    ret |= iff_register(handle, "PATT", get_patt);
    ret |= iff_register(handle, "PBOD", get_pbod);
    ret |= iff_register(handle, "SBOD", get_sbod);

    if (ret != 0)
        return -1;

    set_type(m, "Oktalyzer");

    MODULE_INFO();

    /* Load IFF chunks */
    if (iff_load(handle, m, f, &data) < 0) {
        iff_release(handle);
        return -1;
    }

    iff_release(handle);

    return 0;
}
开发者ID:yulizi1937,项目名称:modo_android,代码行数:43,代码来源:okt_load.c

示例9: dbm_load

static int dbm_load(struct xmp_context *ctx, FILE *f, const int start)
{
	struct xmp_player_context *p = &ctx->p;
	struct xmp_mod_context *m = &p->m;
	char name[44];
	uint16 version;
	int i;

	LOAD_INIT();

	read32b(f);		/* DBM0 */

	have_song = 0;
	version = read16b(f);

	fseek(f, 10, SEEK_CUR);
	fread(name, 1, 44, f);

	/* IFF chunk IDs */
	iff_register("INFO", get_info);
	iff_register("SONG", get_song);
	iff_register("INST", get_inst);
	iff_register("PATT", get_patt);
	iff_register("SMPL", get_smpl);
	iff_register("VENV", get_venv);

	strncpy(m->name, name, XMP_NAMESIZE);
	snprintf(m->type, XMP_NAMESIZE, "DBM0 (DigiBooster Pro "
				"%d.%02x)", version >> 8, version & 0xff);
	MODULE_INFO();

	/* Load IFF chunks */
	while (!feof(f))
		iff_chunk(ctx, f);

	iff_release();

	for (i = 0; i < m->xxh->chn; i++)
		m->xxc[i].pan = 0x80;

	return 0;
}
开发者ID:ProjectZeroSlackr,项目名称:XMP,代码行数:42,代码来源:dbm_load.c

示例10: okt_load

static int okt_load(struct module_data *m, xmp_file f, const int start)
{
    iff_handle handle;
    struct local_data data;

    LOAD_INIT();

    xmp_fseek(f, 8, SEEK_CUR);	/* OKTASONG */

    handle = iff_new();
    if (handle == NULL)
	return -1;

    memset(&data, 0, sizeof(struct local_data));

    /* IFF chunk IDs */
    iff_register(handle, "CMOD", get_cmod);
    iff_register(handle, "SAMP", get_samp);
    iff_register(handle, "SPEE", get_spee);
    iff_register(handle, "SLEN", get_slen);
    iff_register(handle, "PLEN", get_plen);
    iff_register(handle, "PATT", get_patt);
    iff_register(handle, "PBOD", get_pbod);
    iff_register(handle, "SBOD", get_sbod);

    set_type(m, "Oktalyzer");

    MODULE_INFO();

    /* Load IFF chunks */
    while (!xmp_feof(f)) {
	iff_chunk(handle, m, f, &data);
    }

    iff_release(handle);

    return 0;
}
开发者ID:bithorder,项目名称:libxmp,代码行数:38,代码来源:okt_load.c

示例11: pt3_load

static int pt3_load(struct module_data *m, FILE *f, const int start)
{
	iff_handle handle;
	char buf[20];

	LOAD_INIT();

	read32b(f);		/* FORM */
	read32b(f);		/* size */
	read32b(f);		/* MODL */

	read32b(f);		/* VERS */
	read32b(f);		/* VERS size */

	fread(buf, 1, 10, f);
	set_type(m, "%-6.6s IFFMODL", buf + 4);

	handle = iff_new();
	if (handle == NULL)
		return -1;

	/* IFF chunk IDs */
	iff_register(handle, "INFO", get_info);
	iff_register(handle, "CMNT", get_cmnt);
	iff_register(handle, "PTDT", get_ptdt);

	iff_set_quirk(handle, IFF_FULL_CHUNK_SIZE);

	/* Load IFF chunks */
	while (!feof(f))
		iff_chunk(handle, m, f, NULL);

	iff_release(handle);

	return 0;
}
开发者ID:cmatsuoka,项目名称:chiptune.js,代码行数:36,代码来源:pt3_load.c

示例12: stx_load

static int stx_load(struct module_data *m, xmp_file f, const int start)
{
    struct xmp_module *mod = &m->mod;
    int c, r, i, broken = 0;
    struct xmp_event *event = 0, dummy;
    struct stx_file_header sfh;
    struct stx_instrument_header sih;
    uint8 n, b;
    uint16 x16;
    int bmod2stm = 0;
    uint16 *pp_ins;		/* Parapointers to instruments */
    uint16 *pp_pat;		/* Parapointers to patterns */

    LOAD_INIT();

    xmp_fread(&sfh.name, 20, 1, f);
    xmp_fread(&sfh.magic, 8, 1, f);
    sfh.psize = read16l(f);
    sfh.unknown1 = read16l(f);
    sfh.pp_pat = read16l(f);
    sfh.pp_ins = read16l(f);
    sfh.pp_chn = read16l(f);
    sfh.unknown2 = read16l(f);
    sfh.unknown3 = read16l(f);
    sfh.gvol = read8(f);
    sfh.tempo = read8(f);
    sfh.unknown4 = read16l(f);
    sfh.unknown5 = read16l(f);
    sfh.patnum = read16l(f);
    sfh.insnum = read16l(f);
    sfh.ordnum = read16l(f);
    sfh.unknown6 = read16l(f);
    sfh.unknown7 = read16l(f);
    sfh.unknown8 = read16l(f);
    xmp_fread(&sfh.magic2, 4, 1, f);

    /* BMOD2STM does not convert pitch */
    if (!strncmp ((char *) sfh.magic, "BMOD2STM", 8))
	bmod2stm = 1;

#if 0
    if ((strncmp ((char *) sfh.magic, "!Scream!", 8) &&
	!bmod2stm) || strncmp ((char *) sfh.magic2, "SCRM", 4))
	return -1;
#endif

    mod->ins = sfh.insnum;
    mod->pat = sfh.patnum;
    mod->trk = mod->pat * mod->chn;
    mod->len = sfh.ordnum;
    mod->spd = MSN (sfh.tempo);
    mod->smp = mod->ins;
    m->c4rate = C4_NTSC_RATE;

    /* STM2STX 1.0 released with STMIK 0.2 converts STMs with the pattern
     * length encoded in the first two bytes of the pattern (like S3M).
     */
    xmp_fseek(f, start + (sfh.pp_pat << 4), SEEK_SET);
    x16 = read16l(f);
    xmp_fseek(f, start + (x16 << 4), SEEK_SET);
    x16 = read16l(f);
    if (x16 == sfh.psize)
	broken = 1;

    strncpy(mod->name, (char *)sfh.name, 20);
    if (bmod2stm)
	set_type(m, "BMOD2STM STX");
    else
	snprintf(mod->type, XMP_NAME_SIZE, "STM2STX 1.%d", broken ? 0 : 1);

    MODULE_INFO();
 
    pp_pat = calloc (2, mod->pat);
    pp_ins = calloc (2, mod->ins);

    /* Read pattern pointers */
    xmp_fseek(f, start + (sfh.pp_pat << 4), SEEK_SET);
    for (i = 0; i < mod->pat; i++)
	pp_pat[i] = read16l(f);

    /* Read instrument pointers */
    xmp_fseek(f, start + (sfh.pp_ins << 4), SEEK_SET);
    for (i = 0; i < mod->ins; i++)
	pp_ins[i] = read16l(f);

    /* Skip channel table (?) */
    xmp_fseek(f, start + (sfh.pp_chn << 4) + 32, SEEK_SET);

    /* Read orders */
    for (i = 0; i < mod->len; i++) {
	mod->xxo[i] = read8(f);
	xmp_fseek(f, 4, SEEK_CUR);
    }
 
    INSTRUMENT_INIT();

    /* Read and convert instruments and samples */

    for (i = 0; i < mod->ins; i++) {
	mod->xxi[i].sub = calloc(sizeof (struct xmp_subinstrument), 1);
//.........这里部分代码省略.........
开发者ID:bithorder,项目名称:libxmp,代码行数:101,代码来源:stx_load.c

示例13: gal4_load

static int gal4_load(struct module_data *m, HIO_HANDLE *f, const int start)
{
	struct xmp_module *mod = &m->mod;
	iff_handle handle;
	int i, ret, offset;
	struct local_data data;

	LOAD_INIT();

	hio_read32b(f);	/* Skip RIFF */
	hio_read32b(f);	/* Skip size */
	hio_read32b(f);	/* Skip AM   */

	offset = hio_tell(f);

	mod->smp = mod->ins = 0;

	handle = iff_new();
	if (handle == NULL)
		return -1;

	/* IFF chunk IDs */
	ret = iff_register(handle, "MAIN", get_main);
	ret |= iff_register(handle, "ORDR", get_ordr);
	ret |= iff_register(handle, "PATT", get_patt_cnt);
	ret |= iff_register(handle, "INST", get_inst_cnt);

	if (ret != 0)
		return -1;

	iff_set_quirk(handle, IFF_LITTLE_ENDIAN);
	iff_set_quirk(handle, IFF_CHUNK_TRUNC4);

	/* Load IFF chunks */
	if (iff_load(handle, m, f, &data) < 0) {
		iff_release(handle);
		return -1;
	}

	iff_release(handle);

	mod->trk = mod->pat * mod->chn;

	MODULE_INFO();

	if (instrument_init(mod) < 0)
		return -1;

	if (pattern_init(mod) < 0)
		return -1;

	D_(D_INFO "Stored patterns: %d\n", mod->pat);
	D_(D_INFO "Stored samples : %d ", mod->smp);

	hio_seek(f, start + offset, SEEK_SET);
	data.snum = 0;

	handle = iff_new();
	if (handle == NULL)
		return -1;

	/* IFF chunk IDs */
	ret = iff_register(handle, "PATT", get_patt);
	ret |= iff_register(handle, "INST", get_inst);

	if (ret != 0)
		return -1;

	iff_set_quirk(handle, IFF_LITTLE_ENDIAN);
	iff_set_quirk(handle, IFF_CHUNK_TRUNC4);

	/* Load IFF chunks */
	if (iff_load(handle, m, f, &data) < 0) {
		iff_release(handle);
		return -1;
	}

	iff_release(handle);

	/* Alloc missing patterns */
	for (i = 0; i < mod->pat; i++) {
		if (mod->xxp[i] == NULL) {
			if (pattern_tracks_alloc(mod, i, 64) < 0) {
				return -1;
			}
		}
	}

	for (i = 0; i < mod->chn; i++) {
		mod->xxc[i].pan = 0x80;
	}

	m->quirk |= QUIRKS_FT2;
	m->read_event_type = READ_EVENT_FT2;

	return 0;
}
开发者ID:GenericHero,项目名称:libxmp-3ds,代码行数:97,代码来源:gal4_load.c

示例14: mod_load

static int mod_load(struct module_data *m, HIO_HANDLE *f, const int start)
{
    struct xmp_module *mod = &m->mod;
    int i, j;
    struct xmp_event *event;
    struct mod_header mh;
    uint8 mod_event[4];
    char magic[8];
    int ptkloop = 0;			/* Protracker loop */

    LOAD_INIT();

    mod->ins = 31;
    mod->smp = mod->ins;
    mod->chn = 0;

    m->quirk |= QUIRK_MODRNG;

    hio_read(&mh.name, 20, 1, f);
    for (i = 0; i < 31; i++) {
	hio_read(&mh.ins[i].name, 22, 1, f);	/* Instrument name */
	mh.ins[i].size = hio_read16b(f);	/* Length in 16-bit words */
	mh.ins[i].finetune = hio_read8(f);	/* Finetune (signed nibble) */
	mh.ins[i].volume = hio_read8(f);	/* Linear playback volume */
	mh.ins[i].loop_start = hio_read16b(f);	/* Loop start in 16-bit words */
	mh.ins[i].loop_size = hio_read16b(f);	/* Loop size in 16-bit words */
    }
    mh.len = hio_read8(f);
    mh.restart = hio_read8(f);
    hio_read(&mh.order, 128, 1, f);
    memset(magic, 0, 8);
    hio_read(magic, 4, 1, f);

    if (!memcmp(magic, "M.K.", 4)) {
	mod->chn = 4;
    } else if (!strncmp(magic + 2, "CH", 2) &&
	isdigit((int)magic[0]) && isdigit((int)magic[1])) {
	mod->chn = (*magic - '0') * 10 + magic[1] - '0';
    } else if (!strncmp(magic + 1, "CHN", 3) && isdigit((int)*magic)) {
	mod->chn = *magic - '0';
    } else {
	return -1;
    }

    strncpy(mod->name, (char *) mh.name, 20);

    mod->len = mh.len;
    /* mod->rst = mh.restart; */

    if (mod->rst >= mod->len)
	mod->rst = 0;
    memcpy(mod->xxo, mh.order, 128);

    for (i = 0; i < 128; i++) {
	/* This fixes dragnet.mod (garbage in the order list) */
	if (mod->xxo[i] > 0x7f)
		break;
	if (mod->xxo[i] > mod->pat)
	    mod->pat = mod->xxo[i];
    }
    mod->pat++;

    if (instrument_init(mod) < 0)
	return -1;

    for (i = 0; i < mod->ins; i++) {
	if (subinstrument_alloc(mod, i, 1) < 0)
	    return -1;

	mod->xxs[i].len = 2 * mh.ins[i].size;
	mod->xxs[i].lps = 2 * mh.ins[i].loop_start;
	mod->xxs[i].lpe = mod->xxs[i].lps + 2 * mh.ins[i].loop_size;
	if (mod->xxs[i].lpe > mod->xxs[i].len)
		mod->xxs[i].lpe = mod->xxs[i].len;
	mod->xxs[i].flg = (mh.ins[i].loop_size > 1 && mod->xxs[i].lpe >= 4) ?
		XMP_SAMPLE_LOOP : 0;
	mod->xxi[i].sub[0].fin = (int8)(mh.ins[i].finetune << 4);
	mod->xxi[i].sub[0].vol = mh.ins[i].volume;
	mod->xxi[i].sub[0].pan = 0x80;
	mod->xxi[i].sub[0].sid = i;
	instrument_name(mod, i, mh.ins[i].name, 22);

	if (mod->xxs[i].len > 0)
		mod->xxi[i].nsm = 1;
    }

    mod->trk = mod->chn * mod->pat;

    set_type(m, mod->chn == 4 ? "Protracker" : "Fasttracker");

    MODULE_INFO();

    for (i = 0; i < mod->ins; i++) {
	D_(D_INFO "[%2X] %-22.22s %04x %04x %04x %c V%02x %+d %c\n",
		i, mod->xxi[i].name,
		mod->xxs[i].len, mod->xxs[i].lps, mod->xxs[i].lpe,
		(mh.ins[i].loop_size > 1 && mod->xxs[i].lpe > 8) ?
			'L' : ' ', mod->xxi[i].sub[0].vol,
		mod->xxi[i].sub[0].fin >> 4,
		ptkloop && mod->xxs[i].lps == 0 && mh.ins[i].loop_size > 1 &&
//.........这里部分代码省略.........
开发者ID:Nlcke,项目名称:gideros,代码行数:101,代码来源:mod_load.c

示例15: asylum_load

static int asylum_load(struct module_data *m, HIO_HANDLE *f, const int start)
{
	struct xmp_module *mod = &m->mod;
	struct xmp_event *event;
	int i, j;

	LOAD_INIT();

	hio_seek(f, 32, SEEK_CUR);			/* skip magic */
	mod->spd = hio_read8(f);			/* initial speed */
	mod->bpm = hio_read8(f);			/* initial BPM */
	mod->ins = hio_read8(f);			/* number of instruments */
	mod->pat = hio_read8(f);			/* number of patterns */
	mod->len = hio_read8(f);			/* module length */
	hio_read8(f);

	hio_read(mod->xxo, 1, mod->len, f);	/* read orders */
	hio_seek(f, start + 294, SEEK_SET);

	mod->chn = 8;
	mod->smp = mod->ins;
	mod->trk = mod->pat * mod->chn;

	snprintf(mod->type, XMP_NAME_SIZE, "Asylum Music Format v1.0");

	MODULE_INFO();

	if (instrument_init(mod) < 0)
		return -1;

	/* Read and convert instruments and samples */
	for (i = 0; i < mod->ins; i++) {
		uint8 insbuf[37];

		if (subinstrument_alloc(mod, i, 1) < 0)	
			return -1;

		hio_read(insbuf, 1, 37, f);
		instrument_name(mod, i, insbuf, 22);
		mod->xxi[i].sub[0].fin = (int8)(insbuf[22] << 4);
		mod->xxi[i].sub[0].vol = insbuf[23];
		mod->xxi[i].sub[0].xpo = (int8)insbuf[24];
		mod->xxi[i].sub[0].pan = 0x80;
		mod->xxi[i].sub[0].sid = i;

		mod->xxs[i].len = readmem32l(insbuf + 25);
		mod->xxs[i].lps = readmem32l(insbuf + 29);
		mod->xxs[i].lpe = mod->xxs[i].lps + readmem32l(insbuf + 33);
		
		mod->xxs[i].flg = mod->xxs[i].lpe > 2 ? XMP_SAMPLE_LOOP : 0;

		D_(D_INFO "[%2X] %-22.22s %04x %04x %04x %c V%02x %d", i,
		   mod->xxi[i].name, mod->xxs[i].len, mod->xxs[i].lps,
		   mod->xxs[i].lpe,
		   mod->xxs[i].flg & XMP_SAMPLE_LOOP ? 'L' : ' ',
		   mod->xxi[i].sub[0].vol, mod->xxi[i].sub[0].fin);
	}

	hio_seek(f, 37 * (64 - mod->ins), SEEK_CUR);

	D_(D_INFO "Module length: %d", mod->len);

	if (pattern_init(mod) < 0)
		return -1;

	/* Read and convert patterns */
	D_(D_INFO "Stored patterns: %d", mod->pat);

	for (i = 0; i < mod->pat; i++) {
		if (pattern_tracks_alloc(mod, i, 64) < 0)
			return -1;

		for (j = 0; j < 64 * mod->chn; j++) {
			uint8 note;

			event = &EVENT(i, j % mod->chn, j / mod->chn);
			memset(event, 0, sizeof(struct xmp_event));
			note = hio_read8(f);

			if (note != 0) {
				event->note = note + 13;
			}

			event->ins = hio_read8(f);
			event->fxt = hio_read8(f);
			event->fxp = hio_read8(f);
		}
	}

	/* Read samples */
	D_(D_INFO "Stored samples: %d", mod->smp);

	for (i = 0; i < mod->ins; i++) {
		if (mod->xxs[i].len > 1) {
			if (load_sample(m, f, 0, &mod->xxs[i], NULL) < 0)
				return -1;
			mod->xxi[i].nsm = 1;
		}
	}

//.........这里部分代码省略.........
开发者ID:GCrean,项目名称:libxmp,代码行数:101,代码来源:asylum_load.c


注:本文中的LOAD_INIT函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。