]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - snd_modplug.c
on OSX use ~/Library/Application Support/<gamename> instead of ~/.gamename
[xonotic/darkplaces.git] / snd_modplug.c
index 103b38a7b8ed7780f57d121fd60a19c617d43198..596b38ff75ab7d8e3a85da14a225dc285c6bd2b9 100644 (file)
@@ -81,6 +81,9 @@ void ModPlug_CloseLibrary (void)
                        int mBits;           /* Bits per sample - 8, 16, or 32 */
                        int mFrequency;      /* Sampling rate - 11025, 22050, or 44100 */
                        int mResamplingMode; /* One of MODPLUG_RESAMPLE_*, above */
+
+                       int mStereoSeparation; /* Stereo separation, 1 - 256 */
+                       int mMaxMixChannels; /* Maximum number of mixing channels (polyphony), 32 - 256 */
                        
                        int mReverbDepth;    /* Reverb level 0(quiet)-100(loud)      */
                        int mReverbDelay;    /* Reverb delay in ms, usually 40-200ms */
@@ -141,12 +144,12 @@ qboolean ModPlug_OpenLibrary (void)
        const char* dllnames_modplug [] =
        {
 #if defined(WIN32)
-               "libmodplug-0.dll",
+               "libmodplug-1.dll",
                "modplug.dll",
 #elif defined(MACOSX)
                "libmodplug.dylib",
 #else
-               "libmodplug.so.0",
+               "libmodplug.so.1",
                "libmodplug.so",
 #endif
                NULL
@@ -338,10 +341,10 @@ static const snd_buffer_t* ModPlug_FetchSound (void *sfxfetcher, void **chfetche
        // 1- to ensure we won't lose many samples during the resampling process
        // 2- to reduce calls to ModPlug_FetchSound to regulate workload
        newlength = (int)(per_sfx->format.speed*STREAM_BUFFER_FILL);
-       if (newlength + sb->nbframes > sb->maxframes)
+       if ((size_t) ((double) newlength * (double)sb->format.speed / (double)per_sfx->format.speed) + sb->nbframes > sb->maxframes)
        {
-               Con_Printf ("ModPlug_FetchSound: stream buffer overflow (%u sample frames / %u)\n",
-                                       sb->format.speed + sb->nbframes, sb->maxframes);
+               Con_Printf ("ModPlug_FetchSound: stream buffer overflow (%u + %u = %u sample frames / %u)\n",
+                                       (unsigned int) ((double) newlength * (double)sb->format.speed / (double)per_sfx->format.speed), sb->nbframes, (unsigned int) ((double) newlength * (double)sb->format.speed / (double)per_sfx->format.speed) + sb->nbframes, sb->maxframes);
                return NULL;
        }
        newlength *= factor; // convert from sample frames to bytes