summaryrefslogtreecommitdiffstats
path: root/src/pulse
diff options
context:
space:
mode:
Diffstat (limited to 'src/pulse')
-rw-r--r--src/pulse/channelmap.c57
-rw-r--r--src/pulse/channelmap.h5
2 files changed, 57 insertions, 5 deletions
diff --git a/src/pulse/channelmap.c b/src/pulse/channelmap.c
index 455bda1b..6ff30c26 100644
--- a/src/pulse/channelmap.c
+++ b/src/pulse/channelmap.c
@@ -647,30 +647,77 @@ int pa_channel_map_superset(const pa_channel_map *a, const pa_channel_map *b) {
int pa_channel_map_can_balance(const pa_channel_map *map) {
unsigned c;
+ pa_bool_t left = FALSE, right = FALSE;
pa_assert(map);
- for (c = 0; c < map->channels; c++)
+ for (c = 0; c < map->channels; c++) {
switch (map->map[c]) {
case PA_CHANNEL_POSITION_LEFT:
- case PA_CHANNEL_POSITION_RIGHT:
case PA_CHANNEL_POSITION_REAR_LEFT:
- case PA_CHANNEL_POSITION_REAR_RIGHT:
case PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER:
- case PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER:
case PA_CHANNEL_POSITION_SIDE_LEFT:
+ case PA_CHANNEL_POSITION_TOP_FRONT_LEFT:
+ case PA_CHANNEL_POSITION_TOP_REAR_LEFT:
+ left = TRUE;
+ break;
+
+ case PA_CHANNEL_POSITION_RIGHT:
+ case PA_CHANNEL_POSITION_REAR_RIGHT:
+ case PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER:
case PA_CHANNEL_POSITION_SIDE_RIGHT:
+ case PA_CHANNEL_POSITION_TOP_FRONT_RIGHT:
+ case PA_CHANNEL_POSITION_TOP_REAR_RIGHT:
+ right = TRUE;
+ break;
+
+ default:
+ ;
+ }
+
+ if (left && right)
+ return 1;
+ }
+
+ return 0;
+}
+
+int pa_channel_map_can_fade(const pa_channel_map *map) {
+ unsigned c;
+ pa_bool_t front = FALSE, rear = FALSE;
+
+ for (c = 0; c < map->channels; c++) {
+
+ switch (map->map[c]) {
+ case PA_CHANNEL_POSITION_FRONT_LEFT:
+ case PA_CHANNEL_POSITION_FRONT_RIGHT:
+ case PA_CHANNEL_POSITION_FRONT_CENTER:
+ case PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER:
+ case PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER:
case PA_CHANNEL_POSITION_TOP_FRONT_LEFT:
case PA_CHANNEL_POSITION_TOP_FRONT_RIGHT:
+ case PA_CHANNEL_POSITION_TOP_FRONT_CENTER:
+ front = TRUE;
+ break;
+
+ case PA_CHANNEL_POSITION_REAR_LEFT:
+ case PA_CHANNEL_POSITION_REAR_RIGHT:
+ case PA_CHANNEL_POSITION_REAR_CENTER:
case PA_CHANNEL_POSITION_TOP_REAR_LEFT:
case PA_CHANNEL_POSITION_TOP_REAR_RIGHT:
- return 1;
+ case PA_CHANNEL_POSITION_TOP_REAR_CENTER:
+ rear = TRUE;
+ break;
default:
;
}
+ if (front && rear)
+ return 1;
+ }
+
return 0;
}
diff --git a/src/pulse/channelmap.h b/src/pulse/channelmap.h
index de2d712a..f9124b2e 100644
--- a/src/pulse/channelmap.h
+++ b/src/pulse/channelmap.h
@@ -239,6 +239,11 @@ int pa_channel_map_superset(const pa_channel_map *a, const pa_channel_map *b) PA
* available. \since 0.9.15 */
int pa_channel_map_can_balance(const pa_channel_map *map) PA_GCC_PURE;
+/** Returns non-zero if it makes sense to apply a volume 'fade'
+ * (i.e. 'balance' between front and rear) with this mapping, i.e. if
+ * there are front/rear channels available. \since 0.9.15 */
+int pa_channel_map_can_fade(const pa_channel_map *map) PA_GCC_PURE;
+
/** Tries to find a well-known channel mapping name for this channel
* mapping. I.e. "stereo", "surround-71" and so on. If the channel
* mapping is unknown NULL will be returned. This name can be parsed