libnedit
Lightweight C++ library for Nintendo DS(i) formats
Loading...
Searching...
No Matches
fmt_SSEQ.hpp
1
2#pragma once
3#include <ntr/fmt/fmt_Common.hpp>
4
5namespace ntr::fmt {
6
7 struct SSEQ : public fs::FileFormat {
8
9 struct Header : public CommonHeader<0x51455353 /* "SSEQ" */ > {
10 };
11
12 struct DataSection : public CommonBlock<0x41544144 /* "DATA" */ > {
13 u32 data_offset;
14 };
15
16 enum class EventType {
17 NoteOn,
18 Rest,
19 ProgramChange,
20 MultiTrack,
21 OpenTrack,
22 Jump,
23 Call,
24 /*TODO*/
25 Pan,
26 Volume,
27 MasterVolume,
28 Transpose,
29 PitchBend,
30 PitchBendRange,
31 TrackPriority,
32 NoteWait,
33 Tie,
34 PortamentoControl,
35 ModulationDepth,
36 ModulationSpeed,
37 ModulationType,
38 ModulationRange,
39 Portamento,
40 PortamentoTime,
41 AttackRate,
42 DecayRate,
43 SustainRate,
44 ReleaseRate,
45 LoopStart,
46 Expression,
47 PrintVariable,
48 ModulationDelay,
49 Tempo,
50 SweepPitch,
51 LoopEnd,
52 Return,
53 EndOfTrack
54 };
55
57 u8 offset_bytes[3];
58 u32 offset_32;
59 };
60
61 struct EventNoteOn {
62 u8 velocity;
63 u32 duration;
64 };
65
66 struct EventRest {
67 u32 duration;
68 };
69
71 u32 instr_id;
72 };
73
75 u16 track_mask;
76
77 inline bool HasTrack(const u8 id) {
78 return (this->track_mask >> id) & 1;
79 }
80 };
81
83 u8 track_id;
84 EventOffset track_offset;
85 };
86
87 struct EventJump {
88 EventOffset offset;
89 };
90
91 struct EventCall {
92 EventOffset offset;
93 };
94
95 struct EventPan {
96 u8 pan;
97 };
98
99 struct EventVolume {
100 u8 volume;
101 };
102
104 u8 volume;
105 };
106
108 u8 transpose;
109 };
110
112 i8 bend;
113 };
114
116 u8 bend_range;
117 };
118
120 u8 priority;
121 };
122
124 bool on_off;
125 };
126
127 struct EventTie {
128 bool on_off;
129 };
130
132 u8 control;
133 };
134
136 bool on_off;
137 };
138
140 u8 speed;
141 };
142
144 u8 type;
145 };
146
148 u8 range;
149 };
150
152 bool on_off;
153 };
154
156 u8 time;
157 };
158
160 u8 rate;
161 };
162
164 u8 rate;
165 };
166
168 u8 rate;
169 };
170
172 u8 rate;
173 };
174
176 u8 loop_count;
177 };
178
180 u8 expression;
181 };
182
184 u8 unk_var;
185 };
186
188 u16 delay;
189 };
190
191 struct EventTempo {
192 u16 tempo;
193 };
194
196 u16 pitch;
197 };
198
200 };
201
202 struct EventReturn {
203 };
204
206 };
207
208 struct Event {
209 EventType type;
210 union {
211 EventNoteOn note_on;
212 EventRest rest;
213 EventProgramChange program_change;
214 EventMultiTrack multi_track;
215 EventOpenTrack open_track;
216 EventJump jump;
217 EventCall call;
218 EventPan pan;
219 EventVolume volume;
220 EventMasterVolume master_volume;
221 EventTranspose transpose;
222 EventPitchBend pitch_bend;
223 EventPitchBendRange pitch_bend_range;
224 EventTrackPriority track_priority;
225 EventNoteWait note_wait;
226 EventTie tie;
227 EventPortamentoControl portamento_control;
228 EventModulationDepth modulation_depth;
229 EventModulationSpeed modulation_speed;
230 EventModulationType modulation_type;
231 EventModulationRange modulation_range;
232 EventPortamento portamento;
233 EventPortamentoTime portamento_time;
234 EventAttackRate attack_rate;
235 EventDecayRate decay_rate;
236 EventSustainRate sustain_rate;
237 EventReleaseRate release_rate;
238 EventLoopStart loop_start;
239 EventExpression expression;
240 EventPrintVariable print_variable;
241 EventModulationDelay modulation_delay;
242 EventTempo tempo;
243 EventSweepPitch sweep_pitch;
244 EventLoopEnd loop_end;
245 EventReturn ret;
246 EventEndOfTrack end_of_track;
247 } event;
248 };
249
250 Header header;
251 DataSection data;
252 std::vector<SSEQ::Event> events;
253
254 SSEQ() {}
255 SSEQ(const SSEQ&) = delete;
256
257 Result ValidateImpl(const std::string &path, std::shared_ptr<fs::FileHandle> file_handle, const fs::FileCompression comp) override;
258 Result ReadImpl(const std::string &path, std::shared_ptr<fs::FileHandle> file_handle, const fs::FileCompression comp) override;
259
260 Result WriteImpl(const std::string &path, std::shared_ptr<fs::FileHandle> file_handle, const fs::FileCompression comp) override {
261 NTR_R_FAIL(ResultSSEQWriteNotSupported);
262 }
263 };
264
265}
Definition ntr_Include.hpp:75
Definition fmt_Common.hpp:53
Definition fmt_Common.hpp:35
Definition fmt_SSEQ.hpp:12
Definition fmt_SSEQ.hpp:159
Definition fmt_SSEQ.hpp:91
Definition fmt_SSEQ.hpp:163
Definition fmt_SSEQ.hpp:205
Definition fmt_SSEQ.hpp:179
Definition fmt_SSEQ.hpp:87
Definition fmt_SSEQ.hpp:199
Definition fmt_SSEQ.hpp:175
Definition fmt_SSEQ.hpp:103
Definition fmt_SSEQ.hpp:187
Definition fmt_SSEQ.hpp:135
Definition fmt_SSEQ.hpp:147
Definition fmt_SSEQ.hpp:139
Definition fmt_SSEQ.hpp:143
Definition fmt_SSEQ.hpp:74
Definition fmt_SSEQ.hpp:61
Definition fmt_SSEQ.hpp:123
Definition fmt_SSEQ.hpp:82
Definition fmt_SSEQ.hpp:95
Definition fmt_SSEQ.hpp:115
Definition fmt_SSEQ.hpp:111
Definition fmt_SSEQ.hpp:131
Definition fmt_SSEQ.hpp:155
Definition fmt_SSEQ.hpp:151
Definition fmt_SSEQ.hpp:183
Definition fmt_SSEQ.hpp:70
Definition fmt_SSEQ.hpp:171
Definition fmt_SSEQ.hpp:66
Definition fmt_SSEQ.hpp:202
Definition fmt_SSEQ.hpp:167
Definition fmt_SSEQ.hpp:195
Definition fmt_SSEQ.hpp:191
Definition fmt_SSEQ.hpp:127
Definition fmt_SSEQ.hpp:119
Definition fmt_SSEQ.hpp:107
Definition fmt_SSEQ.hpp:99
Definition fmt_SSEQ.hpp:208
Definition fmt_SSEQ.hpp:9
Definition fmt_SSEQ.hpp:7
Definition fs_Base.hpp:45
Definition fmt_SSEQ.hpp:56