--- np2/sound/rhythmc.c 2004/02/18 20:11:37 1.8 +++ np2/sound/rhythmc.c 2004/02/21 16:35:31 1.9 @@ -17,6 +17,8 @@ static const char *rhythmfile[6] = { file_2608hh, file_2608tom, file_2608rim}; typedef struct { + UINT rate; + UINT pcmexist; PMIXDAT pcm[6]; UINT vol; UINT voltbl[96]; @@ -28,13 +30,10 @@ static RHYTHMCFG rhythmcfg; void rhythm_initialize(UINT rate) { UINT i; - char path[MAX_PATH]; ZeroMemory(&rhythmcfg, sizeof(rhythmcfg)); - for (i=0; i<6; i++) { - getbiospath(path, rhythmfile[i], sizeof(path)); - pcmmix_regfile(rhythmcfg.pcm + i, path, rate); - } + rhythmcfg.rate = rate; + for (i=0; i<96; i++) { rhythmcfg.voltbl[i] = (UINT)(32768.0 * pow(2.0, (double)i * (-3.0) / 40.0)); @@ -55,6 +54,19 @@ void rhythm_deinitialize(void) { } } +static void rhythm_load(void) { + + int i; + char path[MAX_PATH]; + + for (i=0; i<6; i++) { + if (rhythmcfg.pcm[i].sample == NULL) { + getbiospath(path, rhythmfile[i], sizeof(path)); + pcmmix_regfile(rhythmcfg.pcm + i, path, rhythmcfg.rate); + } + } +} + UINT rhythm_getcaps(void) { UINT ret; @@ -83,6 +95,7 @@ void rhythm_bind(RHYTHM rhy) { UINT i; + rhythm_load(); rhy->hdr.enable = 0x3f; for (i=0; i<6; i++) { rhy->trk[i].data = rhythmcfg.pcm[i];