persona-3-dual
A DS demake of Persona 3
Loading...
Searching...
No Matches
audioDb.cpp
Go to the documentation of this file.
1
#include "
data/audioDb.hpp
"
2
#include "
core/logger.hpp
"
3
#include <string>
4
5
static
const
AudioDBEntry
AUDIO_DB_ENTRY
[] = {
6
// battle
7
{
AudioType::BATTLE
,
8
static_cast<
int
>
(
BattleAudio::MASS_DESTRUCTION
),
9
"battle/mass_destruction"
,
10
ae::q20_12_t{0.000},
11
ae::q20_12_t{-1.000}},
12
13
// location
14
{
AudioType::LOCATION
,
15
static_cast<
int
>
(
LocationAudio::IWATODAI_DORM
),
16
"locations/iwatodaiDorm/iwatodai_dorm"
,
17
ae::q20_12_t{1.300},
18
ae::q20_12_t{-1.000}},
19
{
AudioType::LOCATION
,
20
static_cast<
int
>
(
LocationAudio::SUMMER_BOUND
),
21
"locations/iwatodaiStreets/summer_bound"
,
22
ae::q20_12_t{0.000},
23
ae::q20_12_t{-1.000}},
// TODO: get correct looping points
24
{
AudioType::LOCATION
,
25
static_cast<
int
>
(
LocationAudio::COLOR_YOUR_NIGHT
),
26
"locations/paulowniaMall/overworld/color_your_night"
,
27
ae::q20_12_t{0.000},
28
ae::q20_12_t{-1.000}},
// TODO: get correct looping points
29
{
AudioType::LOCATION
,
30
static_cast<
int
>
(
LocationAudio::PAULOWNIA_MALL
),
31
"locations/paulowniaMall/station/paulownia_mall"
,
32
ae::q20_12_t{0.000},
33
ae::q20_12_t{-1.000}},
// TODO: get correct looping points
34
35
// menu
36
{
AudioType::MENU
,
37
static_cast<
int
>
(
MenuAudio::MISTIC
),
38
"menus/contract/mistic"
,
39
ae::q20_12_t{0.000},
40
ae::q20_12_t{-1.000}},
41
{
AudioType::MENU
,
42
static_cast<
int
>
(
MenuAudio::TIGHTROPE
),
43
"menus/title/tightrope"
,
44
ae::q20_12_t{17.962},
45
ae::q20_12_t{66.082}},
46
{
AudioType::MENU
,
47
static_cast<
int
>
(
MenuAudio::ARIA_OF_THE_SOUL
),
48
"menus/velvetRoom/aria_of_the_soul"
,
49
ae::q20_12_t{0.000},
50
ae::q20_12_t{-1.000}},
51
52
// other
53
{
AudioType::OTHER
,
54
static_cast<
int
>
(
OtherAudio::AFTER_THE_BATTLE
),
55
"other/after_the_battle"
,
56
ae::q20_12_t{24.000},
57
ae::q20_12_t{-1.000}},
58
{
AudioType::OTHER
,
59
static_cast<
int
>
(
OtherAudio::BECAUSE_I_WILL_PROTECT_YOU
),
60
"other/because_i_will_protect_you"
,
61
ae::q20_12_t{.000},
62
ae::q20_12_t{-1.000}},
63
{
AudioType::OTHER
,
64
static_cast<
int
>
(
OtherAudio::CLUB_ESCAPADE_NOUVEAU_METALMOTH_REMIX
),
65
"other/club_escapade_nouveau_metalmoth_remix"
,
66
ae::q20_12_t{0.000},
67
ae::q20_12_t{-1.000}},
// TODO: get correct looping points
68
{
AudioType::OTHER
,
static_cast<
int
>
(
OtherAudio::PEACE
),
"other/peace"
, ae::q20_12_t{47.060}, ae::q20_12_t{-1.000}},
69
{
AudioType::OTHER
,
70
static_cast<
int
>
(
OtherAudio::WANT_TO_BE_CLOSE
),
71
"other/want_to_be_close"
,
72
ae::q20_12_t{47.060},
73
ae::q20_12_t{-1.000}},
74
};
75
76
static
const
int
AUDIO_DB_ENTRY_LEN
=
sizeof
(
AUDIO_DB_ENTRY
) /
sizeof
(
AUDIO_DB_ENTRY
[0]);
77
78
AudioDBEntry
getAudioDBEntry
(
AudioType
type,
int
id
)
79
{
80
for
(
int
i = 0; i <
AUDIO_DB_ENTRY_LEN
; ++i)
81
{
82
if
(
AUDIO_DB_ENTRY
[i].type == type &&
AUDIO_DB_ENTRY
[i].
id
==
id
)
83
{
84
return
AUDIO_DB_ENTRY
[i];
85
}
86
}
87
logMessage
(
LogSeverity::WARNING
,
88
"AudioDBEntry not found for type: "
+ std::to_string(
static_cast<
int
>
(type)) +
89
" id: "
+ std::to_string(
id
));
90
return
AudioDBEntry
{
AudioType::NONE
};
91
}
92
93
std::string
getAudioFilepath
(
AudioType
type,
int
id
)
94
{
95
AudioDBEntry
entry =
getAudioDBEntry
(type,
id
);
96
if
(entry.
type
==
AudioType::NONE
)
97
{
98
return
""
;
99
}
100
101
return
entry.
filename
;
102
}
103
104
ae::q20_12_t
getLoopStart
(
AudioType
type,
int
id
)
105
{
106
AudioDBEntry
entry =
getAudioDBEntry
(type,
id
);
107
if
(entry.
type
==
AudioType::NONE
)
108
{
109
return
ae::q20_12_t{0.000};
110
}
111
112
return
entry.
loopStartTime
;
113
}
114
115
ae::q20_12_t
getLoopEnd
(
AudioType
type,
int
id
)
116
{
117
AudioDBEntry
entry =
getAudioDBEntry
(type,
id
);
118
if
(entry.
type
==
AudioType::NONE
)
119
{
120
return
ae::q20_12_t{-1.000};
121
}
122
123
return
entry.
loopEndTime
;
124
}
AUDIO_DB_ENTRY_LEN
static const int AUDIO_DB_ENTRY_LEN
Definition
audioDb.cpp:76
AUDIO_DB_ENTRY
static const AudioDBEntry AUDIO_DB_ENTRY[]
Definition
audioDb.cpp:5
getLoopStart
ae::q20_12_t getLoopStart(AudioType type, int id)
Get the loop start time.
Definition
audioDb.cpp:104
getLoopEnd
ae::q20_12_t getLoopEnd(AudioType type, int id)
Get the loop end time.
Definition
audioDb.cpp:115
getAudioFilepath
std::string getAudioFilepath(AudioType type, int id)
Get the audio file path.
Definition
audioDb.cpp:93
getAudioDBEntry
AudioDBEntry getAudioDBEntry(AudioType type, int id)
Internal helper to get the AudioDBEntry struct.
Definition
audioDb.cpp:78
audioDb.hpp
BattleAudio::MASS_DESTRUCTION
@ MASS_DESTRUCTION
Definition
audioDb.hpp:27
AudioType
AudioType
Definition
audioDb.hpp:6
AudioType::OTHER
@ OTHER
Definition
audioDb.hpp:11
AudioType::BATTLE
@ BATTLE
Definition
audioDb.hpp:8
AudioType::MENU
@ MENU
Definition
audioDb.hpp:10
AudioType::LOCATION
@ LOCATION
Definition
audioDb.hpp:9
AudioType::NONE
@ NONE
Definition
audioDb.hpp:7
OtherAudio::PEACE
@ PEACE
Definition
audioDb.hpp:50
OtherAudio::BECAUSE_I_WILL_PROTECT_YOU
@ BECAUSE_I_WILL_PROTECT_YOU
Definition
audioDb.hpp:48
OtherAudio::AFTER_THE_BATTLE
@ AFTER_THE_BATTLE
Definition
audioDb.hpp:47
OtherAudio::WANT_TO_BE_CLOSE
@ WANT_TO_BE_CLOSE
Definition
audioDb.hpp:51
OtherAudio::CLUB_ESCAPADE_NOUVEAU_METALMOTH_REMIX
@ CLUB_ESCAPADE_NOUVEAU_METALMOTH_REMIX
Definition
audioDb.hpp:49
LocationAudio::COLOR_YOUR_NIGHT
@ COLOR_YOUR_NIGHT
Definition
audioDb.hpp:34
LocationAudio::SUMMER_BOUND
@ SUMMER_BOUND
Definition
audioDb.hpp:33
LocationAudio::PAULOWNIA_MALL
@ PAULOWNIA_MALL
Definition
audioDb.hpp:35
LocationAudio::IWATODAI_DORM
@ IWATODAI_DORM
Definition
audioDb.hpp:32
MenuAudio::ARIA_OF_THE_SOUL
@ ARIA_OF_THE_SOUL
Definition
audioDb.hpp:42
MenuAudio::MISTIC
@ MISTIC
Definition
audioDb.hpp:40
MenuAudio::TIGHTROPE
@ TIGHTROPE
Definition
audioDb.hpp:41
logMessage
void logMessage(LogSeverity severity, std::string_view message, std::source_location location)
Logs a diagnostic message and halts only for fatal messages.
Definition
logger.cpp:110
logger.hpp
Util to handle error logging.
LogSeverity::WARNING
@ WARNING
Definition
logger.hpp:16
AudioDBEntry
Definition
audioDb.hpp:17
AudioDBEntry::loopEndTime
ae::q20_12_t loopEndTime
Definition
audioDb.hpp:22
AudioDBEntry::type
AudioType type
Definition
audioDb.hpp:18
AudioDBEntry::loopStartTime
ae::q20_12_t loopStartTime
Definition
audioDb.hpp:21
AudioDBEntry::filename
const char * filename
Definition
audioDb.hpp:20
source
data
audioDb.cpp
Generated by
1.15.0