diff options
author | Chris Robinson <[email protected]> | 2012-02-20 12:46:09 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2012-02-20 12:46:09 -0800 |
commit | 771ef3e8d528ada386456c9206421f55a628a8cb (patch) | |
tree | b2ea93284207e366b2fa978b409c695de5a62b2a /Alc/backends/alsa.c | |
parent | 65ed18960e86483dcd9ff6ff5841882f174af4ed (diff) |
Rename p -> hp for ALSA's hw params
Diffstat (limited to 'Alc/backends/alsa.c')
-rw-r--r-- | Alc/backends/alsa.c | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/Alc/backends/alsa.c b/Alc/backends/alsa.c index 9f77b60d..e86d4fc5 100644 --- a/Alc/backends/alsa.c +++ b/Alc/backends/alsa.c @@ -631,7 +631,7 @@ static ALCboolean alsa_reset_playback(ALCdevice *device) snd_pcm_uframes_t periodSizeInFrames; unsigned int periodLen, bufferLen; snd_pcm_sw_params_t *sp = NULL; - snd_pcm_hw_params_t *p = NULL; + snd_pcm_hw_params_t *hp = NULL; snd_pcm_access_t access; snd_pcm_format_t format; unsigned int periods; @@ -673,21 +673,21 @@ static ALCboolean alsa_reset_playback(ALCdevice *device) bufferLen = periodLen * periods; rate = device->Frequency; - snd_pcm_hw_params_malloc(&p); + snd_pcm_hw_params_malloc(&hp); #define CHECK(x) if((funcerr=#x),(err=(x)) < 0) goto error - CHECK(snd_pcm_hw_params_any(data->pcmHandle, p)); + CHECK(snd_pcm_hw_params_any(data->pcmHandle, hp)); /* set interleaved access */ - if(!allowmmap || snd_pcm_hw_params_set_access(data->pcmHandle, p, SND_PCM_ACCESS_MMAP_INTERLEAVED) < 0) + if(!allowmmap || snd_pcm_hw_params_set_access(data->pcmHandle, hp, SND_PCM_ACCESS_MMAP_INTERLEAVED) < 0) { if(periods > 2) { periods--; bufferLen = periodLen * periods; } - CHECK(snd_pcm_hw_params_set_access(data->pcmHandle, p, SND_PCM_ACCESS_RW_INTERLEAVED)); + CHECK(snd_pcm_hw_params_set_access(data->pcmHandle, hp, SND_PCM_ACCESS_RW_INTERLEAVED)); } /* test and set format (implicitly sets sample bits) */ - if(snd_pcm_hw_params_test_format(data->pcmHandle, p, format) < 0) + if(snd_pcm_hw_params_test_format(data->pcmHandle, hp, format) < 0) { static const struct { snd_pcm_format_t format; @@ -706,16 +706,16 @@ static ALCboolean alsa_reset_playback(ALCdevice *device) for(k = 0;k < COUNTOF(formatlist);k++) { format = formatlist[k].format; - if(snd_pcm_hw_params_test_format(data->pcmHandle, p, format) >= 0) + if(snd_pcm_hw_params_test_format(data->pcmHandle, hp, format) >= 0) { device->FmtType = formatlist[k].fmttype; break; } } } - CHECK(snd_pcm_hw_params_set_format(data->pcmHandle, p, format)); + CHECK(snd_pcm_hw_params_set_format(data->pcmHandle, hp, format)); /* test and set channels (implicitly sets frame bits) */ - if(snd_pcm_hw_params_test_channels(data->pcmHandle, p, ChannelsFromDevFmt(device->FmtChans)) < 0) + if(snd_pcm_hw_params_test_channels(data->pcmHandle, hp, ChannelsFromDevFmt(device->FmtChans)) < 0) { static const enum DevFmtChannels channellist[] = { DevFmtStereo, @@ -728,31 +728,31 @@ static ALCboolean alsa_reset_playback(ALCdevice *device) for(k = 0;k < COUNTOF(channellist);k++) { - if(snd_pcm_hw_params_test_channels(data->pcmHandle, p, ChannelsFromDevFmt(channellist[k])) >= 0) + if(snd_pcm_hw_params_test_channels(data->pcmHandle, hp, ChannelsFromDevFmt(channellist[k])) >= 0) { device->FmtChans = channellist[k]; break; } } } - CHECK(snd_pcm_hw_params_set_channels(data->pcmHandle, p, ChannelsFromDevFmt(device->FmtChans))); + CHECK(snd_pcm_hw_params_set_channels(data->pcmHandle, hp, ChannelsFromDevFmt(device->FmtChans))); /* set rate (implicitly constrains period/buffer parameters) */ - if(snd_pcm_hw_params_set_rate_resample(data->pcmHandle, p, 0) < 0) + if(snd_pcm_hw_params_set_rate_resample(data->pcmHandle, hp, 0) < 0) ERR("Failed to disable ALSA resampler\n"); - CHECK(snd_pcm_hw_params_set_rate_near(data->pcmHandle, p, &rate, NULL)); + CHECK(snd_pcm_hw_params_set_rate_near(data->pcmHandle, hp, &rate, NULL)); /* set buffer time (implicitly constrains period/buffer parameters) */ - CHECK(snd_pcm_hw_params_set_buffer_time_near(data->pcmHandle, p, &bufferLen, NULL)); + CHECK(snd_pcm_hw_params_set_buffer_time_near(data->pcmHandle, hp, &bufferLen, NULL)); /* set period time (implicitly sets buffer size/bytes/time and period size/bytes) */ - CHECK(snd_pcm_hw_params_set_period_time_near(data->pcmHandle, p, &periodLen, NULL)); + CHECK(snd_pcm_hw_params_set_period_time_near(data->pcmHandle, hp, &periodLen, NULL)); /* install and prepare hardware configuration */ - CHECK(snd_pcm_hw_params(data->pcmHandle, p)); + CHECK(snd_pcm_hw_params(data->pcmHandle, hp)); /* retrieve configuration info */ - CHECK(snd_pcm_hw_params_get_access(p, &access)); - CHECK(snd_pcm_hw_params_get_period_size(p, &periodSizeInFrames, NULL)); - CHECK(snd_pcm_hw_params_get_periods(p, &periods, NULL)); + CHECK(snd_pcm_hw_params_get_access(hp, &access)); + CHECK(snd_pcm_hw_params_get_period_size(hp, &periodSizeInFrames, NULL)); + CHECK(snd_pcm_hw_params_get_periods(hp, &periods, NULL)); - snd_pcm_hw_params_free(p); - p = NULL; + snd_pcm_hw_params_free(hp); + hp = NULL; snd_pcm_sw_params_malloc(&sp); CHECK(snd_pcm_sw_params_current(data->pcmHandle, sp)); @@ -806,7 +806,7 @@ static ALCboolean alsa_reset_playback(ALCdevice *device) error: ERR("%s failed: %s\n", funcerr, snd_strerror(err)); - if(p) snd_pcm_hw_params_free(p); + if(hp) snd_pcm_hw_params_free(hp); if(sp) snd_pcm_sw_params_free(sp); return ALC_FALSE; } @@ -830,7 +830,7 @@ static void alsa_stop_playback(ALCdevice *device) static ALCenum alsa_open_capture(ALCdevice *pDevice, const ALCchar *deviceName) { const char *driver = "default"; - snd_pcm_hw_params_t *p; + snd_pcm_hw_params_t *hp; snd_pcm_uframes_t bufferSizeInFrames; snd_pcm_uframes_t periodSizeInFrames; snd_pcm_format_t format; @@ -905,28 +905,28 @@ static ALCenum alsa_open_capture(ALCdevice *pDevice, const ALCchar *deviceName) 100*pDevice->Frequency/1000); periodSizeInFrames = minu(bufferSizeInFrames, 50*pDevice->Frequency/1000); - snd_pcm_hw_params_malloc(&p); + snd_pcm_hw_params_malloc(&hp); #define CHECK(x) if((funcerr=#x),(err=(x)) < 0) goto error - CHECK(snd_pcm_hw_params_any(data->pcmHandle, p)); + CHECK(snd_pcm_hw_params_any(data->pcmHandle, hp)); /* set interleaved access */ - CHECK(snd_pcm_hw_params_set_access(data->pcmHandle, p, SND_PCM_ACCESS_RW_INTERLEAVED)); + CHECK(snd_pcm_hw_params_set_access(data->pcmHandle, hp, SND_PCM_ACCESS_RW_INTERLEAVED)); /* set format (implicitly sets sample bits) */ - CHECK(snd_pcm_hw_params_set_format(data->pcmHandle, p, format)); + CHECK(snd_pcm_hw_params_set_format(data->pcmHandle, hp, format)); /* set channels (implicitly sets frame bits) */ - CHECK(snd_pcm_hw_params_set_channels(data->pcmHandle, p, ChannelsFromDevFmt(pDevice->FmtChans))); + CHECK(snd_pcm_hw_params_set_channels(data->pcmHandle, hp, ChannelsFromDevFmt(pDevice->FmtChans))); /* set rate (implicitly constrains period/buffer parameters) */ - CHECK(snd_pcm_hw_params_set_rate(data->pcmHandle, p, pDevice->Frequency, 0)); + CHECK(snd_pcm_hw_params_set_rate(data->pcmHandle, hp, pDevice->Frequency, 0)); /* set buffer size in frame units (implicitly sets period size/bytes/time and buffer time/bytes) */ - CHECK(snd_pcm_hw_params_set_buffer_size_near(data->pcmHandle, p, &bufferSizeInFrames)); + CHECK(snd_pcm_hw_params_set_buffer_size_near(data->pcmHandle, hp, &bufferSizeInFrames)); /* set buffer size in frame units (implicitly sets period size/bytes/time and buffer time/bytes) */ - CHECK(snd_pcm_hw_params_set_period_size_near(data->pcmHandle, p, &periodSizeInFrames, NULL)); + CHECK(snd_pcm_hw_params_set_period_size_near(data->pcmHandle, hp, &periodSizeInFrames, NULL)); /* install and prepare hardware configuration */ - CHECK(snd_pcm_hw_params(data->pcmHandle, p)); + CHECK(snd_pcm_hw_params(data->pcmHandle, hp)); /* retrieve configuration info */ - CHECK(snd_pcm_hw_params_get_period_size(p, &bufferSizeInFrames, NULL)); + CHECK(snd_pcm_hw_params_get_period_size(hp, &bufferSizeInFrames, NULL)); #undef CHECK - snd_pcm_hw_params_free(p); - p = NULL; + snd_pcm_hw_params_free(hp); + hp = NULL; frameSize = FrameSizeFromDevFmt(pDevice->FmtChans, pDevice->FmtType); @@ -952,7 +952,7 @@ static ALCenum alsa_open_capture(ALCdevice *pDevice, const ALCchar *deviceName) error: ERR("%s failed: %s\n", funcerr, snd_strerror(err)); - if(p) snd_pcm_hw_params_free(p); + if(hp) snd_pcm_hw_params_free(hp); error2: free(data->buffer); |