本文整理汇总了C++中MODULE_INFO函数的典型用法代码示例。如果您正苦于以下问题:C++ MODULE_INFO函数的具体用法?C++ MODULE_INFO怎么用?C++ MODULE_INFO使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MODULE_INFO函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: get_info
static void get_info(struct module_data *m, int size, FILE *f, void *parm)
{
struct xmp_module *mod = &m->mod;
int flags;
int day, month, year, hour, min, sec;
int dhour, dmin, dsec;
fread(mod->name, 1, 32, f);
mod->ins = read16b(f);
mod->len = read16b(f);
mod->pat = read16b(f);
mod->gvl = read16b(f);
mod->bpm = read16b(f);
flags = read16b(f);
day = read16b(f);
month = read16b(f);
year = read16b(f);
hour = read16b(f);
min = read16b(f);
sec = read16b(f);
dhour = read16b(f);
dmin = read16b(f);
dsec = read16b(f);
MODULE_INFO();
D_(D_INFO "Creation date: %02d/%02d/%02d %02d:%02d:%02d",
day, month, year, hour, min, sec);
D_(D_INFO "Playing time: %02d:%02d:%02d", dhour, dmin, dsec);
}
开发者ID:cmatsuoka,项目名称:chiptune.js,代码行数:30,代码来源:pt3_load.c
示例2: get_info
static int get_info(struct module_data *m, int size, HIO_HANDLE *f, void *parm)
{
struct xmp_module *mod = &m->mod;
int flags;
/* int day, month, year, hour, min, sec;
int dhour, dmin, dsec; */
hio_read(mod->name, 1, 32, f);
mod->ins = hio_read16b(f);
mod->len = hio_read16b(f);
mod->pat = hio_read16b(f);
mod->gvl = hio_read16b(f);
mod->bpm = hio_read16b(f);
flags = hio_read16b(f);
/*day =*/ hio_read16b(f);
/*month =*/ hio_read16b(f);
/*year =*/ hio_read16b(f);
/*hour =*/ hio_read16b(f);
/*min =*/ hio_read16b(f);
/*sec =*/ hio_read16b(f);
/*dhour =*/ hio_read16b(f);
/*dmin =*/ hio_read16b(f);
/*dsec =*/ hio_read16b(f);
MODULE_INFO();
/*D_(D_INFO "Creation date: %02d/%02d/%02d %02d:%02d:%02d",
day, month, year, hour, min, sec);
D_(D_INFO "Playing time: %02d:%02d:%02d", dhour, dmin, dsec);*/
return 0;
}
开发者ID:B0rschti,项目名称:libxmp-4.3.0,代码行数:32,代码来源:pt3_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: get_emic
static void get_emic(struct xmp_context *ctx, int size, FILE *f)
{
struct xmp_player_context *p = &ctx->p;
struct xmp_mod_context *m = &p->m;
int i, ver;
ver = read16b(f);
fread(m->name, 1, 20, f);
fread(m->author, 1, 20, f);
m->xxh->bpm = read8(f);
m->xxh->ins = read8(f);
m->xxh->smp = m->xxh->ins;
m->xxh->flg |= XXM_FLG_MODRNG;
snprintf(m->type, XMP_NAMESIZE, "EMOD v%d (Quadra Composer)", ver);
MODULE_INFO();
INSTRUMENT_INIT();
reportv(ctx, 1, " Instrument name Len LBeg LEnd L Vol Fin\n");
for (i = 0; i < m->xxh->ins; i++) {
m->xxi[i] = calloc(sizeof (struct xxm_instrument), 1);
read8(f); /* num */
m->xxi[i][0].vol = read8(f);
m->xxs[i].len = 2 * read16b(f);
fread(m->xxih[i].name, 1, 20, f);
m->xxs[i].flg = read8(f) & 1 ? WAVE_LOOPING : 0;
m->xxi[i][0].fin = read8(f);
m->xxs[i].lps = 2 * read16b(f);
m->xxs[i].lpe = m->xxs[i].lps + 2 * read16b(f);
read32b(f); /* ptr */
m->xxih[i].nsm = 1;
m->xxi[i][0].pan = 0x80;
m->xxi[i][0].sid = i;
if (V(1) && (strlen((char *)m->xxih[i].name) || (m->xxs[i].len > 2))) {
report ("[%2X] %-20.20s %05x %05x %05x %c V%02x %+d\n",
i, m->xxih[i].name, m->xxs[i].len, m->xxs[i].lps,
m->xxs[i].lpe, m->xxs[i].flg & WAVE_LOOPING ? 'L' : ' ',
m->xxi[i][0].vol, m->xxi[i][0].fin >> 4);
}
}
开发者ID:44kksharma,项目名称:AndEngineMODPlayerExtension,代码行数:46,代码来源:emod_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: get_d_t_
static int get_d_t_(struct module_data *m, int size, HIO_HANDLE *f, void *parm)
{
struct xmp_module *mod = &m->mod;
int b;
hio_read16b(f); /* type */
hio_read16b(f); /* 0xff then mono */
hio_read16b(f); /* reserved */
mod->spd = hio_read16b(f);
if ((b = hio_read16b(f)) > 0) /* RAMBO.DTM has bpm 0 */
mod->bpm = b;
hio_read32b(f); /* undocumented */
hio_read(mod->name, 32, 1, f);
set_type(m, "Digital Tracker DTM");
MODULE_INFO();
return 0;
}
开发者ID:GCrean,项目名称:libxmp,代码行数:20,代码来源:dt_load.c
示例11: 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
示例12: mfp_load
static int mfp_load(struct module_data *m, HIO_HANDLE *f, const int start)
{
struct xmp_module *mod = &m->mod;
int i, j, k, x, y;
struct xmp_event *event;
struct stat st;
char smp_filename[PATH_MAX];
HIO_HANDLE *s;
int size1, size2;
int pat_addr, pat_table[128][4];
uint8 buf[1024], mod_event[4];
int row;
LOAD_INIT();
set_type(m, "Magnetic Fields Packer");
MODULE_INFO();
mod->chn = 4;
mod->ins = mod->smp = 31;
if (instrument_init(mod) < 0)
return -1;
for (i = 0; i < 31; i++) {
int loop_size;
if (subinstrument_alloc(mod, i, 1) < 0)
return -1;
mod->xxs[i].len = 2 * hio_read16b(f);
mod->xxi[i].sub[0].fin = (int8)(hio_read8(f) << 4);
mod->xxi[i].sub[0].vol = hio_read8(f);
mod->xxs[i].lps = 2 * hio_read16b(f);
loop_size = hio_read16b(f);
mod->xxs[i].lpe = mod->xxs[i].lps + 2 * loop_size;
mod->xxs[i].flg = loop_size > 1 ? XMP_SAMPLE_LOOP : 0;
mod->xxi[i].sub[0].pan = 0x80;
mod->xxi[i].sub[0].sid = i;
mod->xxi[i].rls = 0xfff;
if (mod->xxs[i].len > 0)
mod->xxi[i].nsm = 1;
D_(D_INFO "[%2X] %04x %04x %04x %c V%02x %+d",
i, mod->xxs[i].len, mod->xxs[i].lps,
mod->xxs[i].lpe,
loop_size > 1 ? 'L' : ' ',
mod->xxi[i].sub[0].vol, mod->xxi[i].sub[0].fin >> 4);
}
mod->len = mod->pat = hio_read8(f);
hio_read8(f); /* restart */
for (i = 0; i < 128; i++)
mod->xxo[i] = hio_read8(f);
#if 0
for (i = 0; i < 128; i++) {
mod->xxo[i] = hio_read8(f);
if (mod->xxo[i] > mod->pat)
mod->pat = mod->xxo[i];
}
mod->pat++;
#endif
mod->trk = mod->pat * mod->chn;
/* Read and convert patterns */
if (pattern_init(mod) < 0)
return -1;
size1 = hio_read16b(f);
size2 = hio_read16b(f);
for (i = 0; i < size1; i++) { /* Read pattern table */
for (j = 0; j < 4; j++) {
pat_table[i][j] = hio_read16b(f);
}
}
D_(D_INFO "Stored patterns: %d ", mod->pat);
pat_addr = hio_tell(f);
for (i = 0; i < mod->pat; i++) {
if (pattern_tracks_alloc(mod, i, 64) < 0)
return -1;
for (j = 0; j < 4; j++) {
hio_seek(f, pat_addr + pat_table[i][j], SEEK_SET);
hio_read(buf, 1, 1024, f);
for (row = k = 0; k < 4; k++) {
for (x = 0; x < 4; x++) {
for (y = 0; y < 4; y++, row++) {
event = &EVENT(i, j, row);
//.........这里部分代码省略.........
开发者ID:vitamin-caig,项目名称:zxtune,代码行数:101,代码来源:mfp_load.c
示例13: ptm_load
static int ptm_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 c, r, i, smp_ofs[256];
struct xxm_event *event;
struct ptm_file_header pfh;
struct ptm_instrument_header pih;
uint8 n, b;
LOAD_INIT();
/* Load and convert header */
fread(&pfh.name, 28, 1, f); /* Song name */
pfh.doseof = read8(f); /* 0x1a */
pfh.vermin = read8(f); /* Minor version */
pfh.vermaj = read8(f); /* Major type */
pfh.rsvd1 = read8(f); /* Reserved */
pfh.ordnum = read16l(f); /* Number of orders (must be even) */
pfh.insnum = read16l(f); /* Number of instruments */
pfh.patnum = read16l(f); /* Number of patterns */
pfh.chnnum = read16l(f); /* Number of channels */
pfh.flags = read16l(f); /* Flags (set to 0) */
pfh.rsvd2 = read16l(f); /* Reserved */
pfh.magic = read32b(f); /* 'PTMF' */
#if 0
if (pfh.magic != MAGIC_PTMF)
return -1;
#endif
fread(&pfh.rsvd3, 16, 1, f); /* Reserved */
fread(&pfh.chset, 32, 1, f); /* Channel settings */
fread(&pfh.order, 256, 1, f); /* Orders */
for (i = 0; i < 128; i++)
pfh.patseg[i] = read16l(f);
m->xxh->len = pfh.ordnum;
m->xxh->ins = pfh.insnum;
m->xxh->pat = pfh.patnum;
m->xxh->chn = pfh.chnnum;
m->xxh->trk = m->xxh->pat * m->xxh->chn;
m->xxh->smp = m->xxh->ins;
m->xxh->tpo = 6;
m->xxh->bpm = 125;
memcpy (m->xxo, pfh.order, 256);
m->c4rate = C4_NTSC_RATE;
copy_adjust((uint8 *)m->name, pfh.name, 28);
sprintf(m->type, "PTMF %d.%02x (Poly Tracker)",
pfh.vermaj, pfh.vermin);
MODULE_INFO();
INSTRUMENT_INIT();
/* Read and convert instruments and samples */
reportv(ctx, 1, " Instrument name Len LBeg LEnd L Vol C4Spd\n");
for (i = 0; i < m->xxh->ins; i++) {
m->xxi[i] = calloc (sizeof (struct xxm_instrument), 1);
pih.type = read8(f); /* Sample type */
fread(&pih.dosname, 12, 1, f); /* DOS file name */
pih.vol = read8(f); /* Volume */
pih.c4spd = read16l(f); /* C4 speed */
pih.smpseg = read16l(f); /* Sample segment (not used) */
pih.smpofs = read32l(f); /* Sample offset */
pih.length = read32l(f); /* Length */
pih.loopbeg = read32l(f); /* Loop begin */
pih.loopend = read32l(f); /* Loop end */
pih.gusbeg = read32l(f); /* GUS begin address */
pih.guslps = read32l(f); /* GUS loop start address */
pih.guslpe = read32l(f); /* GUS loop end address */
pih.gusflg = read8(f); /* GUS loop flags */
pih.rsvd1 = read8(f); /* Reserved */
fread(&pih.name, 28, 1, f); /* Instrument name */
pih.magic = read32b(f); /* 'PTMS' */
if ((pih.type & 3) != 1)
continue;
smp_ofs[i] = pih.smpofs;
m->xxih[i].nsm = !!(m->xxs[i].len = pih.length);
m->xxs[i].lps = pih.loopbeg;
m->xxs[i].lpe = pih.loopend;
if (m->xxs[i].lpe)
m->xxs[i].lpe--;
m->xxs[i].flg = pih.type & 0x04 ? WAVE_LOOPING : 0;
m->xxs[i].flg |= pih.type & 0x08 ? WAVE_LOOPING | WAVE_BIDIR_LOOP : 0;
m->xxs[i].flg |= pih.type & 0x10 ? WAVE_16_BITS : 0;
m->xxi[i][0].vol = pih.vol;
m->xxi[i][0].pan = 0x80;
m->xxi[i][0].sid = i;
pih.magic = 0;
copy_adjust(m->xxih[i].name, pih.name, 28);
//.........这里部分代码省略.........
开发者ID:ProjectZeroSlackr,项目名称:XMP,代码行数:101,代码来源:ptm_load.c
示例14: get_emic
static int get_emic(struct module_data *m, int size, HIO_HANDLE * f, void *parm)
{
struct xmp_module *mod = &m->mod;
int i, ver;
uint8 reorder[256];
ver = hio_read16b(f);
hio_read(mod->name, 1, 20, f);
hio_seek(f, 20, SEEK_CUR);
mod->bpm = hio_read8(f);
mod->ins = hio_read8(f);
mod->smp = mod->ins;
m->quirk |= QUIRK_MODRNG;
snprintf(mod->type, XMP_NAME_SIZE, "Quadra Composer EMOD v%d", ver);
MODULE_INFO();
if (instrument_init(mod) < 0)
return -1;
for (i = 0; i < mod->ins; i++) {
struct xmp_instrument *xxi = &mod->xxi[i];
struct xmp_sample *xxs = &mod->xxs[i];
struct xmp_subinstrument *sub;
if (subinstrument_alloc(mod, i, 1) < 0)
return -1;
sub = &xxi->sub[0];
hio_read8(f); /* num */
sub->vol = hio_read8(f);
xxs->len = 2 * hio_read16b(f);
hio_read(xxi->name, 1, 20, f);
xxs->flg = hio_read8(f) & 1 ? XMP_SAMPLE_LOOP : 0;
sub->fin = hio_read8s(f) << 4;
xxs->lps = 2 * hio_read16b(f);
xxs->lpe = xxs->lps + 2 * hio_read16b(f);
hio_read32b(f); /* ptr */
xxi->nsm = 1;
sub->pan = 0x80;
sub->sid = i;
D_(D_INFO "[%2X] %-20.20s %05x %05x %05x %c V%02x %+d",
i, xxi->name, xxs->len, xxs->lps, xxs->lpe,
xxs->flg & XMP_SAMPLE_LOOP ? 'L' : ' ',
sub->vol, sub->fin >> 4);
}
hio_read8(f); /* pad */
mod->pat = hio_read8(f);
mod->trk = mod->pat * mod->chn;
if (pattern_init(mod) < 0)
return -1;
memset(reorder, 0, 256);
for (i = 0; i < mod->pat; i++) {
reorder[hio_read8(f)] = i;
if (pattern_tracks_alloc(mod, i, hio_read8(f) + 1) < 0)
return -1;
hio_seek(f, 20, SEEK_CUR); /* skip name */
hio_read32b(f); /* ptr */
}
mod->len = hio_read8(f);
D_(D_INFO "Module length: %d", mod->len);
for (i = 0; i < mod->len; i++)
mod->xxo[i] = reorder[hio_read8(f)];
return 0;
}
开发者ID:GenericHero,项目名称:libxmp-3ds,代码行数:79,代码来源:emod_load.c
示例15: 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
示例16: 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
示例17: 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
示例18: polly_load
static int polly_load(struct module_data *m, FILE *f, const int start)
{
struct xmp_module *mod = &m->mod;
struct xmp_event *event;
uint8 *buf;
int i, j, k;
LOAD_INIT();
read8(f); /* skip 0xae */
/*
* File is RLE-encoded, escape is 0xAE (Aleksi Eeben's initials).
* Actual 0xAE is encoded as 0xAE 0x01
*/
if ((buf = calloc(1, 0x10000)) == NULL)
return -1;
decode_rle(buf, f, 0x10000);
for (i = 0; buf[ORD_OFS + i] != 0 && i < 128; i++)
mod->xxo[i] = buf[ORD_OFS + i] - 0xe0;
mod->len = i;
memcpy(mod->name, buf + ORD_OFS + 160, 16);
/* memcpy(m->author, buf + ORD_OFS + 176, 16); */
set_type(m, "Polly Tracker");
MODULE_INFO();
mod->spd = 0x03;
mod->bpm = 0x7d * buf[ORD_OFS + 193] / 0x88;
#if 0
for (i = 0; i < 1024; i++) {
if ((i % 16) == 0) printf("\n");
printf("%02x ", buf[ORD_OFS + i]);
}
#endif
mod->pat = 0;
for (i = 0; i < mod->len; i++) {
if (mod->xxo[i] > mod->pat)
mod->pat = mod->xxo[i];
}
mod->pat++;
mod->chn = 4;
mod->trk = mod->pat * mod->chn;
PATTERN_INIT();
D_(D_INFO "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 < 64; j++) {
for (k = 0; k < 4; k++) {
uint8 x = buf[i * PAT_SIZE + j * 4 + k];
event = &EVENT(i, k, j);
if (x == 0xf0) {
event->fxt = FX_BREAK;
event->fxp = 0;
continue;
}
event->note = LSN(x);
if (event->note)
event->note += 48;
event->ins = MSN(x);
}
}
}
mod->ins = mod->smp = 15;
INSTRUMENT_INIT();
for (i = 0; i < 15; i++) {
mod->xxi[i].sub = calloc(sizeof (struct xmp_subinstrument), 1);
mod->xxs[i].len = buf[ORD_OFS + 129 + i] < 0x10 ? 0 :
256 * buf[ORD_OFS + 145 + i];
mod->xxi[i].sub[0].fin = 0;
mod->xxi[i].sub[0].vol = 0x40;
mod->xxs[i].lps = 0;
mod->xxs[i].lpe = 0;
mod->xxs[i].flg = 0;
mod->xxi[i].sub[0].pan = 0x80;
mod->xxi[i].sub[0].sid = i;
mod->xxi[i].nsm = !!(mod->xxs[i].len);
mod->xxi[i].rls = 0xfff;
D_(D_INFO "[%2X] %04x %04x %04x %c V%02x",
i, mod->xxs[i].len, mod->xxs[i].lps,
mod->xxs[i].lpe, ' ', mod->xxi[i].sub[0].vol);
}
/* Convert samples from 6 to 8 bits */
for (i = SMP_OFS; i < 0x10000; i++)
buf[i] = buf[i] << 2;
/* Read samples */
//.........这里部分代码省略.........
开发者ID:cmatsuoka,项目名称:chiptune.js,代码行数:101,代码来源:polly_load.c
示例19: hsc_load
static int hsc_load(struct module_data *m, xmp_file f, const int start)
{
struct xmp_module *mod = &m->mod;
int pat, i, r, c;
struct xmp_event *event;
uint8 *x, *sid, e[2], buf[128 * 12];
LOAD_INIT();
xmp_fread(buf, 1, 128 * 12, f);
x = buf;
for (i = 0; i < 128; i++, x += 12) {
if (x[9] & ~0x3 || x[10] & ~0x3) /* Test waveform register */
break;
if (x[8] & ~0xf) /* Test feedback & algorithm */
break;
}
mod->ins = i;
xmp_fseek(f, start + 0, SEEK_SET);
mod->chn = 9;
mod->bpm = 135;
mod->spd = 6;
mod->smp = mod->ins;
m->quirk |= QUIRK_LINEAR;
set_type(m, "HSC-Tracker");
MODULE_INFO();
/* Read instruments */
INSTRUMENT_INIT();
xmp_fread (buf, 1, 128 * 12, f);
sid = buf;
for (i = 0; i < mod->ins; i++, sid += 12) {
mod->xxi[i].sub = calloc(sizeof (struct xmp_subinstrument), 1);
mod->xxi[i].nsm = 1;
mod->xxi[i].sub[0].vol = 0x40;
mod->xxi[i].sub[0].fin = (int8)sid[11] / 4;
mod->xxi[i].sub[0].pan = 0x80;
mod->xxi[i].sub[0].xpo = 0;
mod->xxi[i].sub[0].sid = i;
mod->xxi[i].rls = LSN(sid[7]) * 32; /* carrier release */
load_sample(m, f, SAMPLE_FLAG_ADLIB | SAMPLE_FLAG_HSC,
&mod->xxs[i], (char *)sid);
}
/* Read orders */
for (pat = i = 0; i < 51; i++) {
xmp_fread (&mod->xxo[i], 1, 1, f);
if (mod->xxo[i] & 0x80)
break; /* FIXME: jump line */
if (mod->xxo[i] > pat)
pat = mod->xxo[i];
}
xmp_fseek(f, 50 - i, SEEK_CUR);
mod->len = i;
mod->pat = pat + 1;
mod->trk = mod->pat * mod->chn;
D_(D_INFO "Module length: %d", mod->len);
D_(D_INFO "Instruments: %d", mod->ins);
D_(D_INFO "Stored patterns: %d", mod->pat);
PATTERN_INIT();
/* Read and convert patterns */
for (i = 0; i < mod->pat; i++) {
int ins[9] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
PATTERN_ALLOC (i);
mod->xxp[i]->rows = 64;
TRACK_ALLOC (i);
for (r = 0; r < mod->xxp[i]->rows; r++) {
for (c = 0; c < 9; c++) {
xmp_fread (e, 1, 2, f);
event = &EVENT (i, c, r);
if (e[0] & 0x80) {
ins[c] = e[1] + 1;
} else if (e[0] == 0x7f) {
event->note = XMP_KEY_OFF;
} else if (e[0] > 0) {
event->note = e[0] + 25;
event->ins = ins[c];
}
event->fxt = 0;
event->fxp = 0;
if (e[1] == 0x01) {
event->fxt = 0x0d;
event->fxp = 0;
}
}
//.........这里部分代码省略.........
开发者ID:bithorder,项目名称:libxmp,代码行数:101,代码来源:hsc_load.c
示例20: coco_load
static int coco_load(struct module_data *m, HIO_HANDLE *f, const int start)
{
struct xmp_module *mod = &m->mod;
struct xmp_event *event;
int i, j;
int seq_ptr, pat_ptr, smp_ptr[100];
LOAD_INIT();
mod->chn = hio_read8(f) & 0x3f;
libxmp_read_title(f, mod->name, 20);
for (i = 0; i < 20; i++) {
if (mod->name[i] == 0x0d)
mod->name[i] = 0;
}
libxmp_set_type(m, "Coconizer");
mod->ins = mod->smp = hio_read8(f);
mod->len = hio_read8(f);
mod->pat = hio_read8(f);
mod->trk = mod->pat * mod->chn;
seq_ptr = hio_read32l(f);
pat_ptr = hio_read32l(f);
MODULE_INFO();
if (libxmp_init_instrument(m) < 0)
return -1;
m->vol_table = (int *)arch_vol_table;
m->volbase = 0xff;
for (i = 0; i < mod->ins; i++) {
if (libxmp_alloc_subinstrument(mod, i, 1) < 0)
return -1;
smp_ptr[i] = hio_read32l(f);
mod->xxs[i].len = hio_read32l(f);
mod->xxi[i].sub[0].vol = 0xff - hio_read32l(f);
mod->xxi[i].sub[0].pan = 0x80;
mod->xxs[i].lps = hio_read32l(f);
mod->xxs[i].lpe = mod->xxs[i].lps + hio_read32l(f);
if (mod->xxs[i].lpe)
mod->xxs[i].lpe -= 1;
mod->xxs[i].flg = mod->xxs[i].lps > 0 ? XMP_SAMPLE_LOOP : 0;
hio_read(mod->xxi[i].name, 1, 11, f);
for (j = 0; j < 11; j++) {
if (mod->xxi[i].name[j] == 0x0d)
mod->xxi[i].name[j] = 0;
}
hio_read8(f); /* unused */
mod->xxi[i].sub[0].sid = i;
if (mod->xxs[i].len > 0)
mod->xxi[i].nsm = 1;
D_(D_INFO "[%2X] %-10.10s %05x %05x %05x %c V%02x",
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);
}
/* Sequence */
hio_seek(f, start + seq_ptr, SEEK_SET);
for (i = 0; ; i++) {
uint8 x = hio_read8(f);
if (x == 0xff)
break;
mod->xxo[i] = x;
}
for (i++; i % 4; i++) /* for alignment */
hio_read8(f);
/* Patterns */
if (libxmp_init_pattern(mod) < 0)
return -1;
D_(D_INFO "Stored patterns: %d", mod->pat);
for (i = 0; i < mod->pat; i++) {
if (libxmp_alloc_pattern_tracks(mod, i, 64) < 0)
return -1;
for (j = 0; j < (64 * mod->chn); j++) {
event = &EVENT (i, j % mod->chn, j / mod->chn);
event->fxp = hio_read8(f);
event->fxt = hio_read8(f);
event->ins = hio_read8(f);
event->note = hio_read8(f);
if (event->note)
event->note += 12;
fix_effect(event);
//.........这里部分代码省略.........
开发者ID:cmatsuoka,项目名称:libxmp,代码行数:101,代码来源:coco_load.c
注:本文中的MODULE_INFO函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路 |
请发表评论