Skip to content

Commit

Permalink
Allow up to 48 buffers in AL raw samples queue.
Browse files Browse the repository at this point in the history
Assuming Vorbis frame of 128 samples at 48 kHz sampling rate, 48 buffers
will let the client run at 7.8 FPS without underruns. Current value of
16 only allows 23.4 FPS minimum, which is not enough for continuous
playback in minimized state (at 10 FPS).

Fixes #326.
  • Loading branch information
skullernet committed Oct 26, 2023
1 parent 4a0dc07 commit 51c0ba0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/client/sound/al.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,12 +393,17 @@ static void AL_StreamStop(void)
Q_assert(!s_stream_buffers);
}

static bool AL_NeedRawSamples(void)
{
return s_stream_buffers < 48;
}

static bool AL_RawSamples(int samples, int rate, int width, int channels, const byte *data, float volume)
{
ALenum format = AL_FORMAT_MONO8 + (channels - 1) * 2 + (width - 1);
ALuint buffer = 0;

if (s_stream_buffers < 16) {
if (AL_NeedRawSamples()) {
qalGetError();
qalGenBuffers(1, &buffer);
if (qalGetError())
Expand Down Expand Up @@ -427,11 +432,6 @@ static bool AL_RawSamples(int samples, int rate, int width, int channels, const
return true;
}

static bool AL_NeedRawSamples(void)
{
return s_stream_buffers < 16;
}

static void AL_UpdateUnderWater(void)
{
bool underwater = S_IsUnderWater();
Expand Down

0 comments on commit 51c0ba0

Please sign in to comment.