]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - snd_modplug.c
fix two remaining uses of sys_usetimegettime
[xonotic/darkplaces.git] / snd_modplug.c
index 748d9e45ee009c30f15ed057cf918ba19aa45a61..98d3706969ecaadc12cb7e1b6ad965e0c48c4eeb 100644 (file)
@@ -133,9 +133,7 @@ qboolean ModPlug_OpenLibrary (void)
 {
        const char* dllnames_modplug [] =
        {
-#if defined(WIN64)
-               "libmodplug64.dll",
-#elif defined(WIN32)
+#if defined(WIN32)
                "libmodplug-0.dll",
                "modplug.dll",
 #elif defined(MACOSX)
@@ -329,16 +327,17 @@ static const snd_buffer_t* ModPlug_FetchSound (void *sfxfetcher, void **chfetche
 
        per_ch->sb_offset = real_start;
 
-       // We add exactly 1 sec of sound to the buffer:
-       // 1- to ensure we won't lose any sample during the resampling process
-       // 2- to force one call to ModPlug_FetchSound per second to regulate the workload
-       if ((int)(sb->format.speed * STREAM_BUFFER_FILL) + sb->nbframes > sb->maxframes)
+       // We add more than one frame of sound to the buffer:
+       // 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)
        {
                Con_Printf ("ModPlug_FetchSound: stream buffer overflow (%u sample frames / %u)\n",
                                        sb->format.speed + sb->nbframes, sb->maxframes);
                return NULL;
        }
-       newlength = (int)(per_sfx->format.speed*STREAM_BUFFER_FILL) * factor;  // -> 1 sec of sound before resampling
+       newlength *= factor; // convert from sample frames to bytes
        if(newlength > (int)sizeof(resampling_buffer))
                newlength = sizeof(resampling_buffer);