Skip to content

Commit 3b9ab34

Browse files
Remove debug flag, remove manual vol delta stuff
1 parent fff4f0b commit 3b9ab34

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

amplipi/streams/airplay.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def _activate(self, vsrc: int):
130130
self.mpris = MPRIS(mpris_name, f'{src_config_folder}/metadata.txt')
131131

132132
vol_sync = f"{utils.get_folder('streams')}/shairport_volume_handler.py"
133-
vol_args = [sys.executable, vol_sync, mpris_name, str(self.id), "--debug"]
133+
vol_args = [sys.executable, vol_sync, mpris_name, str(self.id)]
134134
logger.info(f'{self.name}: starting vol synchronizer: {vol_args}')
135135
self.volume_process = subprocess.Popen(args=vol_args, stdout=self._log_file, stderr=self._log_file)
136136
except Exception as exc:

streams/shairport_volume_handler.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,27 @@ def __init__(self, service_suffix: str):
2525
interface_name="org.mpris.MediaPlayer2.Player"
2626
)
2727
super().__init__()
28-
self.delta = 0.0
2928

3029
async def watch_vol(self):
3130
"""Watch the shairport mpris stream for volume changes and update amplipi volume info accordingly"""
3231
while True:
3332
try:
3433
if self.volume is not None and self.volume != self.mpris.Volume:
3534
self.logger.debug(f"Airplay volume changed from {self.volume} to {self.mpris.Volume}")
36-
self.delta += self.mpris.Volume - self.volume
3735
self.callback("stream_volume_changed")
3836
self.volume = float(self.mpris.Volume)
3937

4038
except Exception as e:
4139
self.logger.exception(f"Error: {e}")
4240
return
43-
sleep(1)
41+
sleep(0.1)
4442

4543
def set_vol(self, amplipi_volume: float, vol_set_point: float) -> float: # This has unused variable vol_set_point to keep up with the underlying StreamData.set_vol function schema
4644
"""Update Airplay's volume slider to match AmpliPi"""
4745
try:
4846
# Airplay does not allow external devices to set the volume of a users system
4947

50-
# Airplay no longer relies on the set point vol, but if we ever get rid of the self.delta path of the stream_volume_changed event this will be relevant again:
48+
# Airplay is a fully authoritative volume source, meaning it forces amplipi volume to equal its volume now. If that ever changes, this will be relevant:
5149
# There are two values this could realistically be returned and become the new vol_set_point, and they each have their own drawbacks:
5250

5351
# amplipi_volume: If amplipi_volume is the new set point, any changes to airplay volume will send the volume to an odd

0 commit comments

Comments
 (0)