Get rid of switch case in fillOutputBuffers for minor speedup

This commit is contained in:
Steam Deck User 2023-02-13 12:55:28 -05:00
parent ebe5aad8f1
commit 8194bfc257

View file

@ -47,23 +47,8 @@ namespace quake
static inline void copySamples(const Sample* first, const Sample* last, Sample* destination)
{
switch (inputSamplesPerOutputSample)
{
case 1:
memcpy(destination, first, (last - first) * sizeof(Sample));
break;
case 2:
for (const Sample* source = first; source != last; ++source)
{
const Sample sample = *source;
*destination++ = sample;
*destination++ = sample;
}
break;
case 4:
for (const Sample* source = first; source != last; ++source)
// just assume inputSamplesPerOutputSample is 4.
for (const Sample* source = first; source != last; ++source)
{
const Sample sample = *source;
*destination++ = sample;
@ -71,11 +56,6 @@ namespace quake
*destination++ = sample;
*destination++ = sample;
}
break;
default:
break;
}
}
static void fillOutputBuffer(void* buffer, unsigned int samplesToWrite, void* userData)