From e853da4bd1cb44b6a992aff96a4066ae5bd54720 Mon Sep 17 00:00:00 2001 From: Manuel Bachmann Date: Mon, 21 Dec 2015 13:37:24 +0100 Subject: Fix Radio and Audio plugin symbols radio-api/audio-api.so were not valid, because they were not linked correctly with librtlsdr/ALSA. Signed-off-by: Manuel Bachmann --- plugins/audio/CMakeLists.txt | 4 ++-- plugins/radio/CMakeLists.txt | 4 ++-- plugins/samples/CMakeLists.txt | 2 ++ plugins/session/CMakeLists.txt | 3 ++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/audio/CMakeLists.txt b/plugins/audio/CMakeLists.txt index b5adc643..7fa1f75f 100644 --- a/plugins/audio/CMakeLists.txt +++ b/plugins/audio/CMakeLists.txt @@ -1,9 +1,9 @@ IF(alsa_FOUND) - INCLUDE_DIRECTORIES(${include_dirs}) - ADD_LIBRARY(audio-api MODULE audio-api.c audio-alsa.c) SET_TARGET_PROPERTIES(audio-api PROPERTIES PREFIX "") + TARGET_LINK_LIBRARIES(audio-api ${link_libraries}) + INCLUDE_DIRECTORIES(${include_dirs}) INSTALL(TARGETS audio-api LIBRARY DESTINATION ${plugin_install_dir}) diff --git a/plugins/radio/CMakeLists.txt b/plugins/radio/CMakeLists.txt index c7c85411..04d0fa21 100644 --- a/plugins/radio/CMakeLists.txt +++ b/plugins/radio/CMakeLists.txt @@ -1,9 +1,9 @@ IF(librtlsdr_FOUND) - INCLUDE_DIRECTORIES(${include_dirs}) - ADD_LIBRARY(radio-api MODULE radio-api.c radio-rtlsdr.c) SET_TARGET_PROPERTIES(radio-api PROPERTIES PREFIX "") + TARGET_LINK_LIBRARIES(radio-api ${link_libraries}) + INCLUDE_DIRECTORIES(${include_dirs}) INSTALL(TARGETS radio-api LIBRARY DESTINATION ${plugin_install_dir}) diff --git a/plugins/samples/CMakeLists.txt b/plugins/samples/CMakeLists.txt index ef5b449e..aa22cd24 100644 --- a/plugins/samples/CMakeLists.txt +++ b/plugins/samples/CMakeLists.txt @@ -2,10 +2,12 @@ INCLUDE_DIRECTORIES(${include_dirs}) ADD_LIBRARY(helloWorld-api MODULE HelloWorld.c) SET_TARGET_PROPERTIES(helloWorld-api PROPERTIES PREFIX "") +TARGET_LINK_LIBRARIES(helloWorld-api ${link_libraries}) INSTALL(TARGETS helloWorld-api LIBRARY DESTINATION ${plugin_install_dir}) ADD_LIBRARY(samplePost-api MODULE SamplePost.c) SET_TARGET_PROPERTIES(samplePost-api PROPERTIES PREFIX "") +TARGET_LINK_LIBRARIES(samplePost-api ${link_libraries}) INSTALL(TARGETS samplePost-api LIBRARY DESTINATION ${plugin_install_dir}) diff --git a/plugins/session/CMakeLists.txt b/plugins/session/CMakeLists.txt index ddd185df..ab0596e6 100644 --- a/plugins/session/CMakeLists.txt +++ b/plugins/session/CMakeLists.txt @@ -1,6 +1,7 @@ -INCLUDE_DIRECTORIES(${include_dirs}) ADD_LIBRARY(token-api MODULE token-api.c) SET_TARGET_PROPERTIES(token-api PROPERTIES PREFIX "") +TARGET_LINK_LIBRARIES(token-api ${link_libraries}) +INCLUDE_DIRECTORIES(${include_dirs}) INSTALL(TARGETS token-api LIBRARY DESTINATION ${plugin_install_dir}) -- cgit 1.2.3-korg From 5bad34ac9278831eb65499c8aa887116aafa33b2 Mon Sep 17 00:00:00 2001 From: Manuel Bachmann Date: Mon, 21 Dec 2015 14:11:16 +0100 Subject: Fix Audio API on Renesas Porter/Koelsch boards Porter/Koelsch do not expose a standard "Master" playback mixer on their default interface, as it is common with desktop audio cards. Add a bit of discovery logic for this. Signed-off-by: Manuel Bachmann --- plugins/audio/audio-alsa.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugins/audio/audio-alsa.c b/plugins/audio/audio-alsa.c index 4ee48045..8e56e52d 100644 --- a/plugins/audio/audio-alsa.c +++ b/plugins/audio/audio-alsa.c @@ -58,6 +58,19 @@ PUBLIC unsigned char _alsa_init (const char *name, audioCtxHandleT *ctx) { snd_mixer_selem_id_set_name (mixer_sid, "Master"); mixer_elm = snd_mixer_find_selem (mixer, mixer_sid); + if (!mixer_elm) { + /* no "Master" mixer ; we are probably on a board... search ! */ + for (mixer_elm = snd_mixer_first_elem (mixer); mixer_elm != NULL; + mixer_elm = snd_mixer_elem_next (mixer_elm)) { + if (snd_mixer_elem_info (mixer_elm) < 0) + continue; + snd_mixer_selem_get_id (mixer_elm, mixer_sid); + if (strstr (snd_mixer_selem_id_get_name (mixer_sid), "Master") || + strstr (snd_mixer_selem_id_get_name (mixer_sid), "Playback")) + break; + } + } + if (mixer_elm) { snd_mixer_selem_get_playback_volume_range (mixer_elm, &vol_min, &vol_max); snd_mixer_selem_get_playback_volume (mixer_elm, SND_MIXER_SCHN_FRONT_LEFT, &vol); -- cgit 1.2.3-korg