Debian Codegraph @

src/engine/wavetable.h

raw
1 /**
2 * Furnace Tracker - multi-system chiptune tracker
3 * Copyright (C) 2021-2025 tildearrow and contributors
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #ifndef _WAVETABLE_H
21 #define _WAVETABLE_H
22 #include "safeWriter.h"
23 #include "dataErrors.h"
24
25 struct DivWavetable {
26 int len, min, max;
27 int data[256];
28
29 /**
30 * save the wavetable to a SafeWriter.
31 * @param w the SafeWriter in question.
32 */
33 void putWaveData(SafeWriter* w);
34
35 /**
36 * read wavetable data in .fuw format.
37 * @param reader the reader.
38 * @param version the format version.
39 * @return a DivDataErrors.
40 */
41 DivDataErrors readWaveData(SafeReader& reader, short version);
42
43 /**
44 * save this wavetable to a file.
45 * @param path file path.
46 * @return whether it was successful.
47 */
48 bool save(const char* path);
49
50 /**
51 * save this wavetable to a file in .dmw format.
52 * @param path file path.
53 * @return whether it was successful.
54 */
55 bool saveDMW(const char* path);
56
57 /**
58 * save this wavetable to a file in raw format.
59 * @param path file path.
60 * @return whether it was successful.
61 */
62 bool saveRaw(const char* path);
63 DivWavetable():
64 len(32),
65 min(0),
66 max(31) {
67 for (int i=0; i<256; i++) {
68 data[i]=i;
69 }
70 }
71 };
72
73 #endif