Rise
The Vieneo Province
Loading...
Searching...
No Matches
VehicleHorn.h
Go to the documentation of this file.
1#pragma once
2
3namespace VehicleHorn
4{
5// Authored mix distance, not a measured SPL or atmospheric coefficient. The
6// Mammoth's trailing camera is about 42 m from the vehicle origin.
7inline constexpr float MammothReferenceDistanceKm = .050f;
8
9enum class Command { None, Start, Stop };
10inline Command SetPressed(bool& current, bool pressed)
11{
12 if (current == pressed) return Command::None;
13 current = pressed;
14 return pressed ? Command::Start : Command::Stop;
15}
16
17enum class Phase { Idle, Start, Loop, End };
19{
21
22 Phase Update(bool requested, bool clipFinished)
23 {
24 if (requested)
25 {
27 else if (phase == Phase::Start && clipFinished) phase = Phase::Loop;
28 }
30 else if (phase == Phase::End && clipFinished) phase = Phase::Idle;
31 return phase;
32 }
33};
34}
@ None
Definition ServerTypes.h:97
constexpr float MammothReferenceDistanceKm
Definition VehicleHorn.h:7
Command SetPressed(bool &current, bool pressed)
Definition VehicleHorn.h:10
Phase Update(bool requested, bool clipFinished)
Definition VehicleHorn.h:22