openpilot is an open source driver assistance system. openpilot performs the functions of Automated Lane Centering and Adaptive Cruise Control for over 200 supported car makes and models.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.0 KiB

#pragma once
#include <map>
#include <QSoundEffect>
#include "cereal/gen/cpp/log.capnp.h"
typedef cereal::CarControl::HUDControl::AudibleAlert AudibleAlert;
class Sound {
public:
Sound();
void play(AudibleAlert alert);
void stop();
float volume = 0;
private:
std::map<AudibleAlert, std::pair<QString, bool>> sound_map {
// AudibleAlert, (file path, inf loop)
{AudibleAlert::CHIME_DISENGAGE, {"../assets/sounds/disengaged.wav", false}},
{AudibleAlert::CHIME_ENGAGE, {"../assets/sounds/engaged.wav", false}},
{AudibleAlert::CHIME_WARNING1, {"../assets/sounds/warning_1.wav", false}},
{AudibleAlert::CHIME_WARNING2, {"../assets/sounds/warning_2.wav", false}},
{AudibleAlert::CHIME_WARNING2_REPEAT, {"../assets/sounds/warning_2.wav", true}},
{AudibleAlert::CHIME_WARNING_REPEAT, {"../assets/sounds/warning_repeat.wav", true}},
{AudibleAlert::CHIME_ERROR, {"../assets/sounds/error.wav", false}},
{AudibleAlert::CHIME_PROMPT, {"../assets/sounds/error.wav", false}}
};
std::map<AudibleAlert, QSoundEffect> sounds;
};