Aurore
A Switch-like interface for your app, on every screen
Loading...
Searching...
No Matches
audio.hpp
Go to the documentation of this file.
1/*
2 Copyright 2021 natinusala
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17#pragma once
18
19namespace aurore
20{
21
23{
24 SOUND_NONE = 0, // no sound
25
26 SOUND_FOCUS_CHANGE, // played when the focus changes
27 SOUND_FOCUS_ERROR, // played when the user wants to go somewhere impossible (while the highlight wiggles)
28 SOUND_CLICK, // played when the click action runs
29 SOUND_BACK, // played when back action runs
30 SOUND_FOCUS_SIDEBAR, // played when the focus changes to a sidebar item
31 SOUND_CLICK_ERROR, // played when the user clicks a disabled button / a view focused with no click action
32 SOUND_HONK, // honk
33 SOUND_CLICK_SIDEBAR, // played when a sidebar item is clicked
34 SOUND_TOUCH_UNFOCUS, // played when touch focus has been interrupted
35 SOUND_TOUCH, // played when touch doesn't require it's own click sound
38
39 _SOUND_MAX, // not an actual sound, just used to count of many sounds there are
40};
41
42// Platform agnostic Audio player
43// Each platform's AudioPlayer is responsible for managing the enum Sound -> internal representation map
45{
46 public:
47 virtual ~AudioPlayer() {};
48
55 virtual bool load(enum Sound sound) = 0;
56
65 virtual bool play(enum Sound sound, float pitch = 1) = 0;
66};
67
68// An AudioPlayer that does nothing
70{
71 public:
72 bool load(enum Sound sound) override
73 {
74 return false;
75 }
76
77 bool play(enum Sound sound, float pitch) override
78 {
79 return false;
80 }
81};
82
83} // namespace aurore
Definition audio.hpp:45
virtual bool play(enum Sound sound, float pitch=1)=0
virtual bool load(enum Sound sound)=0
virtual ~AudioPlayer()
Definition audio.hpp:47
Definition audio.hpp:70
bool play(enum Sound sound, float pitch) override
Definition audio.hpp:77
bool load(enum Sound sound) override
Definition audio.hpp:72
Definition actions.hpp:25
Sound
Definition audio.hpp:23
@ SOUND_HONK
Definition audio.hpp:32
@ SOUND_CLICK_SIDEBAR
Definition audio.hpp:33
@ SOUND_NONE
Definition audio.hpp:24
@ SOUND_CLICK
Definition audio.hpp:28
@ SOUND_FOCUS_ERROR
Definition audio.hpp:27
@ SOUND_FOCUS_CHANGE
Definition audio.hpp:26
@ SOUND_TOUCH_UNFOCUS
Definition audio.hpp:34
@ SOUND_SLIDER_RELEASE
Definition audio.hpp:37
@ SOUND_FOCUS_SIDEBAR
Definition audio.hpp:30
@ SOUND_CLICK_ERROR
Definition audio.hpp:31
@ SOUND_BACK
Definition audio.hpp:29
@ SOUND_SLIDER_TICK
Definition audio.hpp:36
@ SOUND_TOUCH
Definition audio.hpp:35
@ _SOUND_MAX
Definition audio.hpp:39