mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-23 10:12:17 +08:00
0ae5e7403e
* move android into own dir * fix name * maybe this works? qt ui doesn't work on mac * fix that * pc sound works * fix pc build * lowercase * that needs to be real_arch * split into classes * fix typo in lib * Fix cycle alerts * Add qt multimedia libs to install scripts * Add ui/android folder * Fix android build * Raise exception if sound init fails * add missing return Co-authored-by: Willem Melching <willem.melching@gmail.com> Co-authored-by: Comma Device <device@comma.ai> old-commit-hash: acd1bde496904fbc0d97f4d89e630358c4d11f7f
25 lines
979 B
C++
25 lines
979 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", 3}},
|
|
{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;
|
|
};
|