void commandLL() { int type = sys_getc(); int link_no = getCaliValue(); int *var, _var = 0; int num, i; dridata *dfile = ald_getdata(DRIFILE_DATA, link_no - 1); WORD *data; if (dfile == NULL) { getCaliValue(); getCaliValue(); sysVar[0] = 255; return; } data = (WORD *)dfile->data; switch(type) { case 0: /* T2 */ var = getCaliVariable(); num = getCaliValue(); DEBUG_COMMAND("LL %d,%d,%d,%d:\n",type, link_no, _var, num); if (dfile->size < num * sizeof(WORD)) { WARNING("data shortage (req = %d, result = %d)\n", num, dfile->size/ sizeof(WORD)); /* sysVar[0] = 254; 大嘘*/ /* return; */ num = dfile->size / sizeof(WORD); } for (i = 0; i < num; i++) { #ifdef WORDS_BIGENDIAN *var = swap16(*data); var++; data++; #else *var = *data; var++; data++; #endif } break; case 1: _var = getCaliValue(); num = getCaliValue(); DEBUG_COMMAND_YET("LL1 not yet %d, %d\n", _var, num); sysVar[0] = 255; goto out; break; default: WARNING("Unknown LL command %d\n", type); goto out; } sysVar[0] = 0; out: ald_freedata(dfile); }
int musmidi_start(int no, int loop) { dridata *dfile; dfile = ald_getdata(DRIFILE_MIDI, no -1); if (dfile == NULL) { prv.midi.dfile = NULL; return NG; } prv.midi.no = no; prv.midi.loop = loop; prv.midi.cnt = 0; prv.midi.st = MIDI_START; prv.midi.in_play = FALSE; prv.midi.dfile = dfile; return OK; }
// メモリ上で加工できるようロードしてコピー WAVFILE *pcmlib_load_rw(int no) { dridata *dfile; WAVFILE *wfile; dfile = ald_getdata(DRIFILE_WAVE, no -1); if (dfile == NULL) { WARNING("DRIFILE_WAVE fail to open %d\n", no -1); return NULL; } wfile = wav_getinfo(dfile->data); if (wfile) { void *p = g_malloc(wfile->bytes); memcpy(p, wfile->data, wfile->bytes); wfile->data = (BYTE *)p; wfile->dfile = NULL; } ald_freedata(dfile); return wfile; }
/** * 指定の番号の .WAV|.OGG をロードする。 * @param no: DRIファイル番号 * @return: WAVFILE object */ WAVFILE *pcmlib_load(int no) { dridata *dfile; WAVFILE *wfile; dfile = ald_getdata(DRIFILE_WAVE, no -1); if (dfile == NULL) { WARNING("DRIFILE_WAVE fail to open %d\n", no -1); return NULL; } wfile = wav_getinfo(dfile->data); if (wfile == NULL) { wfile = ogg_getinfo(dfile->data, dfile->size); if (wfile == NULL) { WARNING("not .wav or .ogg file\n"); ald_freedata(dfile); return NULL; } } wfile->dfile = dfile; return wfile; }