2022-02-15 03:12:20 +00:00
|
|
|
/**
|
|
|
|
* Furnace Tracker - multi-system chiptune tracker
|
|
|
|
* Copyright (C) 2021-2022 tildearrow and contributors
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2022-01-19 09:32:40 +00:00
|
|
|
#ifndef _WAVETABLE_H
|
|
|
|
#define _WAVETABLE_H
|
|
|
|
#include "safeWriter.h"
|
2022-01-21 23:17:05 +00:00
|
|
|
#include "dataErrors.h"
|
2022-01-19 09:32:40 +00:00
|
|
|
|
2021-05-11 20:08:08 +00:00
|
|
|
struct DivWavetable {
|
2022-01-09 08:52:41 +00:00
|
|
|
int len, min, max;
|
2022-01-11 08:16:32 +00:00
|
|
|
int data[256];
|
2021-05-28 07:02:54 +00:00
|
|
|
|
2022-03-16 03:05:55 +00:00
|
|
|
/**
|
|
|
|
* save the wavetable to a SafeWriter.
|
|
|
|
* @param w the SafeWriter in question.
|
|
|
|
*/
|
2022-01-19 09:32:40 +00:00
|
|
|
void putWaveData(SafeWriter* w);
|
2022-03-16 03:05:55 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* read wavetable data in .fuw format.
|
|
|
|
* @param reader the reader.
|
|
|
|
* @param version the format version.
|
|
|
|
* @return a DivDataErrors.
|
|
|
|
*/
|
2022-01-21 23:17:05 +00:00
|
|
|
DivDataErrors readWaveData(SafeReader& reader, short version);
|
2022-03-16 03:05:55 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* save this wavetable to a file.
|
|
|
|
* @param path file path.
|
|
|
|
* @return whether it was successful.
|
|
|
|
*/
|
2022-01-19 09:32:40 +00:00
|
|
|
bool save(const char* path);
|
2021-05-28 07:02:54 +00:00
|
|
|
DivWavetable():
|
2022-01-09 08:52:41 +00:00
|
|
|
len(32),
|
|
|
|
min(0),
|
|
|
|
max(31) {
|
2022-01-11 08:16:32 +00:00
|
|
|
for (int i=0; i<256; i++) {
|
2021-12-27 20:21:38 +00:00
|
|
|
data[i]=i;
|
|
|
|
}
|
2021-05-28 07:02:54 +00:00
|
|
|
}
|
2021-05-11 20:08:08 +00:00
|
|
|
};
|
2022-01-19 09:32:40 +00:00
|
|
|
|
|
|
|
#endif
|