summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorThierry Bultel <thierry.bultel@iot.bzh>2019-02-13 14:40:03 +0100
committerThierry Bultel <thierry.bultel@iot.bzh>2019-02-18 16:55:49 +0100
commit419c8f390869ff2bede1ef76b8a19f3a4c1c13b7 (patch)
tree45e09498d5ee02ac8088f79b5851544fd3cbfeeb /plugins
parenta9408d36c6ac72bc0f04822795a72c7beb21c0f3 (diff)
plug route: added a calculation for the number of physical channels
Adds (mainly for debug purpose) a calculation on the actual number of physical channels that are used by the created ttable Change-Id: I5717046003851ebe297a494dcdd97c4d67e34d0b Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/alsa/alsa-plug-route.c21
-rw-r--r--plugins/alsa/alsa-softmixer.h1
2 files changed, 17 insertions, 5 deletions
diff --git a/plugins/alsa/alsa-plug-route.c b/plugins/alsa/alsa-plug-route.c
index 72dee68..ce17b86 100644
--- a/plugins/alsa/alsa-plug-route.c
+++ b/plugins/alsa/alsa-plug-route.c
@@ -167,11 +167,15 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRoute(SoftMixerT *mixer, AlsaSndZoneT *zone, int o
snd_config_t **cports = alloca(zone->nbSinks * sizeof (void*));
memset(cports, 0, zone->nbSinks * sizeof (void*));
- int zcount = 0;
+ int portCount = 0;
// We create 1st ttable to retrieve sndcard slave and channel count
(void)snd_config_make_compound(&tableConfig, "ttable", 0);
+ // used physical ports
+ bool targets[16];
+ memset(targets, 0, sizeof(targets));
+
cds_list_for_each_entry(channel, &zone->sinks.list, list) {
AFB_API_DEBUG(mixer->api, "%s: zone->sink channel %s ", __func__, channel->uid);
@@ -192,12 +196,17 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRoute(SoftMixerT *mixer, AlsaSndZoneT *zone, int o
int target = channelCardPort.port;
int port = channel->port;
+ if (!targets[target]) {
+ zone->physicalChannelCount++;
+ targets[target] = true;
+ }
+
double volume = 1.0; // currently only support 100%
// if channel entry does not exist into ttable create it now
if (!cports[port]) {
- char channelS[4]; // 999 channel should be more than enough
+ char channelS[4]; // 999 channels should be more than enough
snprintf(channelS, sizeof (channelS), "%d", port);
error = snd_config_make_compound(&cports[port], channelS, 0);
@@ -213,7 +222,7 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRoute(SoftMixerT *mixer, AlsaSndZoneT *zone, int o
}
}
- zcount++;
+ portCount++;
// ttable require target port as a table and volume as a value
char targetS[4];
@@ -239,8 +248,10 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRoute(SoftMixerT *mixer, AlsaSndZoneT *zone, int o
}
// update zone with route channel count and sndcard params
- pcmRoute->ccount = zcount;
- zone->ccount=zcount;
+ pcmRoute->ccount = portCount;
+ zone->ccount=portCount;
+
+ AFB_API_DEBUG(mixer->api, "%s: ZONE has %d ports and %d hardware channels", __func__, zone->ccount, zone->physicalChannelCount);
// refresh global alsalib config and create PCM top config
snd_config_update();
diff --git a/plugins/alsa/alsa-softmixer.h b/plugins/alsa/alsa-softmixer.h
index 384d1b0..c72f3a8 100644
--- a/plugins/alsa/alsa-softmixer.h
+++ b/plugins/alsa/alsa-softmixer.h
@@ -228,6 +228,7 @@ typedef struct {
unsigned int nbSinks;
AlsaPcmChannelT sinks;
int ccount;
+ int physicalChannelCount;
AlsaPcmHwInfoT *params;
struct cds_list_head list;