aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/alsa/alsa-plug-dmix.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/alsa/alsa-plug-dmix.c')
-rw-r--r--plugins/alsa/alsa-plug-dmix.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/plugins/alsa/alsa-plug-dmix.c b/plugins/alsa/alsa-plug-dmix.c
index 3c6d62e..d63b79f 100644
--- a/plugins/alsa/alsa-plug-dmix.c
+++ b/plugins/alsa/alsa-plug-dmix.c
@@ -28,14 +28,20 @@ ALSA_PLUG_PROTO(dmix);
PUBLIC AlsaPcmCtlT* AlsaCreateDmix(SoftMixerT *mixer, const char* pcmName, AlsaSndPcmT *pcmSlave, int open) {
snd_config_t *dmixConfig = NULL, *slaveConfig = NULL, *elemConfig = NULL, *pcmConfig=NULL;
- AlsaPcmCtlT *pcmPlug= calloc(1,sizeof(AlsaPcmCtlT));
AlsaSndCtlT *sndSlave=pcmSlave->sndcard;
+
+ AlsaPcmCtlT *pcmPlug = AlsaPcmCtlNew(mixer, pcmName);
+ if (pcmPlug == NULL) {
+ SOFTMIXER_NOMEM(mixer->api);
+ goto OnErrorExit;
+ }
+
pcmPlug->cid.cardid=pcmName;
char * fullPcmName = NULL;
int error=0;
- AFB_ApiInfo(mixer->api, "%s: %s, slave %s, cardid %s (dev %d, subdev %d)\n",
+ AFB_ApiDebug(mixer->api, "%s: %s, slave %s, cardid %s (dev %d, subdev %d)",
__func__,
pcmName,
pcmSlave->uid,
@@ -46,9 +52,7 @@ PUBLIC AlsaPcmCtlT* AlsaCreateDmix(SoftMixerT *mixer, const char* pcmName, AlsaS
error = asprintf(&fullPcmName,"%s,%d,%d", sndSlave->cid.cardid, sndSlave->cid.device, sndSlave->cid.subdev);
if (error == -1) {
- AFB_ApiError(mixer->api,
- "%s: Insufficient memory",
- __func__);
+ SOFTMIXER_NOMEM(mixer->api);
goto OnErrorExit;
}
@@ -92,7 +96,7 @@ PUBLIC AlsaPcmCtlT* AlsaCreateDmix(SoftMixerT *mixer, const char* pcmName, AlsaS
* Trying to set another value later leads to silent failure
* */
- error += snd_config_imake_integer(&elemConfig, "channels", pcmSlave->ccount);
+ error += snd_config_imake_integer(&elemConfig, "channels", pcmSlave->nbChannels);
if (error) goto OnErrorExit;
error += snd_config_add(slaveConfig, elemConfig);
if (error) goto OnErrorExit;