Skip to content

Commit

Permalink
Merge pull request #76 from xxr3376/patch-1
Browse files Browse the repository at this point in the history
Fix amixer bad volume argument
  • Loading branch information
systemcrash authored Oct 7, 2022
2 parents 6b220c6 + dca16f3 commit 6f3c1ce
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ap2/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def get_volume():
pct = 0
vol = interpolate(pct, 0, 100, -30, 0)
elif subsys == "Linux":
line_pct = subprocess.check_output(["amixer", "get", "PCM"]).splitlines()[-1]
line_pct = subprocess.check_output(["amixer", "get", "Master"]).splitlines()[-1]
m = re.search(b"\[([0-9]+)%\]", line_pct)
if m:
pct = int(m.group(1))
Expand Down Expand Up @@ -255,7 +255,7 @@ def set_volume(vol):
elif subsys == "Linux":
pct = int(interpolate(vol, -30, 0, 45, 100))

subprocess.run(["amixer", "set", "PCM", f"{pct}%%"])
subprocess.run(["amixer", "set", "Master", f"{pct}%"])
elif subsys == "Windows":
volume_session = get_pycaw_volume_session()
if volume_session:
Expand Down

0 comments on commit 6f3c1ce

Please sign in to comment.