prepare for wavetable synth
This commit is contained in:
parent
05dfec9f3d
commit
4dfe9f97fb
|
@ -302,6 +302,7 @@ src/engine/sample.cpp
|
|||
src/engine/song.cpp
|
||||
src/engine/sysDef.cpp
|
||||
src/engine/wavetable.cpp
|
||||
src/engine/waveSynth.cpp
|
||||
src/engine/vgmOps.cpp
|
||||
src/engine/platform/abstract.cpp
|
||||
src/engine/platform/genesis.cpp
|
||||
|
|
|
@ -477,6 +477,47 @@ struct DivInstrumentFDS {
|
|||
}
|
||||
};
|
||||
|
||||
enum DivWaveSynthEffects {
|
||||
DIV_WS_NONE=0,
|
||||
// one waveform effects
|
||||
DIV_WS_INVERT,
|
||||
DIV_WS_ADD,
|
||||
DIV_WS_SUBTRACT,
|
||||
DIV_WS_AVERAGE,
|
||||
DIV_WS_PHASE,
|
||||
// two waveform effects
|
||||
DIV_WS_NONE_DUAL=128,
|
||||
DIV_WS_WIPE,
|
||||
DIV_WS_FADE,
|
||||
DIV_WS_PING_PONG,
|
||||
DIV_WS_OVERLAY,
|
||||
DIV_WS_NEGATIVE_OVERLAY,
|
||||
DIV_WS_PHASE_DUAL,
|
||||
};
|
||||
|
||||
struct DivInstrumentWaveSynth {
|
||||
int wave1, wave2;
|
||||
unsigned char rateDivider, width, height;
|
||||
DivWaveSynthEffects effect;
|
||||
bool oneShot, enabled, global;
|
||||
unsigned char speed, param1, param2, param3, param4;
|
||||
DivInstrumentWaveSynth():
|
||||
wave1(0),
|
||||
wave2(0),
|
||||
rateDivider(1),
|
||||
width(32),
|
||||
height(32),
|
||||
effect(DIV_WS_NONE),
|
||||
oneShot(false),
|
||||
enabled(false),
|
||||
global(false),
|
||||
speed(1),
|
||||
param1(0),
|
||||
param2(0),
|
||||
param3(0),
|
||||
param4(0) {}
|
||||
};
|
||||
|
||||
struct DivInstrument {
|
||||
String name;
|
||||
bool mode;
|
||||
|
@ -488,6 +529,7 @@ struct DivInstrument {
|
|||
DivInstrumentAmiga amiga;
|
||||
DivInstrumentN163 n163;
|
||||
DivInstrumentFDS fds;
|
||||
DivInstrumentWaveSynth ws;
|
||||
|
||||
/**
|
||||
* save the instrument to a SafeWriter.
|
||||
|
|
5
src/engine/waveSynth.cpp
Normal file
5
src/engine/waveSynth.cpp
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include "waveSynth.h"
|
||||
|
||||
bool DivWaveSynth::tick() {
|
||||
return false;
|
||||
}
|
46
src/engine/waveSynth.h
Normal file
46
src/engine/waveSynth.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _WAVESYNTH_H
|
||||
#define _WAVESYNTH_H
|
||||
|
||||
#include "instrument.h"
|
||||
#include "wavetable.h"
|
||||
|
||||
class DivWaveSynth {
|
||||
DivInstrument* ins;
|
||||
int pos, stage, divCounter;
|
||||
int output[256];
|
||||
public:
|
||||
/**
|
||||
* tick this DivWaveSynth.
|
||||
* @return whether the wave has changed.
|
||||
*/
|
||||
bool tick();
|
||||
void init(DivInstrument* ins);
|
||||
DivWaveSynth():
|
||||
ins(NULL),
|
||||
pos(0),
|
||||
stage(0),
|
||||
divCounter(0) {
|
||||
memset(output,0,sizeof(int)*256);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue