- s->silentlymissing = !complain;
- if (complain)
- Con_Printf("Couldn't load %s\n", namebuffer);
- return NULL;
- }
-
- info = GetWavinfo (s->name, data, fs_filesize);
- // LordHavoc: stereo sounds are now allowed (intended for music)
- if (info.channels < 1 || info.channels > 2)
- {
- Con_Printf("%s has an unsupported number of channels (%i)\n",s->name, info.channels);
- Mem_Free(data);
- return NULL;
- }
-
- // calculate resampled length
- len = (int) ((double) info.samples * (double) shm->speed / (double) info.rate);
- len = len * info.width * info.channels;
-
- // FIXME: add S_UnloadSounds or something?
- Mem_FreePool(&s->mempool);
- s->mempool = Mem_AllocPool(s->name);
- sc = s->sfxcache = Mem_Alloc(s->mempool, len + sizeof(sfxcache_t));
- if (!sc)
- {
- Con_Printf("failed to allocate memory for sound \"%s\"\n", s->name);
- Mem_FreePool(&s->mempool);
- Mem_Free(data);
- return NULL;
+ if (s->format.speed != shm->format.speed)
+ Sys_Error ("S_LoadSound: sound %s hasn't been resampled (%uHz instead of %uHz)", s->name);
+ return true;