mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-09-02 10:33:43 +08:00
Raise comma four alert volume
This commit is contained in:
@@ -60,7 +60,7 @@ sound_list: dict[int, tuple[str, int | None, float]] = {
|
||||
def calculate_volume_for_device(weighted_db: float, device_type: str) -> float:
|
||||
ambient_db = 30 if device_type in ("mici", "tizi") else 26
|
||||
volume_base = 10 if device_type in ("mici", "tizi") else 20
|
||||
volume_boost = 1.2 if device_type == "mici" else 1.0
|
||||
volume_boost = 1.5 if device_type == "mici" else 1.0
|
||||
volume = ((weighted_db - ambient_db) / DB_SCALE) * (MAX_VOLUME - MIN_VOLUME) + MIN_VOLUME
|
||||
return min(MAX_VOLUME, volume_boost * math.pow(volume_base, (np.clip(volume, MIN_VOLUME, MAX_VOLUME) - 1)))
|
||||
|
||||
|
||||
@@ -11,12 +11,12 @@ AudibleAlert = log.SelfdriveState.AudibleAlert
|
||||
|
||||
|
||||
class TestSoundd(OpenpilotTestCase):
|
||||
def test_comma_four_volume_is_20_percent_louder_than_comma_three_x(self):
|
||||
def test_comma_four_volume_is_50_percent_louder_than_comma_three_x(self):
|
||||
for weighted_db in (20.0, 30.0, 40.0, 50.0):
|
||||
with self.subTest(weighted_db=weighted_db):
|
||||
comma_three_x_volume = calculate_volume_for_device(weighted_db, "tizi")
|
||||
comma_four_volume = calculate_volume_for_device(weighted_db, "mici")
|
||||
assert comma_four_volume == min(1.0, comma_three_x_volume * 1.2)
|
||||
assert comma_four_volume == min(1.0, comma_three_x_volume * 1.5)
|
||||
|
||||
def test_milestone_chime_uses_ui_milestone_event(self):
|
||||
soundd = Soundd()
|
||||
|
||||
Reference in New Issue
Block a user