|
|
| version 1.8, 2006/12/10 11:14:31 | version 1.9, 2006/12/16 09:43:24 |
|---|---|
| Line 459 VEXTERN MIDIMOD VEXPORT midimod_create(U | Line 459 VEXTERN MIDIMOD VEXPORT midimod_create(U |
| ret->tone[1] = ret->tone[0] + 128; | ret->tone[1] = ret->tone[0] + 128; |
| ret->tonecfg[0] = (TONECFG)(ret->tone[1] + 128); | ret->tonecfg[0] = (TONECFG)(ret->tone[1] + 128); |
| ret->tonecfg[1] = ret->tonecfg[0] + 128; | ret->tonecfg[1] = ret->tonecfg[0] + 128; |
| ret->pathtbl = listarray_new(sizeof(_PATHLIST), 64); | ret->pathtbl = listarray_new(sizeof(_PATHLIST), 16); |
| pathadd(ret, NULL); | pathadd(ret, NULL); |
| pathadd(ret, file_getcd(str_null)); | pathadd(ret, file_getcd(str_null)); |
| ret->namelist = listarray_new(MAX_NAME, 128); | ret->namelist = listarray_new(MAX_NAME, 128); |
| Line 472 VEXTERN MIDIMOD VEXPORT midimod_create(U | Line 472 VEXTERN MIDIMOD VEXPORT midimod_create(U |
| if (r != SUCCESS) { | if (r != SUCCESS) { |
| goto mmcre_err2; | goto mmcre_err2; |
| } | } |
| midimod_lock(ret); | |
| return(ret); | return(ret); |
| mmcre_err2: | mmcre_err2: |
| Line 483 mmcre_err1: | Line 484 mmcre_err1: |
| return(NULL); | return(NULL); |
| } | } |
| VEXTERN void VEXPORT midimod_destroy(MIDIMOD hdl) { | void midimod_lock(MIDIMOD hdl) { |
| hdl->lockcount++; | |
| } | |
| void midimod_unlock(MIDIMOD hdl) { | |
| UINT r; | UINT r; |
| TONECFG bank; | TONECFG bank; |
| if (!hdl->lockcount) { | |
| return; | |
| } | |
| hdl->lockcount--; | |
| if (hdl->lockcount) { | |
| return; | |
| } | |
| r = 128; | |
| do { | |
| r--; | |
| inst_bankfree(hdl, r); | |
| } while(r > 0); | |
| for (r=2; r<(MIDI_BANKS*2); r++) { | |
| bank = hdl->tonecfg[r]; | |
| if (bank) { | |
| _MFREE(bank); | |
| } | |
| } | |
| listarray_destroy(hdl->namelist); | |
| listarray_destroy(hdl->pathtbl); | |
| _MFREE(hdl); | |
| } | |
| VEXTERN void VEXPORT midimod_destroy(MIDIMOD hdl) { | |
| if (hdl) { | if (hdl) { |
| r = 128; | midimod_unlock(hdl); |
| do { | |
| r--; | |
| inst_bankfree(hdl, r); | |
| } while(r > 0); | |
| for (r=2; r<(MIDI_BANKS*2); r++) { | |
| bank = hdl->tonecfg[r]; | |
| if (bank) { | |
| _MFREE(bank); | |
| } | |
| } | |
| listarray_destroy(hdl->namelist); | |
| listarray_destroy(hdl->pathtbl); | |
| _MFREE(hdl); | |
| } | } |
| } | } |