Fix comments from review.
This commit is contained in:
parent
640ad3930f
commit
b7e59c9cef
@ -36,7 +36,7 @@ class AutoAudioMixer(gst.Element):
|
|||||||
factories.sort(key: lambda f: (-f.get_rank(), f.get_name())
|
factories.sort(key: lambda f: (-f.get_rank(), f.get_name())
|
||||||
|
|
||||||
for factory in factories:
|
for factory in factories:
|
||||||
# Avoid sink/srcs that implment mixing.
|
# Avoid sink/srcs that implment mixing.
|
||||||
if factory.get_klass() != 'Generic/Audio':
|
if factory.get_klass() != 'Generic/Audio':
|
||||||
continue
|
continue
|
||||||
# Avoid anything that doesn't implment mixing.
|
# Avoid anything that doesn't implment mixing.
|
||||||
@ -353,6 +353,10 @@ class GStreamer(ThreadingActor):
|
|||||||
"""
|
"""
|
||||||
Get volume level of the installed mixer.
|
Get volume level of the installed mixer.
|
||||||
|
|
||||||
|
0 == muted.
|
||||||
|
100 == max volume for given system.
|
||||||
|
-1 == no mixer present, i.e. volume unknown.
|
||||||
|
|
||||||
:rtype: int in range [-1..100]
|
:rtype: int in range [-1..100]
|
||||||
"""
|
"""
|
||||||
if self._mixer is None:
|
if self._mixer is None:
|
||||||
@ -364,8 +368,7 @@ class GStreamer(ThreadingActor):
|
|||||||
volumes = mixer.get_volume(track)
|
volumes = mixer.get_volume(track)
|
||||||
avg_volume = sum(volumes) / len(volumes)
|
avg_volume = sum(volumes) / len(volumes)
|
||||||
return utils.rescale(avg_volume,
|
return utils.rescale(avg_volume,
|
||||||
old=(track.min_volume, track.max_volume),
|
old=(track.min_volume, track.max_volume), new=(0, 100))
|
||||||
new=(0, 100))
|
|
||||||
|
|
||||||
def set_volume(self, volume):
|
def set_volume(self, volume):
|
||||||
"""
|
"""
|
||||||
@ -380,11 +383,12 @@ class GStreamer(ThreadingActor):
|
|||||||
|
|
||||||
mixer, track = self._mixer
|
mixer, track = self._mixer
|
||||||
|
|
||||||
volume = utils.rescale(volume, old=(0, 100),
|
volume = utils.rescale(volume,
|
||||||
new=(track.min_volume, track.max_volume))
|
old=(0, 100), new=(track.min_volume, track.max_volume))
|
||||||
volumes = (volume,) * track.num_channels
|
|
||||||
|
|
||||||
|
volumes = (volume,) * track.num_channels
|
||||||
mixer.set_volume(track, volumes)
|
mixer.set_volume(track, volumes)
|
||||||
|
|
||||||
return mixer.get_volume(track) == volumes
|
return mixer.get_volume(track) == volumes
|
||||||
|
|
||||||
def set_metadata(self, track):
|
def set_metadata(self, track):
|
||||||
|
|||||||
@ -108,7 +108,7 @@ LOCAL_TAG_CACHE_FILE = None
|
|||||||
#: Expects a GStreamer mixer to use, typical values are:
|
#: Expects a GStreamer mixer to use, typical values are:
|
||||||
#: alsamixer, pulsemixer, oss4mixer, ossmixer.
|
#: alsamixer, pulsemixer, oss4mixer, ossmixer.
|
||||||
#:
|
#:
|
||||||
#: Setting this to ``None`` means no volume controll.
|
#: Setting this to ``None`` means no volume control.
|
||||||
#:
|
#:
|
||||||
#: Default::
|
#: Default::
|
||||||
#:
|
#:
|
||||||
@ -118,7 +118,8 @@ MIXER = u'autoaudiomixer'
|
|||||||
#: Sound mixer track to use.
|
#: Sound mixer track to use.
|
||||||
#:
|
#:
|
||||||
#: Name of the mixer track to use. If this is not set we will try to find the
|
#: Name of the mixer track to use. If this is not set we will try to find the
|
||||||
#: output track with master set.
|
#: output track with master set. As an example, using ``alsamixer`` you would
|
||||||
|
#: typically set this to ``Master`` or ``PCM``.
|
||||||
#:
|
#:
|
||||||
#: Default::
|
#: Default::
|
||||||
#:
|
#:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user