]> code.delx.au - pulseaudio/commitdiff
add new API pa_cvolume_compatible_with_channel_map()
authorLennart Poettering <lennart@poettering.net>
Tue, 3 Feb 2009 20:15:32 +0000 (21:15 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 3 Feb 2009 20:15:32 +0000 (21:15 +0100)
src/map-file
src/pulse/volume.c
src/pulse/volume.h

index 3aa1d7a8994566697d8246dccd299d25e3630454..d7addfecd2035d8e4a6ddbece259799206765c78 100644 (file)
@@ -109,6 +109,7 @@ pa_context_unref;
 pa_cvolume_avg;
 pa_cvolume_channels_equal_to;
 pa_cvolume_compatible;
+pa_cvolume_compatible_with_channel_map;
 pa_cvolume_equal;
 pa_cvolume_get_balance;
 pa_cvolume_get_fade;
index 01a28e83ac55dd8209e8689f3cf7eba02ed8d056..e920288cac83b26febe8a31324d728aceccc71c6 100644 (file)
@@ -428,6 +428,19 @@ int pa_cvolume_compatible(const pa_cvolume *v, const pa_sample_spec *ss) {
     return v->channels == ss->channels;
 }
 
+int pa_cvolume_compatible_with_channel_map(const pa_cvolume *v, const pa_channel_map *cm) {
+    pa_assert(v);
+    pa_assert(cm);
+
+    if (!pa_cvolume_valid(v))
+        return 0;
+
+    if (!pa_channel_map_valid(cm))
+        return 0;
+
+    return v->channels == cm->channels;
+}
+
 static void get_avg_lr(const pa_channel_map *map, const pa_cvolume *v, pa_volume_t *l, pa_volume_t *r) {
     int c;
     pa_volume_t left = 0, right = 0;
index 9ad3e9bf58ba56356bdcfe7b08048b90d02852a2..8bfd0687ca74d0da0b7f35da5eedabb9ecb5ebfe 100644 (file)
@@ -230,10 +230,14 @@ double pa_sw_volume_to_linear(pa_volume_t v) PA_GCC_CONST;
 /** Remap a volume from one channel mapping to a different channel mapping. \since 0.9.12 */
 pa_cvolume *pa_cvolume_remap(pa_cvolume *v, const pa_channel_map *from, const pa_channel_map *to);
 
-/** Return non-zero if the specified volume is compatible with
- * the specified sample spec. \since 0.9.13 */
+/** Return non-zero if the specified volume is compatible with the
+ * specified sample spec. \since 0.9.13 */
 int pa_cvolume_compatible(const pa_cvolume *v, const pa_sample_spec *ss) PA_GCC_PURE;
 
+/** Return non-zero if the specified volume is compatible with the
+ * specified sample spec. \since 0.9.15 */
+int pa_cvolume_compatible_with_channel_map(const pa_cvolume *v, const pa_channel_map *cm) PA_GCC_PURE;
+
 /** Calculate a 'balance' value for the specified volume with the
  * specified channel map. The return value will range from -1.0f
  * (left) to +1.0f (right). If no balance value is applicable to this