aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-05-27 01:03:18 -0700
committerChris Robinson <[email protected]>2018-05-27 01:03:18 -0700
commita5edf487dd1a4095ef5c022c1f254f032ff7f537 (patch)
tree9aebb7510fee560daf84e472326abd4b48ad78d7
parent728dd5a4e05a5353795290c5d0b881883f5ecc83 (diff)
Use a macro to handle common case formatting
-rw-r--r--Alc/ALu.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index dd720183..dc24755d 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -1828,27 +1828,16 @@ void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples)
switch(device->FmtType)
{
- case DevFmtByte:
- WriteI8(Buffer, OutBuffer, SamplesDone, SamplesToDo, Channels);
- break;
- case DevFmtUByte:
- WriteUI8(Buffer, OutBuffer, SamplesDone, SamplesToDo, Channels);
- break;
- case DevFmtShort:
- WriteI16(Buffer, OutBuffer, SamplesDone, SamplesToDo, Channels);
- break;
- case DevFmtUShort:
- WriteUI16(Buffer, OutBuffer, SamplesDone, SamplesToDo, Channels);
- break;
- case DevFmtInt:
- WriteI32(Buffer, OutBuffer, SamplesDone, SamplesToDo, Channels);
- break;
- case DevFmtUInt:
- WriteUI32(Buffer, OutBuffer, SamplesDone, SamplesToDo, Channels);
- break;
- case DevFmtFloat:
- WriteF32(Buffer, OutBuffer, SamplesDone, SamplesToDo, Channels);
- break;
+#define HANDLE_WRITE(T, S) case T: \
+ Write##S(Buffer, OutBuffer, SamplesDone, SamplesToDo, Channels); break;
+ HANDLE_WRITE(DevFmtByte, I8)
+ HANDLE_WRITE(DevFmtUByte, UI8)
+ HANDLE_WRITE(DevFmtShort, I16)
+ HANDLE_WRITE(DevFmtUShort, UI16)
+ HANDLE_WRITE(DevFmtInt, I32)
+ HANDLE_WRITE(DevFmtUInt, UI32)
+ HANDLE_WRITE(DevFmtFloat, F32)
+#undef HANDLE_WRITE
}
}