// Cvars declared in snd_main.h (shared with other snd_*.c files)
cvar_t _snd_mixahead = {CF_CLIENT | CF_ARCHIVE, "_snd_mixahead", "0.15", "how much sound to mix ahead of time"};
cvar_t snd_streaming = {CF_CLIENT | CF_ARCHIVE, "snd_streaming", "1", "enables keeping compressed ogg sound files compressed, decompressing them only as needed, otherwise they will be decompressed completely at load (may use a lot of memory); when set to 2, streaming is performed even if this would waste memory"};
+cvar_t snd_streaming_ignoremusic = {CF_CLIENT | CF_ARCHIVE, "snd_streaming_ignoremusic", "1", "forces streaming off for music tracks"};
cvar_t snd_streaming_length = {CF_CLIENT | CF_ARCHIVE, "snd_streaming_length", "1", "decompress sounds completely if they are less than this play time when snd_streaming is 1"};
cvar_t snd_swapstereo = {CF_CLIENT | CF_ARCHIVE, "snd_swapstereo", "0", "swaps left/right speakers for old ISA soundblaster cards"};
extern cvar_t v_flipped;
Cvar_RegisterVariable(&snd_precache);
Cvar_RegisterVariable(&snd_initialized);
Cvar_RegisterVariable(&snd_streaming);
+ Cvar_RegisterVariable(&snd_streaming_ignoremusic);
Cvar_RegisterVariable(&snd_streaming_length);
Cvar_RegisterVariable(&ambient_level);
Cvar_RegisterVariable(&ambient_fade);
extern struct cvar_s _snd_mixahead;
extern struct cvar_s snd_swapstereo;
extern struct cvar_s snd_streaming;
+extern struct cvar_s snd_streaming_ignoremusic;
extern struct cvar_s snd_streaming_length;
#define SND_CHANNELLAYOUT_AUTO 0
vorbis_info *vi;
vorbis_comment *vc;
double peak, gaindb;
+ int shouldStream;
#ifndef LINK_TO_LIBVORBIS
if (!vf_dll)
sfx->format.width = 2; // We always work with 16 bits samples
sfx->total_length = qov_pcm_total(&vf, -1);
+
+ shouldStream = FALSE;
+
+ //Con_Print("Sound effect (ogg) loaded\n");
if (snd_streaming.integer && (snd_streaming.integer >= 2 || sfx->total_length > max(sizeof(ogg_stream_perchannel_t), snd_streaming_length.value * sfx->format.speed)))
+ {
+ if (!(snd_streaming_ignoremusic.integer && (strncmp(filename, "sound/cdtracks/", 15) == 0 || strncmp(filename, "sound/music/", 12) == 0)))
+ {
+ shouldStream = TRUE;
+ }
+ }
+
+
+ if (shouldStream)
{
// large sounds use the OGG fetcher to decode the file on demand (but the entire file is held in memory)
ogg_stream_persfx_t* per_sfx;