summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/source.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pulsecore/source.c')
-rw-r--r--src/pulsecore/source.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 95007af4..7ed32e92 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -260,7 +260,7 @@ static int source_set_state(pa_source *s, pa_source_state_t state) {
for (o = PA_SOURCE_OUTPUT(pa_idxset_first(s->outputs, &idx)); o; o = PA_SOURCE_OUTPUT(pa_idxset_next(s->outputs, &idx)))
if (o->suspend)
- o->suspend(o, state == PA_SINK_SUSPENDED);
+ o->suspend(o, state == PA_SOURCE_SUSPENDED);
}
if (state != PA_SOURCE_UNLINKED) /* if we enter UNLINKED state pa_source_unlink() will fire the apropriate events */
@@ -273,7 +273,7 @@ static int source_set_state(pa_source *s, pa_source_state_t state) {
void pa_source_put(pa_source *s) {
pa_source_assert_ref(s);
- pa_assert(s->state == PA_SINK_INIT);
+ pa_assert(s->state == PA_SOURCE_INIT);
/* The following fields must be initialized properly when calling _put() */
pa_assert(s->asyncmsgq);
@@ -520,18 +520,29 @@ void pa_source_set_volume(pa_source *s, const pa_cvolume *volume) {
s->set_volume = NULL;
if (!s->set_volume)
- pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SOURCE_MESSAGE_SET_VOLUME, volume, 0, NULL);
+ pa_source_set_soft_volume(s, volume);
if (changed)
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
}
/* Called from main thread */
-const pa_cvolume *pa_source_get_volume(pa_source *s) {
+void pa_source_set_soft_volume(pa_source *s, const pa_cvolume *volume) {
+ pa_source_assert_ref(s);
+ pa_assert(volume);
+
+ if (PA_SOURCE_IS_LINKED(s->state))
+ pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SOURCE_MESSAGE_SET_VOLUME, volume, 0, NULL);
+ else
+ s->thread_info.soft_volume = *volume;
+}
+
+/* Called from main thread */
+const pa_cvolume *pa_source_get_volume(pa_source *s, pa_bool_t force_refresh) {
pa_source_assert_ref(s);
pa_assert(PA_SOURCE_IS_LINKED(s->state));
- if (s->refresh_volume) {
+ if (s->refresh_volume || force_refresh) {
pa_cvolume old_volume = s->volume;
if (s->get_volume && s->get_volume(s) < 0)
@@ -568,12 +579,12 @@ void pa_source_set_mute(pa_source *s, pa_bool_t mute) {
}
/* Called from main thread */
-pa_bool_t pa_source_get_mute(pa_source *s) {
+pa_bool_t pa_source_get_mute(pa_source *s, pa_bool_t force_refresh) {
pa_source_assert_ref(s);
pa_assert(PA_SOURCE_IS_LINKED(s->state));
- if (s->refresh_muted) {
+ if (s->refresh_muted || force_refresh) {
pa_bool_t old_muted = s->muted;
if (s->get_mute && s->get_mute(s) < 0)
@@ -932,7 +943,7 @@ void pa_source_set_latency_range(pa_source *s, pa_usec_t min_latency, pa_usec_t
pa_assert(!min_latency || !max_latency ||
min_latency <= max_latency);
- if (PA_SINK_IS_LINKED(s->state)) {
+ if (PA_SOURCE_IS_LINKED(s->state)) {
pa_usec_t r[2];
r[0] = min_latency;