diff options
author | Lennart Poettering <lennart@poettering.net> | 2008-10-03 17:16:55 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2008-10-03 17:16:55 +0200 |
commit | be77bcd9ad7e51e51cb3c84d2aed9bd13ddd0a27 (patch) | |
tree | e8a71f8b4b95e1ae397b45c3d7170f6cf53e79c2 /src | |
parent | db975c7127c15a527ef6277a695eba2870613637 (diff) | |
download | pulseaudio-be77bcd9ad7e51e51cb3c84d2aed9bd13ddd0a27.tar.gz |
add new API call pa_cvolume_init()
Diffstat (limited to 'src')
-rw-r--r-- | src/pulse/volume.c | 15 | ||||
-rw-r--r-- | src/pulse/volume.h | 5 |
2 files changed, 19 insertions, 1 deletions
diff --git a/src/pulse/volume.c b/src/pulse/volume.c index 60a86bebc..7c0522e9d 100644 --- a/src/pulse/volume.c +++ b/src/pulse/volume.c @@ -47,6 +47,19 @@ int pa_cvolume_equal(const pa_cvolume *a, const pa_cvolume *b) { return 1; } +pa_cvolume* pa_cvolume_init(pa_cvolume *a) { + unsigned c; + + pa_assert(a); + + a->channels = 0; + + for (c = 0; c < PA_CHANNELS_MAX; c++) + a->values[c] = (pa_volume_t) -1; + + return a; +} + pa_cvolume* pa_cvolume_set(pa_cvolume *a, unsigned channels, pa_volume_t v) { int i; @@ -88,7 +101,7 @@ pa_volume_t pa_cvolume_max(const pa_cvolume *a) { } pa_volume_t pa_sw_volume_multiply(pa_volume_t a, pa_volume_t b) { - return pa_sw_volume_from_linear(pa_sw_volume_to_linear(a)* pa_sw_volume_to_linear(b)); + return pa_sw_volume_from_linear(pa_sw_volume_to_linear(a) * pa_sw_volume_to_linear(b)); } #define USER_DECIBEL_RANGE 60 diff --git a/src/pulse/volume.h b/src/pulse/volume.h index d612c7f91..4b2f3a76b 100644 --- a/src/pulse/volume.h +++ b/src/pulse/volume.h @@ -116,6 +116,11 @@ typedef struct pa_cvolume { /** Return non-zero when *a == *b */ int pa_cvolume_equal(const pa_cvolume *a, const pa_cvolume *b) PA_GCC_PURE; +/** Initialize the specified volume and return a pointer to + * it. The sample spec will have a defined state but + * pa_cvolume_valid() will fail for it. \since 0.9.13 */ +pa_cvolume* pa_cvolume_init(pa_cvolume *a); + /** Set the volume of all channels to PA_VOLUME_NORM */ #define pa_cvolume_reset(a, n) pa_cvolume_set((a), (n), PA_VOLUME_NORM) |