mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-18 07:42:08 +08:00
e9d58939d2
* make sound infinite loopable * Update selfdrive/ui/android/sl_sound.cc * fix loop * fix test threshold * more fix Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> Co-authored-by: Comma Device <device@comma.ai> old-commit-hash: 53bd3050ee90ca18445ddc41b837f5f927cc0c6a
25 lines
980 B
C++
25 lines
980 B
C++
#pragma once
|
|
#include <map>
|
|
#include "cereal/gen/cpp/log.capnp.h"
|
|
|
|
typedef cereal::CarControl::HUDControl::AudibleAlert AudibleAlert;
|
|
|
|
static std::map<AudibleAlert, std::pair<const char *, int>> sound_map {
|
|
// AudibleAlert, (file path, loop count)
|
|
{AudibleAlert::CHIME_DISENGAGE, {"../assets/sounds/disengaged.wav", 0}},
|
|
{AudibleAlert::CHIME_ENGAGE, {"../assets/sounds/engaged.wav", 0}},
|
|
{AudibleAlert::CHIME_WARNING1, {"../assets/sounds/warning_1.wav", 0}},
|
|
{AudibleAlert::CHIME_WARNING2, {"../assets/sounds/warning_2.wav", 0}},
|
|
{AudibleAlert::CHIME_WARNING2_REPEAT, {"../assets/sounds/warning_2.wav", 3}},
|
|
{AudibleAlert::CHIME_WARNING_REPEAT, {"../assets/sounds/warning_repeat.wav", -1}},
|
|
{AudibleAlert::CHIME_ERROR, {"../assets/sounds/error.wav", 0}},
|
|
{AudibleAlert::CHIME_PROMPT, {"../assets/sounds/error.wav", 0}}
|
|
};
|
|
|
|
class Sound {
|
|
public:
|
|
virtual bool play(AudibleAlert alert) = 0;
|
|
virtual void stop() = 0;
|
|
virtual void setVolume(int volume) = 0;
|
|
};
|