# HG changeset patch # User Ryan C. Gordon # Date 1002505242 0 # Node ID bd224f22e6b24a12c0c4af069fc2da7c0ba47be1 # Parent 254916e602c65945a0b002109070a8e5640e7d4c Handles sample rate somewhat more robustly. diff -r 254916e602c6 -r bd224f22e6b2 decoders/mod.c --- a/decoders/mod.c Sat Oct 06 22:11:09 2001 +0000 +++ b/decoders/mod.c Mon Oct 08 01:40:42 2001 +0000 @@ -188,20 +188,7 @@ * sound quality. */ md_mode |= (DMODE_SOFT_MUSIC | DMODE_16BITS); - -#if 0 - /* - * SDL_mixer used to set these, but I don't know... is there - * something wrong with the defaults? Actually, the only difference - * from the defaults is md_reverb, which is usually 6. - */ - md_device = 0; /* Selects sound driver. 0 = autodetect */ - md_volume = 96; /* Overall sound volume, 0 - 128 */ - md_musicvolume = 128; /* Module volume, 0 - 128 */ - md_sndfxvolume = 128; /* Sound effect volume, 0 - 128 */ - md_pansep = 128; /* Stereo channels separation, 0 - 128 */ - md_reverb = 0; /* Sound reverbation, 0 - 15 */ -#endif + md_mixfreq = 0; BAIL_IF_MACRO(MikMod_Init(""), MikMod_strerror(MikMod_errno), 0); @@ -212,6 +199,7 @@ static void MOD_quit(void) { MikMod_Exit(); + md_mixfreq = 0; } /* MOD_quit */ @@ -229,7 +217,9 @@ _mm_delete_rwops_reader(reader); BAIL_IF_MACRO(m->module == NULL, "MOD: Not a module file.", 0); - md_mixfreq = sample->desired.rate; + if (md_mixfreq == 0) + md_mixfreq = (!sample->desired.rate) ? 44100 : sample->desired.rate; + sample->actual.channels = 2; sample->actual.rate = md_mixfreq; sample->actual.format = AUDIO_S16SYS;