qboolean fixed_speed, fixed_width, fixed_channels;
snd_format_t chosen_fmt;
static snd_format_t prev_render_format = {0, 0, 0};
- const char* env;
+ char* env;
+#if _MSC_VER >= 1400
+ size_t envlen;
+#endif
int i;
if (!snd_initialized.integer)
chosen_fmt.channels = snd_channels.integer;
// Check the environment variables to see if the player wants a particular sound format
+#if _MSC_VER >= 1400
+ _dupenv_s(&env, &envlen, "QUAKE_SOUND_CHANNELS");
+#else
env = getenv("QUAKE_SOUND_CHANNELS");
+#endif
if (env != NULL)
{
chosen_fmt.channels = atoi (env);
+#if _MSC_VER >= 1400
+ free(env);
+#endif
fixed_channels = true;
}
+#if _MSC_VER >= 1400
+ _dupenv_s(&env, &envlen, "QUAKE_SOUND_SPEED");
+#else
env = getenv("QUAKE_SOUND_SPEED");
+#endif
if (env != NULL)
{
chosen_fmt.speed = atoi (env);
+#if _MSC_VER >= 1400
+ free(env);
+#endif
fixed_speed = true;
}
+#if _MSC_VER >= 1400
+ _dupenv_s(&env, &envlen, "QUAKE_SOUND_SAMPLEBITS");
+#else
env = getenv("QUAKE_SOUND_SAMPLEBITS");
+#endif
if (env != NULL)
{
chosen_fmt.width = atoi (env) / 8;
+#if _MSC_VER >= 1400
+ free(env);
+#endif
fixed_width = true;
}
SndSys_Submit();
oldsoundtime = soundtime;
+
+ cls.soundstats.latency_milliseconds = (snd_renderbuffer->endframe - snd_renderbuffer->startframe) * 1000 / snd_renderbuffer->format.speed;
}
/*
*/
void S_Update(const matrix4x4_t *listenermatrix)
{
- unsigned int i, j, total;
+ unsigned int i, j, k;
channel_t *ch, *combine;
matrix4x4_t basematrix, rotatematrix;
combine = NULL;
// update spatialization for static and dynamic sounds
+ cls.soundstats.totalsounds = 0;
+ cls.soundstats.mixedsounds = 0;
ch = channels+NUM_AMBIENTS;
for (i=NUM_AMBIENTS ; i<total_channels; i++, ch++)
{
if (!ch->sfx)
continue;
+ cls.soundstats.totalsounds++;
// respatialize channel
SND_Spatialize(ch, i >= MAX_DYNAMIC_CHANNELS + NUM_AMBIENTS);
}
}
}
+ for (k = 0;k < SND_LISTENERS;k++)
+ if (ch->listener_volume[k])
+ break;
+ if (k < SND_LISTENERS)
+ cls.soundstats.mixedsounds++;
}
sound_spatialized = true;
// debugging output
if (snd_show.integer)
- {
- total = 0;
- ch = channels;
- for (i=0 ; i<total_channels; i++, ch++)
- {
- if (ch->sfx)
- {
- for (j = 0;j < SND_LISTENERS;j++)
- if (ch->listener_volume[j])
- break;
- if (j < SND_LISTENERS)
- total++;
- }
- }
-
- Con_Printf("----(%u)----\n", total);
- }
+ Con_Printf("----(%u)----\n", cls.soundstats.mixedsounds);
S_PaintAndSubmit();
}