diff options
author | fulup <fulup.arfoll@iot.bzh> | 2018-06-05 01:02:16 +0200 |
---|---|---|
committer | fulup <fulup.arfoll@iot.bzh> | 2018-06-05 01:02:16 +0200 |
commit | f2510b35caf15cf59a7c3efaf95a3483c046f084 (patch) | |
tree | f2d60f9f26b16a22400a1feb8cc304ddc83f8f86 /plugins | |
parent | c4c0647af21b2a05e87f36101d86dc2d35f1f47c (diff) |
Added per sink/source API for master control
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/alsa/alsa-api-pcm.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/plugins/alsa/alsa-api-pcm.c b/plugins/alsa/alsa-api-pcm.c index de9ed0c..5bd6dca 100644 --- a/plugins/alsa/alsa-api-pcm.c +++ b/plugins/alsa/alsa-api-pcm.c @@ -177,7 +177,7 @@ STATIC int PcmSetControl(SoftMixerT *mixer, AlsaSndCtlT *sndcard, AlsaSndControl } error = CtlElemIdGetLong(mixer, sndcard, elemId, &curval); - if (!error) { + if (error) { AFB_ApiError(mixer->api, "PcmSetControl sndard=%s fail to read control numid=%d", sndcard->cid.cardid, control->numid); goto OnErrorExit; } @@ -199,10 +199,14 @@ STATIC int PcmSetControl(SoftMixerT *mixer, AlsaSndCtlT *sndcard, AlsaSndControl value = CONVERT_PERCENT(curval, control->min, control->max) - value; break; default: - value= CONVERT_VOLUME(value, control->min, control->max); + value= value; } - error = CtlElemIdSetLong(mixer, sndcard, elemId, (int)value); + error = CtlElemIdSetLong(mixer, sndcard, elemId, CONVERT_VOLUME(value, control->min, control->max)); + if (error) { + AFB_ApiError(mixer->api, "PcmSetControl sndard=%s fail to write control numid=%d value=%d", sndcard->cid.cardid, control->numid, value); + goto OnErrorExit; + } break; default: @@ -474,7 +478,7 @@ PUBLIC AlsaSndPcmT * ApiPcmAttachOne(SoftMixerT *mixer, const char *uid, snd_pcm (void) asprintf(&apiVerb, "%s/playback", pcm->uid); (void) asprintf(&apiInfo, "HAL:%s SND_PCM_STREAM_PLAYBACK", uid); } else { - (void) asprintf(&apiVerb, "%s/playback", pcm->uid); + (void) asprintf(&apiVerb, "%s/capture", pcm->uid); (void) asprintf(&apiInfo, "HAL:%s SND_PCM_STREAM_PLAYBACK", uid); } apiVerbHandleT *handle = calloc(1, sizeof (apiVerbHandleT)); |