void getfileinfo(char *filename, char *title, int *length_in_ms) { CUBEFILE ficube; if (!filename || !*filename) // currently playing file { if (length_in_ms) *length_in_ms=getlength(); if (title) { char *p=lastfn+lstrlen(lastfn); while (*p != '\\' && p >= lastfn) p--; lstrcpy(title,++p); } } else // some other file { if (length_in_ms) { *length_in_ms=-1000; if (!InitADPFILE(filename,&ficube) || !InitADXFILE(filename,&ficube) || !InitDSPFILE(filename,&ficube)) { // these are only second-accurate, but how accurate does this need to be anyway? *length_in_ms = ficube.nrsamples/ficube.ch[0].sample_rate*1000; } CloseCUBEFILE(&ficube); } if (title) { char *p=filename+lstrlen(filename); while (*p != '\\' && p >= filename) p--; lstrcpy(title,++p); } } }
void __declspec(dllexport) DLL_FreeADX(int adx) { ADXSong* song = (ADXSong*)adx; CloseCUBEFILE(&song->cubefile); delete (ADXSong*)adx; }
void stop() { if (thread_handle != INVALID_HANDLE_VALUE) { killDecodeThread=1; if (WaitForSingleObject(thread_handle,INFINITE) == WAIT_TIMEOUT) { MessageBox(mod.hMainWindow,"error asking thread to die!\n","error killing decode thread",0); TerminateThread(thread_handle,0); } CloseHandle(thread_handle); thread_handle = INVALID_HANDLE_VALUE; } CloseCUBEFILE(&cubefile); mod.outMod->Close(); mod.SAVSADeInit(); }
int infoDlg(char *fn, HWND hwnd) { CUBEFILE idcube; char msgbuf[512],titbuf[32],loopstr[50]="no loop",type[50],cat[50]; int sasec,easec; if (!InitADPFILE(fn,&idcube) || !InitADXFILE(fn,&idcube) || !InitDSPFILE(fn,&idcube)) { switch(idcube.ch[0].type) { case type_adx03: case type_adx04: sasec=idcube.ch[0].sa*32/idcube.NCH/18/idcube.ch[0].sample_rate; easec=idcube.ch[0].ea*32/idcube.NCH/18/idcube.ch[0].sample_rate; strcpy(cat,"ADX"); break; case type_adp: strcpy(cat,"ADP"); break; default: if (idcube.ch[0].interleave) { sasec=idcube.ch[0].sa*14/(8*8/idcube.ch[0].bps)/idcube.NCH/idcube.ch[0].sample_rate; easec=idcube.ch[0].ea*14/(8*8/idcube.ch[0].bps)/idcube.NCH/idcube.ch[0].sample_rate; } else { sasec=idcube.ch[0].sa*14/(8*8/idcube.ch[0].bps)/idcube.ch[0].sample_rate; easec=idcube.ch[0].ea*14/(8*8/idcube.ch[0].bps)/idcube.ch[0].sample_rate; } strcpy(cat,"DSP"); break; } if (idcube.ch[0].loop_flag) sprintf(loopstr,"loop start: %d:%02d\nloop end: %d:%02d",sasec/60,sasec%60,easec/60,easec%60); switch (idcube.ch[0].type) { case type_std: strcpy(type,"standard or unrecognized"); break; case type_sfass: strcpy(type,"Cstr"); break; case type_mp2: strcpy(type,"RS03"); break; case type_pm2: strcpy(type,"STM"); break; case type_halp: strcpy(type,"HALPST"); break; case type_idsp: strcpy(type,"IDSP"); break; case type_spt: strcpy(type,"SPT+SPD"); break; case type_mss: strcpy(type,"MSS"); break; case type_gcm: strcpy(type,"GCM"); break; case type_mpdsp: strcpy(type,"Monopoly Party HACK"); break; case type_ish: strcpy(type,"ISH+ISD"); break; case type_ymf: strcpy(type,"YMF"); break; case type_adx03: strcpy(type,"03"); break; case type_adx04: strcpy(type,"04"); break; case type_adp: strcpy(type,"headerless"); break; } sprintf(titbuf,"%s Info",cat); sprintf(msgbuf,"%d Hz %s %s\ntype: %s\n%d samples\n%s",idcube.ch[0].sample_rate, (idcube.NCH==2?"stereo":"mono"),cat,type, idcube.nrsamples,loopstr ); MessageBox(mod.hMainWindow,msgbuf,titbuf,MB_OK); CloseCUBEFILE(&idcube); } return 0; }