swmixer: Listen for volume/mute changes in GStreamer
E.g. when using pulsesink, external changes to the application-volume and appliction-mute state will now immediately be reflected in the SoftwareMixer.
This commit is contained in:
parent
2c4ba8b6a1
commit
16f6527095
@ -187,10 +187,17 @@ class Audio(pykka.ThreadingActor):
|
||||
if self._config['audio']['mixer'] != 'software':
|
||||
return
|
||||
self._mixer.audio = self.actor_ref.proxy()
|
||||
self._connect(self._playbin, 'notify::volume', self._on_mixer_change)
|
||||
self._connect(self._playbin, 'notify::mute', self._on_mixer_change)
|
||||
|
||||
def _on_mixer_change(self, element, gparamspec):
|
||||
self._mixer.trigger_events_for_any_changes()
|
||||
|
||||
def _teardown_mixer(self):
|
||||
if self._config['audio']['mixer'] != 'software':
|
||||
return
|
||||
self._disconnect(self._playbin, 'notify::volume')
|
||||
self._disconnect(self._playbin, 'notify::mute')
|
||||
self._mixer.audio = None
|
||||
|
||||
def _setup_visualizer(self):
|
||||
|
||||
@ -15,7 +15,7 @@ class SoftwareMixer(pykka.ThreadingActor, mixer.Mixer):
|
||||
name = 'software'
|
||||
|
||||
def __init__(self, config):
|
||||
super(SoftwareMixer, self).__init__()
|
||||
super(SoftwareMixer, self).__init__(config)
|
||||
|
||||
self.audio = None
|
||||
|
||||
@ -30,7 +30,6 @@ class SoftwareMixer(pykka.ThreadingActor, mixer.Mixer):
|
||||
if self.audio is None:
|
||||
return False
|
||||
self.audio.set_volume(volume)
|
||||
self.trigger_volume_changed(volume)
|
||||
return True
|
||||
|
||||
def get_mute(self):
|
||||
@ -42,5 +41,4 @@ class SoftwareMixer(pykka.ThreadingActor, mixer.Mixer):
|
||||
if self.audio is None:
|
||||
return False
|
||||
self.audio.set_mute(muted)
|
||||
self.trigger_mute_changed(muted)
|
||||
return True
|
||||
|
||||
Loading…
Reference in New Issue
Block a user