aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/alsa/alsa-core-pcm.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/alsa/alsa-core-pcm.c')
-rw-r--r--plugins/alsa/alsa-core-pcm.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/plugins/alsa/alsa-core-pcm.c b/plugins/alsa/alsa-core-pcm.c
index e03c320..f058cb9 100644
--- a/plugins/alsa/alsa-core-pcm.c
+++ b/plugins/alsa/alsa-core-pcm.c
@@ -136,7 +136,22 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
}
}
- if (opts->rate > 0 ) {
+ unsigned int * channels = &opts->channels;
+
+ if (*channels) {
+ AFB_API_DEBUG(mixer->api, "%s: Attempt to set %d channels", __func__, *channels);
+ if ((error = snd_pcm_hw_params_set_channels(pcm->handle, pxmHwParams, *channels)) < 0) {
+ AFB_API_ERROR(mixer->api,
+ "%s (%s): mixer=%s Set_Channels=%d Fail error=%s",
+ __func__, card, mixer->uid, *channels, snd_strerror(error));
+
+ AlsaDumpPcmParams(mixer, pxmHwParams);
+ goto OnErrorExit;
+ };
+ AFB_API_DEBUG(mixer->api, "%s: CHANNELS SET TO %d", __func__, *channels);
+ }
+
+ if (opts->rate > 0 ) {
AFB_API_DEBUG(mixer->api,"%s (%s): set rate to %d", __func__, card, opts->rate);
unsigned int pcmRate = opts->rate;
@@ -158,14 +173,6 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
}
}
- if (opts->channels) {
- if ((error = snd_pcm_hw_params_set_channels(pcm->handle, pxmHwParams, opts->channels)) < 0) {
- AFB_API_ERROR(mixer->api,
- "%s (%s): mixer=%s Set_Channels=%d Fail error=%s",
- __func__, card, mixer->uid, opts->channels, snd_strerror(error));
- goto OnErrorExit;
- };
- }
/* The following code, that
* 1) sets period time/size; buffer time/size hardware params