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.

33 lines
755 B

#pragma once
#include <map>
#include "cereal/gen/cpp/log.capnp.h"
5 years ago
#if defined(QCOM)
#include <SLES/OpenSLES.h>
#include <SLES/OpenSLES_Android.h>
#endif
5 years ago
typedef cereal::CarControl::HUDControl::AudibleAlert AudibleAlert;
5 years ago
class Sound {
public:
Sound() = default;
bool init(int volume);
bool play(AudibleAlert alert);
void stop();
void setVolume(int volume);
~Sound();
5 years ago
#if defined(QCOM)
private:
SLObjectItf engine_ = nullptr;
SLObjectItf outputMix_ = nullptr;
int last_volume_ = 0;
double last_set_volume_time_ = 0.;
AudibleAlert currentSound_ = AudibleAlert::NONE;
struct Player;
std::map<AudibleAlert, Player *> player_;
friend void SLAPIENTRY slplay_callback(SLPlayItf playItf, void *context, SLuint32 event);
5 years ago
#endif
};