diff --git a/config/config.json b/config/config.json index d1fdaf2..5ac4241 100644 --- a/config/config.json +++ b/config/config.json @@ -28,7 +28,8 @@ { "Host": "127.0.0.1", "Port": 27019, - "SampleRate": 22050 + "SampleRate": 22050, + "Volume": 1.0 }, "GeoIP": diff --git a/src/torchlight/FFmpegAudioPlayer.py b/src/torchlight/FFmpegAudioPlayer.py index 0aceb04..779b532 100644 --- a/src/torchlight/FFmpegAudioPlayer.py +++ b/src/torchlight/FFmpegAudioPlayer.py @@ -28,6 +28,7 @@ def __init__(self, torchlight: Torchlight) -> None: self.host = self.config["Host"] self.port = self.config["Port"] self.sample_rate = float(self.config["SampleRate"]) + self.volume = float(self.config["Volume"]) self.started_playing: float | None = None self.stopped_playing: float | None = None @@ -58,6 +59,8 @@ def PlayURI(self, uri: str, position: int | None, *args: Any) -> bool: "1", "-ar", str(int(self.sample_rate)), + "-filter:a", + f"volume={str(float(self.volume))}", "-f", "s16le", "-vn", @@ -76,6 +79,8 @@ def PlayURI(self, uri: str, position: int | None, *args: Any) -> bool: "1", "-ar", str(int(self.sample_rate)), + "-filter:a", + f"volume={str(float(self.volume))}", "-f", "s16le", "-vn",