Skip to content

Commit

Permalink
audio: Update mixer track selection logic (fixes #307)
Browse files Browse the repository at this point in the history
We now ensure that the track we choose has one or more volume channels we can
control. This change also fixes that fact the MIXER_TRACK setting would not
work if we happened to find a track that was flaged as MASTER OUPUT before
finding the right label, so far no one has reported this as an issue.
  • Loading branch information
adamcik committed Jan 3, 2013
1 parent e07a6e1 commit ea5bb18
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions mopidy/audio/actor.py
Expand Up @@ -173,15 +173,23 @@ def _setup_mixer(self):
mixer.get_factory().get_name(), track.label)

def _select_mixer_track(self, mixer, track_label):
# Look for track with label == MIXER_TRACK, otherwise fallback to
# master track which is also an output.
# Ignore tracks without volumes, then look for track with
# label == settings.MIXER_TRACK, otherwise fallback to first usable
# track hoping the mixer gave them to us in a sensible order.

usable_tracks = []
for track in mixer.list_tracks():
if track_label:
if track.label == track_label:
return track
if not mixer.get_volume(track):
continue

if track_label and track.label == track_label:
return track
elif track.flags & (gst.interfaces.MIXER_TRACK_MASTER |
gst.interfaces.MIXER_TRACK_OUTPUT):
return track
usable_tracks.append(track)

if usable_tracks:
return usable_tracks[0]

def _teardown_mixer(self):
if self._mixer is not None:
Expand Down

1 comment on commit ea5bb18

@jodal
Copy link
Member

@jodal jodal commented on ea5bb18 Jan 3, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update the changelog?

Please sign in to comment.