Visuals - Custom Themes - Sound Pack
Switch out the standard openpilot sounds with a set of themed sounds. Want to submit your own sound pack? Post it in the 'feature-request' channel in the FrogPilot Discord!
This commit is contained in:
parent
100f6044d6
commit
c711d9adbc
|
@ -665,7 +665,7 @@ class Controls:
|
|||
good_speed = CS.vEgo > 5
|
||||
max_torque = abs(self.sm['carOutput'].actuatorsOutput.steer) > 0.99
|
||||
if undershooting and turning and good_speed and max_torque:
|
||||
lac_log.active and self.events.add(EventName.steerSaturated)
|
||||
lac_log.active and self.events.add(EventName.goatSteerSaturated if self.frogpilot_toggles.goat_scream else EventName.steerSaturated)
|
||||
elif lac_log.saturated:
|
||||
# TODO probably should not use dpath_points but curvature
|
||||
dpath_points = model_v2.position.y
|
||||
|
|
|
@ -994,6 +994,14 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
|
|||
Priority.MID, VisualAlert.none, AudibleAlert.prompt, 1.),
|
||||
},
|
||||
|
||||
EventName.goatSteerSaturated: {
|
||||
ET.WARNING: Alert(
|
||||
"Turn exceeds steering limit",
|
||||
"JESUS TAKE THE WHEEL!!",
|
||||
AlertStatus.userPrompt, AlertSize.mid,
|
||||
Priority.LOW, VisualAlert.steerRequired, AudibleAlert.goat, 2.),
|
||||
},
|
||||
|
||||
EventName.greenLight: {
|
||||
ET.PERMANENT: Alert(
|
||||
"Light turned green",
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -40,6 +40,9 @@ sound_list: dict[int, tuple[str, int | None, float]] = {
|
|||
|
||||
AudibleAlert.warningSoft: ("warning_soft.wav", None, MAX_VOLUME),
|
||||
AudibleAlert.warningImmediate: ("warning_immediate.wav", None, MAX_VOLUME),
|
||||
|
||||
# Other
|
||||
AudibleAlert.goat: ("goat.wav", None, MAX_VOLUME),
|
||||
}
|
||||
|
||||
def check_controls_timeout_alert(sm):
|
||||
|
@ -54,8 +57,6 @@ def check_controls_timeout_alert(sm):
|
|||
|
||||
class Soundd:
|
||||
def __init__(self):
|
||||
self.load_sounds()
|
||||
|
||||
self.current_alert = AudibleAlert.none
|
||||
self.current_volume = MIN_VOLUME
|
||||
self.current_sound_frame = 0
|
||||
|
@ -67,6 +68,8 @@ class Soundd:
|
|||
# FrogPilot variables
|
||||
self.frogpilot_toggles = FrogPilotVariables.toggles
|
||||
|
||||
self.previous_sound_directory = None
|
||||
|
||||
self.update_toggles = False
|
||||
|
||||
self.update_frogpilot_sounds()
|
||||
|
@ -78,7 +81,12 @@ class Soundd:
|
|||
for sound in sound_list:
|
||||
filename, play_count, volume = sound_list[sound]
|
||||
|
||||
wavefile = wave.open(BASEDIR + "/selfdrive/assets/sounds/" + filename, 'r')
|
||||
try:
|
||||
if sound == AudibleAlert.goat and not self.frogpilot_toggles.goat_scream:
|
||||
continue
|
||||
wavefile = wave.open(self.sound_directory + filename, 'r')
|
||||
except FileNotFoundError:
|
||||
wavefile = wave.open(BASEDIR + "/selfdrive/assets/sounds/" + filename, 'r')
|
||||
|
||||
assert wavefile.getnchannels() == 1
|
||||
assert wavefile.getsampwidth() == 2
|
||||
|
@ -190,8 +198,25 @@ class Soundd:
|
|||
|
||||
AudibleAlert.warningSoft: self.frogpilot_toggles.warningSoft_volume,
|
||||
AudibleAlert.warningImmediate: self.frogpilot_toggles.warningImmediate_volume,
|
||||
|
||||
AudibleAlert.goat: self.frogpilot_toggles.prompt_volume,
|
||||
}
|
||||
|
||||
theme_configuration = {
|
||||
0: "stock_theme",
|
||||
1: "frog_theme",
|
||||
2: "tesla_theme",
|
||||
3: "stalin_theme"
|
||||
}
|
||||
|
||||
theme_name = theme_configuration.get(self.frogpilot_toggles.custom_sounds)
|
||||
self.sound_directory = BASEDIR + ("/selfdrive/frogpilot/assets/custom_themes/" + theme_name + "/sounds/" if theme_name != "stock_theme" else "/selfdrive/assets/sounds/")
|
||||
|
||||
if self.sound_directory != self.previous_sound_directory:
|
||||
self.load_sounds()
|
||||
|
||||
self.previous_sound_directory = self.sound_directory
|
||||
|
||||
def main():
|
||||
s = Soundd()
|
||||
s.soundd_thread()
|
||||
|
|
Loading…
Reference in New Issue