From 7a02db1106cc5fab6016b05a5c13d3dc7c6f0be9 Mon Sep 17 00:00:00 2001 From: Thierry Bultel Date: Fri, 22 Jun 2018 17:19:40 +0200 Subject: plugins: code & log cleanup --- plugins/alsa/alsa-api-mixer.c | 6 +++--- plugins/alsa/alsa-api-streams.c | 14 +++++++------- plugins/alsa/alsa-plug-rate.c | 6 +++--- plugins/alsa/alsa-plug-vol.c | 3 ++- plugins/alsa/alsa-softmixer.c | 2 +- plugins/alsa/alsa-utils-bypath.c | 2 +- plugins/alsa/alsa-utils-dump.c | 8 ++++---- 7 files changed, 21 insertions(+), 20 deletions(-) (limited to 'plugins') diff --git a/plugins/alsa/alsa-api-mixer.c b/plugins/alsa/alsa-api-mixer.c index 407b2c0..f17e122 100644 --- a/plugins/alsa/alsa-api-mixer.c +++ b/plugins/alsa/alsa-api-mixer.c @@ -624,10 +624,10 @@ STATIC void MixerAttachVerb(AFB_ReqT request) { json_object_object_add(responseJ, "streams", resultJ); } - AFB_ApiNotice(mixer->api, "%s responseJ=%s\n", __func__, json_object_get_string(responseJ)); + AFB_ApiNotice(mixer->api, "%s responseJ=%s", __func__, json_object_get_string(responseJ)); AFB_ReqSuccess(request, responseJ, NULL); - AFB_ApiInfo(mixer->api,"%s DONE\n", __func__); + AFB_ApiInfo(mixer->api,"%s DONE", __func__); return; OnErrorExit: @@ -638,7 +638,7 @@ STATIC void MixerPingVerb(AFB_ReqT request) { static int count = 0; count++; - AFB_ReqInfo(request, "MixerAttachVerb: Controller:ping count=%d\n", count); + AFB_ReqInfo(request, "MixerAttachVerb: Controller:ping count=%d", count); AFB_ReqSuccess(request, json_object_new_int(count), NULL); return; diff --git a/plugins/alsa/alsa-api-streams.c b/plugins/alsa/alsa-api-streams.c index 4df21e9..dab7748 100644 --- a/plugins/alsa/alsa-api-streams.c +++ b/plugins/alsa/alsa-api-streams.c @@ -208,12 +208,12 @@ STATIC int CreateOneStream(SoftMixerT *mixer, const char * uid, AlsaStreamAudioT captureCard = loop->sndcard; AFB_ApiInfo(mixer->api, - "%s: found loopdev %d,%d\n", + "%s: found loopdev %d,%d", __func__, loop->capture, loopDev->index); } else { // if capture UID is not present in loop search on sources - AFB_ApiInfo(mixer->api,"%s: %s not found in loop, look in sources\n", __func__, uid); + AFB_ApiInfo(mixer->api,"%s: %s not found in loop, look in sources", __func__, uid); AlsaSndCtlT *sourceDev = ApiSourceFindSubdev(mixer, stream->source); if (sourceDev) { @@ -278,7 +278,7 @@ STATIC int CreateOneStream(SoftMixerT *mixer, const char * uid, AlsaStreamAudioT // retrieve channel count from route and push it to stream stream->params->channels = zone->ccount; - + // create mute control and Registry it as pause/resume ctl) if (asprintf(&runName, "pause-%s", stream->uid) == -1) goto OnErrorExit; @@ -346,7 +346,7 @@ STATIC int CreateOneStream(SoftMixerT *mixer, const char * uid, AlsaStreamAudioT playbackName = (char*) streamPcm->cid.cardid; } - AFB_ApiInfo(mixer->api, "%s: Opening PCM PLAYBACK name %s\n", __func__, playbackName); + AFB_ApiInfo(mixer->api, "%s: Opening PCM PLAYBACK name %s", __func__, playbackName); // everything is now ready to open playback pcm in BLOCKING mode this time error = snd_pcm_open(&streamPcm->handle, playbackName, SND_PCM_STREAM_PLAYBACK, 0 /* will block*/ ); @@ -495,16 +495,16 @@ STATIC AlsaStreamAudioT * AttachOneStream(SoftMixerT *mixer, const char *uid, co OnErrorExit: free(stream); - AFB_ApiError(mixer->api, "%s fail\n", __func__); + AFB_ApiError(mixer->api, "%s fail", __func__); return NULL; } PUBLIC int ApiStreamAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, const char *prefix, json_object * argsJ) { - AFB_ApiInfo(mixer->api, "%s: %s prefix %s\n", __func__, uid, prefix); + AFB_ApiInfo(mixer->api, "%s: %s prefix %s", __func__, uid, prefix); if (!mixer->loops) { - AFB_ApiError(mixer->api, "StreamsAttach: mixer=%s No Loop found [should Registry snd_loop first]", mixer->uid); + AFB_ApiError(mixer->api, "%s: mixer=%s No Loop found [should Registry snd_loop first]", __func__, mixer->uid); goto OnErrorExit; } diff --git a/plugins/alsa/alsa-plug-rate.c b/plugins/alsa/alsa-plug-rate.c index daa8cf3..085ad78 100644 --- a/plugins/alsa/alsa-plug-rate.c +++ b/plugins/alsa/alsa-plug-rate.c @@ -72,11 +72,11 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRate(SoftMixerT *mixer, const char* pcmName, AlsaP // Debug config & pcm //AlsaDumpCtlConfig(mixer, "plug-rate", pcmConfig, 1); //AlsaDumpCtlConfig (mixer, "plug-rate", rateConfig, 1); - AFB_ApiNotice(mixer->api, "AlsaCreateRate: %s done\n", pcmPlug->cid.cardid); + AFB_ApiNotice(mixer->api, "AlsaCreateRate: %s done", pcmPlug->cid.cardid); return pcmPlug; OnErrorExit: AlsaDumpCtlConfig(mixer, "plug-rate", rateConfig, 1); - AFB_ApiNotice(mixer->api, "AlsaCreateRate: OnErrorExit\n"); + AFB_ApiNotice(mixer->api, "AlsaCreateRate: OnErrorExit"); return NULL; -} \ No newline at end of file +} diff --git a/plugins/alsa/alsa-plug-vol.c b/plugins/alsa/alsa-plug-vol.c index 310a8b8..ce4627a 100644 --- a/plugins/alsa/alsa-plug-vol.c +++ b/plugins/alsa/alsa-plug-vol.c @@ -27,7 +27,7 @@ PUBLIC AlsaPcmCtlT *AlsaCreateSoftvol(SoftMixerT *mixer, AlsaStreamAudioT *strea AlsaPcmCtlT *pcmVol= calloc(1,sizeof(AlsaPcmCtlT)); int error = 0; - AFB_ApiInfo(mixer->api, "%s create SOFTVOL on %s\n", __func__, slaveid); + AFB_ApiInfo(mixer->api, "%s create SOFTVOL on %s", __func__, slaveid); char *cardid = NULL; if (asprintf(&cardid, "softvol-%s", stream->uid) == -1) @@ -49,6 +49,7 @@ PUBLIC AlsaPcmCtlT *AlsaCreateSoftvol(SoftMixerT *mixer, AlsaStreamAudioT *strea error += snd_config_make_compound(&slaveConfig, "slave", 0); error += snd_config_imake_string(&elemConfig, "pcm", slaveid); error += snd_config_add(slaveConfig, elemConfig); + error += snd_config_add(streamConfig, slaveConfig); if (error) goto OnErrorExit; diff --git a/plugins/alsa/alsa-softmixer.c b/plugins/alsa/alsa-softmixer.c index 11d611d..27dba3c 100644 --- a/plugins/alsa/alsa-softmixer.c +++ b/plugins/alsa/alsa-softmixer.c @@ -26,7 +26,7 @@ CTLP_LUA_REGISTER("alsa-softmixer") // Call at initialisation time CTLP_ONLOAD(plugin, callbacks) { - AFB_ApiDebug(plugin->api, "SoftMixer Plugin Registryed: uid='%s' 'info='%s'", plugin->uid, plugin->info); + AFB_ApiDebug(plugin->api, "SoftMixer Plugin Registered: uid='%s' 'info='%s'", plugin->uid, plugin->info); return 0; } diff --git a/plugins/alsa/alsa-utils-bypath.c b/plugins/alsa/alsa-utils-bypath.c index e5a6ced..71810c2 100644 --- a/plugins/alsa/alsa-utils-bypath.c +++ b/plugins/alsa/alsa-utils-bypath.c @@ -88,7 +88,7 @@ PUBLIC AlsaPcmCtlT *AlsaByPathOpenPcm(SoftMixerT *mixer, AlsaDevInfoT *pcmDev, s pcmCtl->cid.longname=NULL; AFB_ApiInfo(mixer->api, - "%s OPEN PCM %s, direction %s\n", + "%s OPEN PCM %s, direction %s", __func__, pcmCtl->cid.cardid, direction==SND_PCM_STREAM_PLAYBACK?"playback":"capture"); error = snd_pcm_open(&pcmCtl->handle, pcmCtl->cid.cardid, direction, SND_PCM_NONBLOCK); diff --git a/plugins/alsa/alsa-utils-dump.c b/plugins/alsa/alsa-utils-dump.c index 953f005..28ed83a 100644 --- a/plugins/alsa/alsa-utils-dump.c +++ b/plugins/alsa/alsa-utils-dump.c @@ -80,7 +80,7 @@ PUBLIC void AlsaDumpFormats(SoftMixerT *mixer, snd_pcm_t *pcm) { snd_pcm_hw_params_alloca(&pxmHwParams); ret = snd_pcm_hw_params_any(pcm, pxmHwParams); if (ret < 0) { - AFB_ApiError(mixer->api, "FAILED to read params of PCM %s\n", snd_pcm_name(pcm)); + AFB_ApiError(mixer->api, "FAILED to read params of PCM %s", snd_pcm_name(pcm)); } AFB_ApiNotice(mixer->api, "Available formats: PCM=%s", ALSA_PCM_UID(pcm, string)); @@ -153,7 +153,7 @@ PUBLIC void AlsaDumpPcmParams(SoftMixerT *mixer, snd_pcm_hw_params_t *pcmHwParam snd_output_buffer_open(&output); snd_pcm_hw_params_dump(pcmHwParams, output); snd_output_buffer_string(output, &buffer); - AFB_ApiNotice(mixer->api, "AlsaPCMDump: %s", buffer); + AFB_ApiNotice(mixer->api, "%s:\n%s",__func__, buffer); snd_output_close(output); } @@ -164,11 +164,11 @@ PUBLIC void AlsaDumpPcmInfo(SoftMixerT *mixer, const char* info, snd_pcm_t *pcm) // create an output buffer an dump PCM config snd_output_buffer_open(&out); snd_output_printf(out, "%s", info); - snd_output_printf(out, ": "); + snd_output_printf(out, ":\n"); snd_pcm_dump(pcm, out); snd_output_buffer_string(out, &buffer); - AFB_ApiNotice(mixer->api, "AlsaPCMDump: %s", buffer); + AFB_ApiNotice(mixer->api, "%s:\n%s", __func__, buffer); snd_output_close(out); } -- cgit 1.2.3-korg