[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.15-102-g905c800
Lennart Poettering
gitmailer-noreply at 0pointer.de
Wed May 13 06:21:16 PDT 2009
This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.
The master branch has been updated
from 28069ef0f74089ae18cefbe7e97d2b920d7ba0cc (commit)
- Log -----------------------------------------------------------------
905c800 volume: introduce pa_cvolume_{get|set}_position()
-----------------------------------------------------------------------
Summary of changes:
src/pulse/volume.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
src/pulse/volume.h | 13 +++++++++++++
2 files changed, 59 insertions(+), 0 deletions(-)
-----------------------------------------------------------------------
commit 905c8004a0b77ad4303f64b1dc8b1b29e3795a63
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed May 13 15:20:45 2009 +0200
volume: introduce pa_cvolume_{get|set}_position()
diff --git a/src/pulse/volume.c b/src/pulse/volume.c
index 6848771..a9622e7 100644
--- a/src/pulse/volume.c
+++ b/src/pulse/volume.c
@@ -685,3 +685,49 @@ pa_cvolume* pa_cvolume_set_fade(pa_cvolume *v, const pa_channel_map *map, float
return v;
}
+
+pa_cvolume* pa_cvolume_set_position(
+ pa_cvolume *cv,
+ const pa_channel_map *map,
+ pa_channel_position_t t,
+ pa_volume_t v) {
+
+ unsigned c;
+ pa_bool_t good = FALSE;
+
+ pa_assert(cv);
+ pa_assert(map);
+
+ pa_return_val_if_fail(pa_cvolume_compatible_with_channel_map(cv, map), NULL);
+ pa_return_val_if_fail(t < PA_CHANNEL_POSITION_MAX, NULL);
+
+ for (c = 0; c < map->channels; c++)
+ if (map->map[c] == t) {
+ cv->values[c] = v;
+ good = TRUE;
+ }
+
+ return good ? cv : NULL;
+}
+
+pa_volume_t pa_cvolume_get_position(
+ pa_cvolume *cv,
+ const pa_channel_map *map,
+ pa_channel_position_t t) {
+
+ unsigned c;
+ pa_volume_t v = PA_VOLUME_MUTED;
+
+ pa_assert(cv);
+ pa_assert(map);
+
+ pa_return_val_if_fail(pa_cvolume_compatible_with_channel_map(cv, map), PA_VOLUME_MUTED);
+ pa_return_val_if_fail(t < PA_CHANNEL_POSITION_MAX, PA_VOLUME_MUTED);
+
+ for (c = 0; c < map->channels; c++)
+ if (map->map[c] == t)
+ if (cv->values[c] > v)
+ v = cv->values[c];
+
+ return v;
+}
diff --git a/src/pulse/volume.h b/src/pulse/volume.h
index 5b7e121..ddedca7 100644
--- a/src/pulse/volume.h
+++ b/src/pulse/volume.h
@@ -283,6 +283,19 @@ pa_cvolume* pa_cvolume_set_fade(pa_cvolume *v, const pa_channel_map *map, float
* volumes are kept. \since 0.9.15 */
pa_cvolume* pa_cvolume_scale(pa_cvolume *v, pa_volume_t max);
+/** Set the passed volume to all channels at the specified channel
+ * position. Will return the updated volume struct, or NULL if there
+ * is no channel at the position specified. You can check if a channel
+ * map includes a specific position by calling
+ * pa_channel_map_has_position(). \since 0.9.16 */
+pa_cvolume* pa_cvolume_set_position(pa_cvolume *cv, const pa_channel_map *map, pa_channel_position_t t, pa_volume_t v);
+
+/** Get the maximum volume of all channels at the specified channel
+ * position. Will return 0 if there is no channel at the position
+ * specified. You can check if a channel map includes a specific
+ * position by calling pa_channel_map_has_position(). \since 0.9.16 */
+pa_volume_t pa_cvolume_get_position(pa_cvolume *cv, const pa_channel_map *map, pa_channel_position_t t);
+
PA_C_DECL_END
#endif
--
hooks/post-receive
PulseAudio Sound Server
More information about the pulseaudio-commits
mailing list