Skip to content

Commit

Permalink
Update for review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveMicroNova committed Jan 29, 2025
1 parent f2a8230 commit 85b93ca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions amplipi/ctrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,13 +849,14 @@ def set_vol():
vol, vol_f, vol_min, or vol_max.
"""
# Order of operations: vol (db) > vol_delta > vol (float)
if update.vol_f is not None and update.vol is None:
vol_db = utils.vol_float_to_db(vol_f, zone.vol_min, zone.vol_max)
vol_f_new = vol_f
elif update.vol_delta_f is not None and update.vol is None:
if update.vol_delta_f is not None and update.vol is None:
applied_delta = utils.clamp((vol_delta_f + zone.vol_f), 0, 1)
vol_db = utils.vol_float_to_db(applied_delta, zone.vol_min, zone.vol_max)
vol_f_new = applied_delta
elif update.vol_f is not None and update.vol is None:
clamp_vol_f = utils.clamp(vol_f, 0, 1)
vol_db = utils.vol_float_to_db(clamp_vol_f, zone.vol_min, zone.vol_max)
vol_f_new = clamp_vol_f
else:
vol_db = utils.clamp(vol, zone.vol_min, zone.vol_max)
vol_f_new = utils.vol_db_to_float(vol_db, zone.vol_min, zone.vol_max)
Expand Down
2 changes: 1 addition & 1 deletion amplipi/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class fields(SimpleNamespace):
VolumeF = Field(ge=MIN_VOL_F, le=MAX_VOL_F,
description='Output volume as a floating-point scalar from 0.0 to 1.0 representing MIN_VOL_DB to MAX_VOL_DB')
VolumeDeltaF = Field(ge=(MAX_VOL_F * -1), le=MAX_VOL_F,
description='Output volume as a floating-point scalar from -1.0 to 1.0 representing the distance between the current and goal volume')
description='Adjustment to output volume as a floating-point scalar from -1.0 to 1.0 representing the distance between the current and goal volume')
VolumeMin = Field(ge=MIN_VOL_DB, le=MAX_VOL_DB, description='Min output volume in dB')
VolumeMax = Field(ge=MIN_VOL_DB, le=MAX_VOL_DB, description='Max output volume in dB')
GroupMute = Field(description='Set to true if output is all zones muted')
Expand Down

0 comments on commit 85b93ca

Please sign in to comment.