From 0214a1102497003df07f354adc1e77d2b3185953 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 19 Dec 2018 05:57:36 -0800 Subject: Use inline methods for the device format sizes --- Alc/backends/qsa.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'Alc/backends/qsa.cpp') diff --git a/Alc/backends/qsa.cpp b/Alc/backends/qsa.cpp index 3d09a744..f8b26878 100644 --- a/Alc/backends/qsa.cpp +++ b/Alc/backends/qsa.cpp @@ -210,9 +210,7 @@ FORCE_ALIGN static int qsa_proc_playback(void *ptr) param.sched_priority=param.sched_curpriority+1; SchedSet(0, 0, SCHED_NOCHANGE, ¶m); - const ALint frame_size = FrameSizeFromDevFmt( - device->FmtChans, device->FmtType, device->mAmbiOrder - ); + const ALint frame_size = device->frameSizeFromFmt(); PlaybackWrapper_lock(self); while(!data->mKillNow.load(std::memory_order_acquire)) @@ -385,14 +383,13 @@ static ALCboolean qsa_reset_playback(PlaybackWrapper *self) data->cparams.start_mode=SND_PCM_START_FULL; data->cparams.stop_mode=SND_PCM_STOP_STOP; - data->cparams.buf.block.frag_size=device->UpdateSize * - FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->mAmbiOrder); + data->cparams.buf.block.frag_size=device->UpdateSize * device->frameSizeFromFmt(); data->cparams.buf.block.frags_max=device->NumUpdates; data->cparams.buf.block.frags_min=device->NumUpdates; data->cparams.format.interleave=1; data->cparams.format.rate=device->Frequency; - data->cparams.format.voices=ChannelsFromDevFmt(device->FmtChans, device->mAmbiOrder); + data->cparams.format.voices=device->channelsFromFmt(); data->cparams.format.format=format; if ((snd_pcm_plugin_params(data->pcmHandle, &data->cparams))<0) @@ -575,8 +572,7 @@ static ALCboolean qsa_reset_playback(PlaybackWrapper *self) SetDefaultChannelOrder(device); - device->UpdateSize=data->csetup.buf.block.frag_size/ - FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->mAmbiOrder); + device->UpdateSize=data->csetup.buf.block.frag_size / device->frameSizeFromFmt(); device->NumUpdates=data->csetup.buf.block.frags; data->size=data->csetup.buf.block.frag_size; @@ -757,14 +753,13 @@ static ALCenum qsa_open_capture(CaptureWrapper *self, const ALCchar *deviceName) data->cparams.start_mode=SND_PCM_START_GO; data->cparams.stop_mode=SND_PCM_STOP_STOP; - data->cparams.buf.block.frag_size=device->UpdateSize* - FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->mAmbiOrder); + data->cparams.buf.block.frag_size=device->UpdateSize * device->frameSizeFromFmt(); data->cparams.buf.block.frags_max=device->NumUpdates; data->cparams.buf.block.frags_min=device->NumUpdates; data->cparams.format.interleave=1; data->cparams.format.rate=device->Frequency; - data->cparams.format.voices=ChannelsFromDevFmt(device->FmtChans, device->mAmbiOrder); + data->cparams.format.voices=device->channelsFromFmt(); data->cparams.format.format=format; if(snd_pcm_plugin_params(data->pcmHandle, &data->cparams) < 0) @@ -822,7 +817,7 @@ static ALCuint qsa_available_samples(CaptureWrapper *self) ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; qsa_data *data = self->ExtraData.get(); snd_pcm_channel_status_t status; - ALint frame_size = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->mAmbiOrder); + ALint frame_size = device->frameSizeFromFmt(); ALint free_size; int rstatus; @@ -859,7 +854,7 @@ static ALCenum qsa_capture_samples(CaptureWrapper *self, ALCvoid *buffer, ALCuin int selectret; struct timeval timeout; int bytes_read; - ALint frame_size=FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->mAmbiOrder); + ALint frame_size=device->frameSizeFromFmt(); ALint len=samples*frame_size; int rstatus; -- cgit v1.2.3