2022-02-15 03:12:20 +00:00
|
|
|
/**
|
|
|
|
* Furnace Tracker - multi-system chiptune tracker
|
2024-01-17 02:26:57 +00:00
|
|
|
* Copyright (C) 2021-2024 tildearrow and contributors
|
2022-02-15 03:12:20 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2021-05-12 08:58:55 +00:00
|
|
|
#ifndef _ENGINE_H
|
|
|
|
#define _ENGINE_H
|
2022-09-29 06:24:26 +00:00
|
|
|
#include "config.h"
|
2022-04-21 07:24:06 +00:00
|
|
|
#include "instrument.h"
|
2021-05-11 20:08:08 +00:00
|
|
|
#include "song.h"
|
|
|
|
#include "dispatch.h"
|
2023-05-21 09:39:36 +00:00
|
|
|
#include "effect.h"
|
2023-03-13 09:20:54 +00:00
|
|
|
#include "export.h"
|
2022-01-21 23:17:05 +00:00
|
|
|
#include "dataErrors.h"
|
2021-12-15 19:15:44 +00:00
|
|
|
#include "safeWriter.h"
|
2023-03-26 23:48:16 +00:00
|
|
|
#include "cmdStream.h"
|
2021-05-11 20:08:08 +00:00
|
|
|
#include "../audio/taAudio.h"
|
2021-05-12 08:58:55 +00:00
|
|
|
#include "blip_buf.h"
|
2022-03-19 08:42:44 +00:00
|
|
|
#include <functional>
|
2022-04-26 23:32:33 +00:00
|
|
|
#include <initializer_list>
|
2022-01-18 04:34:29 +00:00
|
|
|
#include <thread>
|
2023-09-13 07:46:02 +00:00
|
|
|
#include "../fixedQueue.h"
|
2021-05-11 20:08:08 +00:00
|
|
|
|
2023-09-06 09:03:53 +00:00
|
|
|
class DivWorkPool;
|
|
|
|
|
2022-02-18 17:58:36 +00:00
|
|
|
#define addWarning(x) \
|
|
|
|
if (warnings.empty()) { \
|
|
|
|
warnings+=x; \
|
|
|
|
} else { \
|
|
|
|
warnings+=(String("\n")+x); \
|
|
|
|
}
|
|
|
|
|
2022-03-24 02:38:28 +00:00
|
|
|
#define BUSY_BEGIN softLocked=false; isBusy.lock();
|
|
|
|
#define BUSY_BEGIN_SOFT softLocked=true; isBusy.lock();
|
|
|
|
#define BUSY_END isBusy.unlock(); softLocked=false;
|
|
|
|
|
2023-03-14 01:01:01 +00:00
|
|
|
#define EXTERN_BUSY_BEGIN e->softLocked=false; e->isBusy.lock();
|
|
|
|
#define EXTERN_BUSY_BEGIN_SOFT e->softLocked=true; e->isBusy.lock();
|
|
|
|
#define EXTERN_BUSY_END e->isBusy.unlock(); e->softLocked=false;
|
|
|
|
|
2024-06-25 21:35:22 +00:00
|
|
|
#define DIV_UNSTABLE
|
2023-07-10 01:34:44 +00:00
|
|
|
|
2024-07-06 00:16:22 +00:00
|
|
|
#define DIV_VERSION "dev215"
|
|
|
|
#define DIV_ENGINE_VERSION 215
|
2022-03-14 22:16:43 +00:00
|
|
|
// for imports
|
|
|
|
#define DIV_VERSION_MOD 0xff01
|
2022-07-24 06:57:10 +00:00
|
|
|
#define DIV_VERSION_FC 0xff02
|
2023-03-13 00:11:05 +00:00
|
|
|
#define DIV_VERSION_S3M 0xff03
|
2023-03-25 08:55:42 +00:00
|
|
|
#define DIV_VERSION_FTM 0xff04
|
2024-06-22 23:22:03 +00:00
|
|
|
#define DIV_VERSION_TFE 0xff05
|
|
|
|
#define DIV_VERSION_XM 0xff06
|
|
|
|
#define DIV_VERSION_IT 0xff07
|
2022-03-14 22:16:43 +00:00
|
|
|
|
2021-05-19 07:05:24 +00:00
|
|
|
enum DivStatusView {
|
|
|
|
DIV_STATUS_NOTHING=0,
|
|
|
|
DIV_STATUS_PATTERN,
|
|
|
|
DIV_STATUS_COMMANDS
|
|
|
|
};
|
|
|
|
|
2021-06-09 08:33:03 +00:00
|
|
|
enum DivAudioEngines {
|
|
|
|
DIV_AUDIO_JACK=0,
|
2022-01-23 04:50:49 +00:00
|
|
|
DIV_AUDIO_SDL=1,
|
2023-08-30 22:32:51 +00:00
|
|
|
DIV_AUDIO_PORTAUDIO=2,
|
2024-04-23 09:38:08 +00:00
|
|
|
DIV_AUDIO_PIPE=3,
|
2022-08-16 16:24:18 +00:00
|
|
|
|
2022-06-24 03:53:21 +00:00
|
|
|
DIV_AUDIO_NULL=126,
|
|
|
|
DIV_AUDIO_DUMMY=127
|
2021-06-09 08:33:03 +00:00
|
|
|
};
|
|
|
|
|
2022-01-18 04:34:29 +00:00
|
|
|
enum DivAudioExportModes {
|
|
|
|
DIV_EXPORT_MODE_ONE=0,
|
|
|
|
DIV_EXPORT_MODE_MANY_SYS,
|
|
|
|
DIV_EXPORT_MODE_MANY_CHAN
|
|
|
|
};
|
|
|
|
|
2022-02-03 23:38:57 +00:00
|
|
|
enum DivHaltPositions {
|
|
|
|
DIV_HALT_NONE=0,
|
|
|
|
DIV_HALT_TICK,
|
|
|
|
DIV_HALT_ROW,
|
|
|
|
DIV_HALT_PATTERN,
|
|
|
|
DIV_HALT_BREAKPOINT
|
|
|
|
};
|
|
|
|
|
2022-09-26 06:27:36 +00:00
|
|
|
enum DivMIDIModes {
|
|
|
|
DIV_MIDI_MODE_OFF=0,
|
|
|
|
DIV_MIDI_MODE_NOTE,
|
|
|
|
DIV_MIDI_MODE_LIGHT_SHOW
|
|
|
|
};
|
|
|
|
|
2024-05-11 19:25:53 +00:00
|
|
|
enum DivAudioExportFormats {
|
|
|
|
DIV_EXPORT_FORMAT_S16=0,
|
|
|
|
DIV_EXPORT_FORMAT_F32
|
|
|
|
};
|
|
|
|
|
2024-05-11 01:01:12 +00:00
|
|
|
struct DivAudioExportOptions {
|
|
|
|
DivAudioExportModes mode;
|
2024-05-11 19:25:53 +00:00
|
|
|
DivAudioExportFormats format;
|
2024-05-11 01:01:12 +00:00
|
|
|
int sampleRate;
|
|
|
|
int chans;
|
|
|
|
int loops;
|
|
|
|
double fadeOut;
|
|
|
|
int orderBegin, orderEnd;
|
|
|
|
bool channelMask[DIV_MAX_CHANS];
|
|
|
|
DivAudioExportOptions():
|
|
|
|
mode(DIV_EXPORT_MODE_ONE),
|
2024-05-11 19:25:53 +00:00
|
|
|
format(DIV_EXPORT_FORMAT_S16),
|
2024-05-11 01:01:12 +00:00
|
|
|
sampleRate(44100),
|
|
|
|
chans(2),
|
|
|
|
loops(0),
|
|
|
|
fadeOut(0.0),
|
|
|
|
orderBegin(-1),
|
|
|
|
orderEnd(-1) {
|
|
|
|
for (int i=0; i<DIV_MAX_CHANS; i++) {
|
|
|
|
channelMask[i]=true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-05-11 20:08:08 +00:00
|
|
|
struct DivChannelState {
|
|
|
|
std::vector<DivDelayedCommand> delayed;
|
2022-03-14 06:23:31 +00:00
|
|
|
int note, oldNote, lastIns, pitch, portaSpeed, portaNote;
|
2024-03-17 00:41:08 +00:00
|
|
|
int volume, volSpeed, cut, legatoDelay, legatoTarget, rowDelay, volMax;
|
2022-01-19 05:01:34 +00:00
|
|
|
int delayOrder, delayRow, retrigSpeed, retrigTick;
|
2024-06-24 11:24:14 +00:00
|
|
|
int vibratoDepth, vibratoRate, vibratoPos, vibratoPosGiant, vibratoShape, vibratoFine;
|
2021-05-14 19:16:48 +00:00
|
|
|
int tremoloDepth, tremoloRate, tremoloPos;
|
2024-04-23 19:36:06 +00:00
|
|
|
int sampleOff;
|
2024-03-15 18:45:57 +00:00
|
|
|
unsigned char arp, arpStage, arpTicks, panL, panR, panRL, panRR, lastVibrato, lastPorta, cutType;
|
2023-10-03 09:38:28 +00:00
|
|
|
bool doNote, legato, portaStop, keyOn, keyOff, nowYouCanStop, stopOnOff, releasing;
|
2024-04-23 19:36:06 +00:00
|
|
|
bool arpYield, delayLocked, inPorta, scheduledSlideReset, shorthandPorta, wasShorthandPorta, noteOnInhibit, resetArp, sampleOffSet;
|
2023-02-09 00:25:03 +00:00
|
|
|
bool wentThroughNote, goneThroughNote;
|
2021-05-14 08:23:40 +00:00
|
|
|
|
2022-04-09 06:50:44 +00:00
|
|
|
int midiNote, curMidiNote, midiPitch;
|
2022-04-28 10:04:34 +00:00
|
|
|
size_t midiAge;
|
2022-04-09 06:50:44 +00:00
|
|
|
bool midiAftertouch;
|
2022-03-31 06:51:57 +00:00
|
|
|
|
2021-05-14 08:23:40 +00:00
|
|
|
DivChannelState():
|
|
|
|
note(-1),
|
2021-12-19 05:02:48 +00:00
|
|
|
oldNote(-1),
|
2022-03-14 06:23:31 +00:00
|
|
|
lastIns(-1),
|
2021-05-14 08:23:40 +00:00
|
|
|
pitch(0),
|
|
|
|
portaSpeed(-1),
|
|
|
|
portaNote(-1),
|
|
|
|
volume(0x7f00),
|
|
|
|
volSpeed(0),
|
2021-05-16 08:03:23 +00:00
|
|
|
cut(-1),
|
2024-03-17 00:41:08 +00:00
|
|
|
legatoDelay(-1),
|
|
|
|
legatoTarget(0),
|
2021-05-16 08:03:23 +00:00
|
|
|
rowDelay(0),
|
2021-12-16 20:51:19 +00:00
|
|
|
volMax(0),
|
2021-12-05 21:11:12 +00:00
|
|
|
delayOrder(0),
|
|
|
|
delayRow(0),
|
2022-01-19 05:01:34 +00:00
|
|
|
retrigSpeed(0),
|
|
|
|
retrigTick(0),
|
2021-05-14 08:23:40 +00:00
|
|
|
vibratoDepth(0),
|
|
|
|
vibratoRate(0),
|
2021-05-14 19:16:48 +00:00
|
|
|
vibratoPos(0),
|
2022-06-14 09:41:31 +00:00
|
|
|
vibratoPosGiant(0),
|
2024-06-24 11:24:14 +00:00
|
|
|
vibratoShape(0),
|
2021-05-18 08:02:47 +00:00
|
|
|
vibratoFine(15),
|
2021-05-14 08:23:40 +00:00
|
|
|
tremoloDepth(0),
|
2021-05-14 19:16:48 +00:00
|
|
|
tremoloRate(0),
|
|
|
|
tremoloPos(0),
|
2024-04-23 19:36:06 +00:00
|
|
|
sampleOff(0),
|
2021-05-16 08:03:23 +00:00
|
|
|
arp(0),
|
|
|
|
arpStage(-1),
|
2021-05-18 07:53:59 +00:00
|
|
|
arpTicks(1),
|
2022-04-30 04:41:14 +00:00
|
|
|
panL(255),
|
|
|
|
panR(255),
|
2023-01-05 08:08:57 +00:00
|
|
|
panRL(0),
|
|
|
|
panRR(0),
|
2023-04-30 18:46:09 +00:00
|
|
|
lastVibrato(0),
|
|
|
|
lastPorta(0),
|
2024-03-15 18:45:57 +00:00
|
|
|
cutType(0),
|
2021-12-08 05:27:20 +00:00
|
|
|
doNote(false),
|
|
|
|
legato(false),
|
|
|
|
portaStop(false),
|
|
|
|
keyOn(false),
|
2022-01-19 06:36:20 +00:00
|
|
|
keyOff(false),
|
2021-12-08 05:27:20 +00:00
|
|
|
nowYouCanStop(true),
|
|
|
|
stopOnOff(false),
|
2023-10-03 09:38:28 +00:00
|
|
|
releasing(false),
|
2021-12-08 05:27:20 +00:00
|
|
|
arpYield(false),
|
2021-12-19 05:27:04 +00:00
|
|
|
delayLocked(false),
|
2022-01-19 06:27:32 +00:00
|
|
|
inPorta(false),
|
2022-02-03 06:30:03 +00:00
|
|
|
scheduledSlideReset(false),
|
2022-02-08 18:31:57 +00:00
|
|
|
shorthandPorta(false),
|
2022-06-29 09:57:05 +00:00
|
|
|
wasShorthandPorta(false),
|
2022-03-17 21:37:49 +00:00
|
|
|
noteOnInhibit(false),
|
2022-03-31 06:51:57 +00:00
|
|
|
resetArp(false),
|
2024-04-23 19:36:06 +00:00
|
|
|
sampleOffSet(false),
|
2023-02-09 00:25:03 +00:00
|
|
|
wentThroughNote(false),
|
|
|
|
goneThroughNote(false),
|
2022-03-31 08:33:05 +00:00
|
|
|
midiNote(-1),
|
2022-04-09 06:50:44 +00:00
|
|
|
curMidiNote(-1),
|
|
|
|
midiPitch(-1),
|
2022-04-28 10:04:34 +00:00
|
|
|
midiAge(0),
|
2022-04-09 06:50:44 +00:00
|
|
|
midiAftertouch(false) {}
|
2021-05-11 20:08:08 +00:00
|
|
|
};
|
|
|
|
|
2021-12-28 23:23:57 +00:00
|
|
|
struct DivNoteEvent {
|
2023-09-13 07:40:12 +00:00
|
|
|
signed char channel;
|
2024-01-20 07:34:21 +00:00
|
|
|
short ins;
|
2023-09-13 07:40:12 +00:00
|
|
|
signed char note, volume;
|
2023-12-17 20:30:51 +00:00
|
|
|
bool on, nop, insChange, fromMIDI;
|
|
|
|
DivNoteEvent(int c, int i, int n, int v, bool o, bool ic=false, bool fm=false):
|
2021-12-28 23:23:57 +00:00
|
|
|
channel(c),
|
|
|
|
ins(i),
|
|
|
|
note(n),
|
|
|
|
volume(v),
|
2023-09-13 07:40:12 +00:00
|
|
|
on(o),
|
|
|
|
nop(false),
|
2023-12-17 20:30:51 +00:00
|
|
|
insChange(ic),
|
|
|
|
fromMIDI(fm) {}
|
2023-09-13 07:40:12 +00:00
|
|
|
DivNoteEvent():
|
|
|
|
channel(-1),
|
|
|
|
ins(0),
|
|
|
|
note(0),
|
2023-12-14 01:44:32 +00:00
|
|
|
volume(-1),
|
2023-09-13 07:40:12 +00:00
|
|
|
on(false),
|
|
|
|
nop(true),
|
2023-12-17 20:30:51 +00:00
|
|
|
insChange(false),
|
|
|
|
fromMIDI(false) {}
|
2021-12-28 23:23:57 +00:00
|
|
|
};
|
|
|
|
|
2022-01-03 08:35:13 +00:00
|
|
|
struct DivDispatchContainer {
|
|
|
|
DivDispatch* dispatch;
|
2023-01-02 00:46:08 +00:00
|
|
|
blip_buffer_t* bb[DIV_MAX_OUTPUTS];
|
2023-04-16 22:29:01 +00:00
|
|
|
size_t bbInLen, runtotal, runLeft, runPos, lastAvail;
|
2023-01-02 00:46:08 +00:00
|
|
|
int temp[DIV_MAX_OUTPUTS], prevSample[DIV_MAX_OUTPUTS];
|
|
|
|
short* bbInMapped[DIV_MAX_OUTPUTS];
|
|
|
|
short* bbIn[DIV_MAX_OUTPUTS];
|
|
|
|
short* bbOut[DIV_MAX_OUTPUTS];
|
2023-10-29 20:25:23 +00:00
|
|
|
bool lowQuality, dcOffCompensation, hiPass;
|
2023-01-03 19:39:31 +00:00
|
|
|
double rateMemory;
|
2022-01-08 21:03:32 +00:00
|
|
|
|
2023-09-07 05:16:47 +00:00
|
|
|
// used in multi-thread
|
|
|
|
int cycles;
|
|
|
|
unsigned int size;
|
|
|
|
|
2022-01-08 21:03:32 +00:00
|
|
|
void setRates(double gotRate);
|
2023-10-29 20:25:23 +00:00
|
|
|
void setQuality(bool lowQual, bool dcHiPass);
|
2023-01-04 22:01:14 +00:00
|
|
|
void grow(size_t size);
|
2022-01-08 22:15:12 +00:00
|
|
|
void acquire(size_t offset, size_t count);
|
2022-02-08 02:31:58 +00:00
|
|
|
void flush(size_t count);
|
|
|
|
void fillBuf(size_t runtotal, size_t offset, size_t size);
|
2022-01-08 21:03:32 +00:00
|
|
|
void clear();
|
2023-08-18 06:40:18 +00:00
|
|
|
void init(DivSystem sys, DivEngine* eng, int chanCount, double gotRate, const DivConfig& flags, bool isRender=false);
|
2024-03-14 07:06:36 +00:00
|
|
|
void quit();
|
2022-01-08 21:03:32 +00:00
|
|
|
DivDispatchContainer():
|
|
|
|
dispatch(NULL),
|
|
|
|
bbInLen(0),
|
2022-08-07 22:32:39 +00:00
|
|
|
runtotal(0),
|
|
|
|
runLeft(0),
|
|
|
|
runPos(0),
|
|
|
|
lastAvail(0),
|
2022-04-09 23:25:25 +00:00
|
|
|
lowQuality(false),
|
2023-01-03 19:39:31 +00:00
|
|
|
dcOffCompensation(false),
|
2023-10-29 20:25:23 +00:00
|
|
|
hiPass(true),
|
2023-09-07 05:16:47 +00:00
|
|
|
rateMemory(0.0),
|
|
|
|
cycles(0),
|
|
|
|
size(0) {
|
2023-01-03 06:09:46 +00:00
|
|
|
memset(bb,0,DIV_MAX_OUTPUTS*sizeof(blip_buffer_t*));
|
2023-01-02 00:46:08 +00:00
|
|
|
memset(temp,0,DIV_MAX_OUTPUTS*sizeof(int));
|
|
|
|
memset(prevSample,0,DIV_MAX_OUTPUTS*sizeof(int));
|
2023-01-03 06:09:46 +00:00
|
|
|
memset(bbIn,0,DIV_MAX_OUTPUTS*sizeof(short*));
|
|
|
|
memset(bbInMapped,0,DIV_MAX_OUTPUTS*sizeof(short*));
|
|
|
|
memset(bbOut,0,DIV_MAX_OUTPUTS*sizeof(short*));
|
2023-01-02 00:46:08 +00:00
|
|
|
}
|
2022-01-03 08:35:13 +00:00
|
|
|
};
|
|
|
|
|
2023-05-21 09:39:36 +00:00
|
|
|
struct DivEffectContainer {
|
|
|
|
DivEffect* effect;
|
|
|
|
float* in[DIV_MAX_OUTPUTS];
|
|
|
|
float* out[DIV_MAX_OUTPUTS];
|
|
|
|
size_t inLen, outLen;
|
|
|
|
|
|
|
|
void preAcquire(size_t count);
|
|
|
|
void acquire(size_t count);
|
|
|
|
bool init(DivEffectType effectType, DivEngine* eng, double rate, unsigned short version, const unsigned char* data, size_t len);
|
|
|
|
void quit();
|
|
|
|
DivEffectContainer():
|
|
|
|
effect(NULL),
|
|
|
|
inLen(0),
|
|
|
|
outLen(0) {
|
|
|
|
memset(in,0,DIV_MAX_OUTPUTS*sizeof(float*));
|
|
|
|
memset(out,0,DIV_MAX_OUTPUTS*sizeof(float*));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-08-18 06:26:22 +00:00
|
|
|
typedef int EffectValConversion(unsigned char,unsigned char);
|
|
|
|
|
|
|
|
struct EffectHandler {
|
|
|
|
DivDispatchCmds dispatchCmd;
|
|
|
|
const char* description;
|
|
|
|
EffectValConversion* val;
|
|
|
|
EffectValConversion* val2;
|
|
|
|
EffectHandler(
|
|
|
|
DivDispatchCmds dispatchCmd_,
|
|
|
|
const char* description_,
|
|
|
|
EffectValConversion val_=NULL,
|
|
|
|
EffectValConversion val2_=NULL
|
|
|
|
):
|
|
|
|
dispatchCmd(dispatchCmd_),
|
|
|
|
description(description_),
|
|
|
|
val(val_),
|
|
|
|
val2(val2_) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DivDoNotHandleEffect {
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::unordered_map<unsigned char,const EffectHandler> EffectHandlerMap;
|
2022-04-26 23:32:33 +00:00
|
|
|
|
|
|
|
struct DivSysDef {
|
|
|
|
const char* name;
|
|
|
|
const char* nameJ;
|
2022-05-14 09:05:29 +00:00
|
|
|
const char* description;
|
2022-04-26 23:32:33 +00:00
|
|
|
unsigned char id;
|
|
|
|
unsigned char id_DMF;
|
|
|
|
int channels;
|
|
|
|
bool isFM, isSTD, isCompound;
|
2023-11-28 23:36:52 +00:00
|
|
|
// width 0: variable
|
|
|
|
// height 0: no wavetable support
|
|
|
|
unsigned short waveWidth, waveHeight;
|
2022-04-27 05:56:15 +00:00
|
|
|
unsigned int vgmVersion;
|
2022-09-25 22:18:04 +00:00
|
|
|
unsigned int sampleFormatMask;
|
2022-04-26 23:32:33 +00:00
|
|
|
const char* chanNames[DIV_MAX_CHANS];
|
|
|
|
const char* chanShortNames[DIV_MAX_CHANS];
|
|
|
|
int chanTypes[DIV_MAX_CHANS];
|
|
|
|
// 0: primary
|
|
|
|
// 1: alternate (usually PCM)
|
|
|
|
DivInstrumentType chanInsType[DIV_MAX_CHANS][2];
|
2022-08-18 06:26:22 +00:00
|
|
|
const EffectHandlerMap effectHandlers;
|
|
|
|
const EffectHandlerMap postEffectHandlers;
|
2023-08-30 07:17:16 +00:00
|
|
|
const EffectHandlerMap preEffectHandlers;
|
2022-04-26 23:32:33 +00:00
|
|
|
DivSysDef(
|
|
|
|
const char* sysName, const char* sysNameJ, unsigned char fileID, unsigned char fileID_DMF, int chans,
|
2023-11-28 23:36:52 +00:00
|
|
|
bool isFMChip, bool isSTDChip, unsigned int vgmVer, bool compound, unsigned int formatMask, unsigned short waveWid, unsigned short waveHei,
|
|
|
|
const char* desc,
|
2022-04-26 23:32:33 +00:00
|
|
|
std::initializer_list<const char*> chNames,
|
|
|
|
std::initializer_list<const char*> chShortNames,
|
|
|
|
std::initializer_list<int> chTypes,
|
|
|
|
std::initializer_list<DivInstrumentType> chInsType1,
|
|
|
|
std::initializer_list<DivInstrumentType> chInsType2={},
|
2022-08-18 06:26:22 +00:00
|
|
|
const EffectHandlerMap fxHandlers_={},
|
2023-08-30 07:17:16 +00:00
|
|
|
const EffectHandlerMap postFxHandlers_={},
|
|
|
|
const EffectHandlerMap preFxHandlers_={}):
|
2022-04-26 23:32:33 +00:00
|
|
|
name(sysName),
|
|
|
|
nameJ(sysNameJ),
|
2022-05-14 09:05:29 +00:00
|
|
|
description(desc),
|
2022-04-26 23:32:33 +00:00
|
|
|
id(fileID),
|
|
|
|
id_DMF(fileID_DMF),
|
|
|
|
channels(chans),
|
|
|
|
isFM(isFMChip),
|
|
|
|
isSTD(isSTDChip),
|
|
|
|
isCompound(compound),
|
2023-11-28 23:36:52 +00:00
|
|
|
waveWidth(waveWid),
|
|
|
|
waveHeight(waveHei),
|
2022-04-26 23:32:33 +00:00
|
|
|
vgmVersion(vgmVer),
|
2022-09-25 22:18:04 +00:00
|
|
|
sampleFormatMask(formatMask),
|
2022-08-18 06:26:22 +00:00
|
|
|
effectHandlers(fxHandlers_),
|
2023-08-30 07:17:16 +00:00
|
|
|
postEffectHandlers(postFxHandlers_),
|
|
|
|
preEffectHandlers(preFxHandlers_) {
|
2022-04-26 23:32:33 +00:00
|
|
|
memset(chanNames,0,DIV_MAX_CHANS*sizeof(void*));
|
|
|
|
memset(chanShortNames,0,DIV_MAX_CHANS*sizeof(void*));
|
|
|
|
memset(chanTypes,0,DIV_MAX_CHANS*sizeof(int));
|
2022-04-27 09:48:56 +00:00
|
|
|
for (int i=0; i<DIV_MAX_CHANS; i++) {
|
|
|
|
chanInsType[i][0]=DIV_INS_NULL;
|
|
|
|
chanInsType[i][1]=DIV_INS_NULL;
|
|
|
|
}
|
2022-04-26 23:32:33 +00:00
|
|
|
|
|
|
|
int index=0;
|
|
|
|
for (const char* i: chNames) {
|
|
|
|
chanNames[index++]=i;
|
|
|
|
if (index>=DIV_MAX_CHANS) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
index=0;
|
|
|
|
for (const char* i: chShortNames) {
|
|
|
|
chanShortNames[index++]=i;
|
|
|
|
if (index>=DIV_MAX_CHANS) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
index=0;
|
|
|
|
for (int i: chTypes) {
|
|
|
|
chanTypes[index++]=i;
|
|
|
|
if (index>=DIV_MAX_CHANS) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
index=0;
|
|
|
|
for (DivInstrumentType i: chInsType1) {
|
|
|
|
chanInsType[index++][0]=i;
|
|
|
|
if (index>=DIV_MAX_CHANS) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
index=0;
|
|
|
|
for (DivInstrumentType i: chInsType2) {
|
|
|
|
chanInsType[index++][1]=i;
|
|
|
|
if (index>=DIV_MAX_CHANS) break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
enum DivChanTypes {
|
|
|
|
DIV_CH_FM=0,
|
|
|
|
DIV_CH_PULSE=1,
|
|
|
|
DIV_CH_NOISE=2,
|
|
|
|
DIV_CH_WAVE=3,
|
|
|
|
DIV_CH_PCM=4,
|
|
|
|
DIV_CH_OP=5
|
|
|
|
};
|
|
|
|
|
2022-08-04 05:51:47 +00:00
|
|
|
extern const char* cmdName[];
|
|
|
|
|
2021-05-11 20:08:08 +00:00
|
|
|
class DivEngine {
|
2022-12-09 05:30:27 +00:00
|
|
|
DivDispatchContainer disCont[DIV_MAX_CHIPS];
|
2021-05-11 20:08:08 +00:00
|
|
|
TAAudio* output;
|
|
|
|
TAAudioDesc want, got;
|
2022-01-18 04:34:29 +00:00
|
|
|
String exportPath;
|
|
|
|
std::thread* exportThread;
|
2021-05-11 20:08:08 +00:00
|
|
|
int chans;
|
2024-06-01 21:36:00 +00:00
|
|
|
bool configLoaded;
|
2021-12-20 19:20:05 +00:00
|
|
|
bool active;
|
2022-01-17 06:42:26 +00:00
|
|
|
bool lowQuality;
|
2023-10-29 20:25:23 +00:00
|
|
|
bool dcHiPass;
|
2021-05-11 20:08:08 +00:00
|
|
|
bool playing;
|
2021-12-28 23:23:57 +00:00
|
|
|
bool freelance;
|
2022-10-22 08:46:39 +00:00
|
|
|
bool shallStop, shallStopSched;
|
2021-12-07 09:22:36 +00:00
|
|
|
bool endOfSong;
|
2021-12-18 09:26:17 +00:00
|
|
|
bool consoleMode;
|
2024-04-23 09:38:08 +00:00
|
|
|
bool disableStatusOut;
|
2021-12-21 00:46:49 +00:00
|
|
|
bool extValuePresent;
|
2021-12-21 22:42:27 +00:00
|
|
|
bool repeatPattern;
|
2022-01-04 05:02:41 +00:00
|
|
|
bool metronome;
|
2022-01-18 04:34:29 +00:00
|
|
|
bool exporting;
|
2022-04-14 07:26:47 +00:00
|
|
|
bool stopExport;
|
2022-02-03 23:38:57 +00:00
|
|
|
bool halted;
|
2022-02-04 22:04:36 +00:00
|
|
|
bool forceMono;
|
2022-07-25 23:41:47 +00:00
|
|
|
bool clampSamples;
|
2022-02-16 21:11:15 +00:00
|
|
|
bool cmdStreamEnabled;
|
2022-03-24 02:38:28 +00:00
|
|
|
bool softLocked;
|
2022-03-24 04:56:59 +00:00
|
|
|
bool firstTick;
|
2022-03-31 08:33:05 +00:00
|
|
|
bool skipping;
|
2022-04-01 07:21:10 +00:00
|
|
|
bool midiIsDirect;
|
2023-12-17 20:30:51 +00:00
|
|
|
bool midiIsDirectProgram;
|
2022-04-15 10:37:23 +00:00
|
|
|
bool lowLatency;
|
2022-04-27 05:56:15 +00:00
|
|
|
bool systemsRegistered;
|
2022-04-30 06:37:37 +00:00
|
|
|
bool hasLoadedSomething;
|
2022-09-26 06:27:36 +00:00
|
|
|
bool midiOutClock;
|
2023-05-10 07:57:59 +00:00
|
|
|
bool midiOutTime;
|
2023-03-22 04:51:54 +00:00
|
|
|
bool midiOutProgramChange;
|
2022-09-26 06:27:36 +00:00
|
|
|
int midiOutMode;
|
2023-05-10 07:57:59 +00:00
|
|
|
int midiOutTimeRate;
|
2023-12-17 00:52:37 +00:00
|
|
|
float midiVolExp;
|
2022-03-24 03:05:09 +00:00
|
|
|
int softLockCount;
|
2023-02-05 07:56:39 +00:00
|
|
|
int subticks, ticks, curRow, curOrder, prevRow, prevOrder, remainingLoops, totalLoops, lastLoopPos, exportLoopCount, nextSpeed, elapsedBars, elapsedBeats, curSpeed;
|
2022-05-15 06:42:49 +00:00
|
|
|
size_t curSubSongIndex;
|
2023-01-03 06:09:46 +00:00
|
|
|
size_t bufferPos;
|
2022-03-16 04:30:15 +00:00
|
|
|
double divider;
|
|
|
|
int cycles;
|
|
|
|
double clockDrift;
|
2023-05-09 10:05:53 +00:00
|
|
|
int midiClockCycles;
|
|
|
|
double midiClockDrift;
|
|
|
|
int midiTimeCycles;
|
|
|
|
double midiTimeDrift;
|
2022-03-16 04:30:15 +00:00
|
|
|
int stepPlay;
|
2023-05-10 03:12:14 +00:00
|
|
|
int changeOrd, changePos, totalSeconds, totalTicks, totalTicksR, curMidiClock, curMidiTime, totalCmds, lastCmds, cmdsPerSecond, globalPitch;
|
2023-05-10 07:57:59 +00:00
|
|
|
int curMidiTimePiece, curMidiTimeCode;
|
2022-11-10 04:52:10 +00:00
|
|
|
unsigned char extValue, pendingMetroTick;
|
2023-02-05 07:56:39 +00:00
|
|
|
DivGroovePattern speeds;
|
2024-03-15 19:56:55 +00:00
|
|
|
short virtualTempoN, virtualTempoD;
|
2022-05-18 05:05:25 +00:00
|
|
|
short tempoAccum;
|
2021-05-19 07:05:24 +00:00
|
|
|
DivStatusView view;
|
2022-02-03 23:38:57 +00:00
|
|
|
DivHaltPositions haltOn;
|
2022-01-08 06:57:37 +00:00
|
|
|
DivChannelState chan[DIV_MAX_CHANS];
|
2021-06-09 08:33:03 +00:00
|
|
|
DivAudioEngines audioEngine;
|
2022-01-18 04:34:29 +00:00
|
|
|
DivAudioExportModes exportMode;
|
2024-05-11 19:25:53 +00:00
|
|
|
DivAudioExportFormats exportFormat;
|
2022-06-06 08:05:55 +00:00
|
|
|
double exportFadeOut;
|
2024-05-11 01:01:12 +00:00
|
|
|
int exportOutputs;
|
2024-05-11 19:25:53 +00:00
|
|
|
bool exportChannelMask[DIV_MAX_CHANS];
|
2022-09-29 06:24:26 +00:00
|
|
|
DivConfig conf;
|
2023-09-13 07:40:12 +00:00
|
|
|
FixedQueue<DivNoteEvent,8192> pendingNotes;
|
2022-09-10 06:39:42 +00:00
|
|
|
// bitfield
|
|
|
|
unsigned char walked[8192];
|
2022-01-08 06:57:37 +00:00
|
|
|
bool isMuted[DIV_MAX_CHANS];
|
2023-09-16 20:04:11 +00:00
|
|
|
std::mutex isBusy, saveLock, playPosLock;
|
2021-12-19 08:16:24 +00:00
|
|
|
String configPath;
|
2021-12-19 21:52:04 +00:00
|
|
|
String configFile;
|
2021-12-21 04:20:30 +00:00
|
|
|
String lastError;
|
2022-01-29 06:22:32 +00:00
|
|
|
String warnings;
|
2022-02-14 02:42:57 +00:00
|
|
|
std::vector<String> audioDevs;
|
2022-03-28 08:46:50 +00:00
|
|
|
std::vector<String> midiIns;
|
|
|
|
std::vector<String> midiOuts;
|
2022-02-16 21:11:15 +00:00
|
|
|
std::vector<DivCommand> cmdStream;
|
2022-04-27 09:48:56 +00:00
|
|
|
std::vector<DivInstrumentType> possibleInsTypes;
|
2023-05-21 09:39:36 +00:00
|
|
|
std::vector<DivEffectContainer> effectInst;
|
2023-02-05 03:46:23 +00:00
|
|
|
static DivSysDef* sysDefs[DIV_MAX_CHIP_DEFS];
|
|
|
|
static DivSystem sysFileMapFur[DIV_MAX_CHIP_DEFS];
|
|
|
|
static DivSystem sysFileMapDMF[DIV_MAX_CHIP_DEFS];
|
2021-05-11 20:08:08 +00:00
|
|
|
|
2023-03-26 23:48:16 +00:00
|
|
|
DivCSPlayer* cmdStreamInt;
|
|
|
|
|
2021-12-21 18:06:14 +00:00
|
|
|
struct SamplePreview {
|
2022-09-30 22:47:17 +00:00
|
|
|
double rate;
|
2021-12-21 18:06:14 +00:00
|
|
|
int sample;
|
2022-01-20 05:07:53 +00:00
|
|
|
int wave;
|
2022-08-11 13:21:54 +00:00
|
|
|
int pos;
|
2022-05-29 07:13:08 +00:00
|
|
|
int pBegin, pEnd;
|
2023-04-13 23:11:10 +00:00
|
|
|
int rateMul, posSub;
|
2022-08-11 13:21:54 +00:00
|
|
|
bool dir;
|
2021-12-21 18:06:14 +00:00
|
|
|
SamplePreview():
|
2022-09-30 22:47:17 +00:00
|
|
|
rate(0.0),
|
2021-12-21 18:06:14 +00:00
|
|
|
sample(-1),
|
2022-01-20 05:07:53 +00:00
|
|
|
wave(-1),
|
2022-05-29 07:13:08 +00:00
|
|
|
pos(0),
|
|
|
|
pBegin(-1),
|
2022-08-11 13:21:54 +00:00
|
|
|
pEnd(-1),
|
2023-04-13 23:11:10 +00:00
|
|
|
rateMul(1),
|
|
|
|
posSub(0),
|
2022-08-11 13:21:54 +00:00
|
|
|
dir(false) {}
|
2021-12-21 18:06:14 +00:00
|
|
|
} sPreview;
|
|
|
|
|
2021-05-16 08:03:23 +00:00
|
|
|
short vibTable[64];
|
2023-02-04 21:08:20 +00:00
|
|
|
short tremTable[128];
|
2022-03-25 07:52:41 +00:00
|
|
|
int reversePitchTable[4096];
|
|
|
|
int pitchTable[4096];
|
2023-05-21 09:39:36 +00:00
|
|
|
short effectSlotMap[4096];
|
2022-03-31 06:51:57 +00:00
|
|
|
int midiBaseChan;
|
2022-06-03 23:05:07 +00:00
|
|
|
bool midiPoly;
|
2024-01-25 20:29:37 +00:00
|
|
|
bool midiDebug;
|
2022-04-28 10:04:34 +00:00
|
|
|
size_t midiAgeCounter;
|
2021-05-14 19:16:48 +00:00
|
|
|
|
2022-01-08 21:03:32 +00:00
|
|
|
blip_buffer_t* samp_bb;
|
|
|
|
size_t samp_bbInLen;
|
|
|
|
int samp_temp, samp_prevSample;
|
|
|
|
short* samp_bbIn;
|
|
|
|
short* samp_bbOut;
|
2022-01-04 05:02:41 +00:00
|
|
|
unsigned char* metroTick;
|
|
|
|
size_t metroTickLen;
|
2023-01-12 08:31:43 +00:00
|
|
|
float* metroBuf;
|
|
|
|
size_t metroBufLen;
|
2022-01-04 05:29:59 +00:00
|
|
|
float metroFreq, metroPos;
|
2022-01-04 05:02:41 +00:00
|
|
|
float metroAmp;
|
2022-04-13 07:29:07 +00:00
|
|
|
float metroVol;
|
2023-09-11 21:04:19 +00:00
|
|
|
float previewVol;
|
2021-05-12 08:58:55 +00:00
|
|
|
|
2021-12-08 07:57:41 +00:00
|
|
|
size_t totalProcessed;
|
|
|
|
|
2023-09-06 19:23:47 +00:00
|
|
|
unsigned int renderPoolThreads;
|
2023-09-06 09:03:53 +00:00
|
|
|
DivWorkPool* renderPool;
|
|
|
|
|
2022-03-28 23:19:47 +00:00
|
|
|
// MIDI stuff
|
2022-04-01 06:50:01 +00:00
|
|
|
std::function<int(const TAMidiMessage&)> midiCallback=[](const TAMidiMessage&) -> int {return -2;};
|
2022-03-28 20:24:09 +00:00
|
|
|
|
2023-08-30 07:17:16 +00:00
|
|
|
void processRowPre(int i);
|
2021-05-16 08:03:23 +00:00
|
|
|
void processRow(int i, bool afterDelay);
|
2021-05-12 08:58:55 +00:00
|
|
|
void nextOrder();
|
|
|
|
void nextRow();
|
2023-07-09 22:41:24 +00:00
|
|
|
void performVGMWrite(SafeWriter* w, DivSystem sys, DivRegWrite& write, int streamOff, double* loopTimer, double* loopFreq, int* loopSample, bool* sampleDir, bool isSecond, int* pendingFreq, int* playingSample, int* setPos, unsigned int* sampleOff8, unsigned int* sampleLen8, size_t bankOffset, bool directStream);
|
2021-12-07 09:22:36 +00:00
|
|
|
// returns true if end of song.
|
2022-04-16 03:27:44 +00:00
|
|
|
bool nextTick(bool noAccum=false, bool inhibitLowLat=false);
|
2021-05-13 07:39:26 +00:00
|
|
|
bool perSystemEffect(int ch, unsigned char effect, unsigned char effectVal);
|
2021-05-15 08:13:21 +00:00
|
|
|
bool perSystemPostEffect(int ch, unsigned char effect, unsigned char effectVal);
|
2023-08-30 07:17:16 +00:00
|
|
|
bool perSystemPreEffect(int ch, unsigned char effect, unsigned char effectVal);
|
2022-01-08 21:03:32 +00:00
|
|
|
void recalcChans();
|
2021-12-20 02:11:23 +00:00
|
|
|
void reset();
|
2022-02-06 05:07:35 +00:00
|
|
|
void playSub(bool preserveDrift, int goalRow=0);
|
2023-05-10 08:30:05 +00:00
|
|
|
void runMidiClock(int totalCycles=1);
|
|
|
|
void runMidiTime(int totalCycles=1);
|
2023-08-21 19:14:09 +00:00
|
|
|
bool shallSwitchCores();
|
2021-05-12 08:58:55 +00:00
|
|
|
|
2023-03-13 19:17:05 +00:00
|
|
|
void testFunction();
|
|
|
|
|
2022-01-08 07:22:04 +00:00
|
|
|
bool loadDMF(unsigned char* file, size_t len);
|
2024-03-14 22:58:55 +00:00
|
|
|
bool loadFur(unsigned char* file, size_t len, int variantID=0);
|
2022-03-14 14:50:52 +00:00
|
|
|
bool loadMod(unsigned char* file, size_t len);
|
2023-03-13 00:11:05 +00:00
|
|
|
bool loadS3M(unsigned char* file, size_t len);
|
2024-06-21 02:41:57 +00:00
|
|
|
bool loadXM(unsigned char* file, size_t len);
|
|
|
|
bool loadIT(unsigned char* file, size_t len);
|
2024-03-16 08:45:35 +00:00
|
|
|
bool loadFTM(unsigned char* file, size_t len, bool dnft, bool dnftSig, bool eft);
|
2022-07-24 06:57:10 +00:00
|
|
|
bool loadFC(unsigned char* file, size_t len);
|
2024-04-13 06:43:37 +00:00
|
|
|
bool loadTFMv1(unsigned char* file, size_t len);
|
|
|
|
bool loadTFMv2(unsigned char* file, size_t len);
|
2022-01-08 07:22:04 +00:00
|
|
|
|
2022-04-03 18:53:34 +00:00
|
|
|
void loadDMP(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath);
|
|
|
|
void loadTFI(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath);
|
|
|
|
void loadVGI(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath);
|
|
|
|
void loadS3I(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath);
|
|
|
|
void loadSBI(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath);
|
2022-04-23 09:52:09 +00:00
|
|
|
void loadOPLI(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath);
|
|
|
|
void loadOPNI(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath);
|
|
|
|
void loadY12(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath);
|
2022-04-14 11:33:20 +00:00
|
|
|
void loadBNK(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath);
|
2022-04-25 12:27:21 +00:00
|
|
|
void loadGYB(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath);
|
2022-04-03 18:53:34 +00:00
|
|
|
void loadOPM(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath);
|
2022-04-10 12:16:33 +00:00
|
|
|
void loadFF(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath);
|
2022-05-09 07:49:56 +00:00
|
|
|
void loadWOPL(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath);
|
|
|
|
void loadWOPN(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath);
|
2022-04-03 18:53:34 +00:00
|
|
|
|
2022-05-13 03:15:03 +00:00
|
|
|
int loadSampleROM(String path, ssize_t expectedSize, unsigned char*& ret);
|
2022-05-11 21:39:36 +00:00
|
|
|
|
2022-01-17 06:20:02 +00:00
|
|
|
bool initAudioBackend();
|
2022-09-11 04:32:04 +00:00
|
|
|
bool deinitAudioBackend(bool dueToSwitchMaster=false);
|
2022-01-17 06:20:02 +00:00
|
|
|
|
2022-04-26 23:32:33 +00:00
|
|
|
void registerSystems();
|
2023-01-06 22:43:08 +00:00
|
|
|
void initSongWithDesc(const char* description, bool inBase64=true, bool oldVol=false);
|
2022-04-26 23:32:33 +00:00
|
|
|
|
2022-02-08 04:42:54 +00:00
|
|
|
void exchangeIns(int one, int two);
|
2023-07-26 22:58:57 +00:00
|
|
|
void exchangeWave(int one, int two);
|
|
|
|
void exchangeSample(int one, int two);
|
|
|
|
|
2022-04-28 08:36:15 +00:00
|
|
|
void swapChannels(int src, int dest);
|
|
|
|
void stompChannel(int ch);
|
2022-02-08 04:42:54 +00:00
|
|
|
|
2023-05-21 09:39:36 +00:00
|
|
|
// recalculate patchbay (UNSAFE)
|
|
|
|
void recalcPatchbay();
|
|
|
|
|
2022-05-15 06:42:49 +00:00
|
|
|
// change song (UNSAFE)
|
|
|
|
void changeSong(size_t songIndex);
|
|
|
|
|
2024-02-22 17:48:16 +00:00
|
|
|
void swapSystemUnsafe(int src, int dest, bool preserveOrder=true);
|
|
|
|
|
2023-05-16 08:04:16 +00:00
|
|
|
// move an asset
|
|
|
|
void moveAsset(std::vector<DivAssetDir>& dir, int before, int after);
|
|
|
|
|
2023-05-16 04:27:45 +00:00
|
|
|
// remove an asset
|
|
|
|
void removeAsset(std::vector<DivAssetDir>& dir, int entry);
|
|
|
|
|
2023-05-16 07:44:46 +00:00
|
|
|
// read/write asset dir
|
|
|
|
void putAssetDirData(SafeWriter* w, std::vector<DivAssetDir>& dir);
|
|
|
|
DivDataErrors readAssetDirData(SafeReader& reader, std::vector<DivAssetDir>& dir);
|
|
|
|
|
2023-03-13 19:17:05 +00:00
|
|
|
// add every export method here
|
|
|
|
friend class DivROMExport;
|
|
|
|
friend class DivExportAmigaValidation;
|
|
|
|
|
2021-05-11 20:08:08 +00:00
|
|
|
public:
|
2021-05-12 22:19:18 +00:00
|
|
|
DivSong song;
|
2022-05-15 06:42:49 +00:00
|
|
|
DivOrders* curOrders;
|
|
|
|
DivChannelData* curPat;
|
|
|
|
DivSubSong* curSubSong;
|
2022-04-25 23:23:12 +00:00
|
|
|
DivInstrument* tempIns;
|
2022-01-27 05:29:16 +00:00
|
|
|
DivSystem sysOfChan[DIV_MAX_CHANS];
|
|
|
|
int dispatchOfChan[DIV_MAX_CHANS];
|
|
|
|
int dispatchChanOfChan[DIV_MAX_CHANS];
|
2023-10-08 01:35:25 +00:00
|
|
|
int dispatchFirstChan[DIV_MAX_CHANS];
|
2022-02-10 08:15:39 +00:00
|
|
|
bool keyHit[DIV_MAX_CHANS];
|
2023-01-05 07:40:17 +00:00
|
|
|
float* oscBuf[DIV_MAX_OUTPUTS];
|
2022-01-27 22:49:00 +00:00
|
|
|
float oscSize;
|
2022-04-09 07:42:58 +00:00
|
|
|
int oscReadPos, oscWritePos;
|
2022-04-15 10:37:23 +00:00
|
|
|
int tickMult;
|
2023-07-06 23:29:29 +00:00
|
|
|
int lastNBIns, lastNBOuts, lastNBSize;
|
2022-05-03 07:29:12 +00:00
|
|
|
std::atomic<size_t> processTime;
|
2022-01-27 05:29:16 +00:00
|
|
|
|
2022-01-18 04:34:29 +00:00
|
|
|
void runExportThread();
|
2021-05-12 08:58:55 +00:00
|
|
|
void nextBuf(float** in, float** out, int inChans, int outChans, unsigned int size);
|
2022-04-21 07:24:06 +00:00
|
|
|
DivInstrument* getIns(int index, DivInstrumentType fallbackType=DIV_INS_FM);
|
2021-05-27 18:30:37 +00:00
|
|
|
DivWavetable* getWave(int index);
|
2022-02-25 03:52:20 +00:00
|
|
|
DivSample* getSample(int index);
|
2022-05-01 17:57:44 +00:00
|
|
|
DivDispatch* getDispatch(int index);
|
2022-09-30 05:26:54 +00:00
|
|
|
// parse old system setup description
|
|
|
|
String decodeSysDesc(String desc);
|
2021-12-24 23:23:01 +00:00
|
|
|
// start fresh
|
2022-11-13 21:57:47 +00:00
|
|
|
void createNew(const char* description, String sysName, bool inBase64=true);
|
2023-02-23 10:56:48 +00:00
|
|
|
void createNewFromDefaults();
|
2022-01-08 07:22:04 +00:00
|
|
|
// load a file.
|
2024-03-16 17:16:09 +00:00
|
|
|
bool load(unsigned char* f, size_t length, const char* nameHint=NULL);
|
2023-03-26 23:48:16 +00:00
|
|
|
// play a binary command stream.
|
|
|
|
bool playStream(unsigned char* f, size_t length);
|
2024-03-08 22:53:37 +00:00
|
|
|
// get the playing stream.
|
|
|
|
DivCSPlayer* getStreamPlayer();
|
|
|
|
// destroy command stream player.
|
|
|
|
bool killStream();
|
2021-05-11 20:08:08 +00:00
|
|
|
// save as .dmf.
|
2022-02-20 08:18:20 +00:00
|
|
|
SafeWriter* saveDMF(unsigned char version);
|
2022-01-08 07:22:04 +00:00
|
|
|
// save as .fur.
|
2022-03-21 19:11:28 +00:00
|
|
|
// if notPrimary is true then the song will not be altered
|
2023-05-26 06:29:49 +00:00
|
|
|
SafeWriter* saveFur(bool notPrimary=false, bool newPatternFormat=true);
|
2022-01-17 04:21:27 +00:00
|
|
|
// build a ROM file (TODO).
|
|
|
|
// specify system to build ROM for.
|
2023-03-13 19:17:05 +00:00
|
|
|
std::vector<DivROMExportOutput> buildROM(DivROMExportOptions sys);
|
2022-01-27 07:46:40 +00:00
|
|
|
// dump to VGM.
|
2023-02-09 00:25:03 +00:00
|
|
|
// set trailingTicks to:
|
|
|
|
// - 0 to add one tick of trailing
|
|
|
|
// - x to add x+1 ticks of trailing
|
|
|
|
// - -1 to auto-determine trailing
|
|
|
|
// - -2 to add a whole loop of trailing
|
|
|
|
SafeWriter* saveVGM(bool* sysToExport=NULL, bool loop=true, int version=0x171, bool patternHints=false, bool directStream=false, int trailingTicks=-1);
|
2022-05-26 05:24:21 +00:00
|
|
|
// dump to ZSM.
|
2023-08-11 20:03:37 +00:00
|
|
|
SafeWriter* saveZSM(unsigned int zsmrate=60, bool loop=true, bool optimize=true);
|
2024-06-22 10:31:58 +00:00
|
|
|
// dump to TIunA.
|
|
|
|
SafeWriter* saveTiuna(const bool* sysToExport, const char* baseLabel, int firstBankSize, int otherBankSize);
|
2022-08-03 23:44:45 +00:00
|
|
|
// dump command stream.
|
2024-03-09 23:20:17 +00:00
|
|
|
SafeWriter* saveCommand();
|
2023-12-04 09:17:30 +00:00
|
|
|
// export to text
|
|
|
|
SafeWriter* saveText(bool separatePatterns=true);
|
2022-01-17 04:32:13 +00:00
|
|
|
// export to an audio file
|
2024-05-11 01:01:12 +00:00
|
|
|
bool saveAudio(const char* path, DivAudioExportOptions options);
|
2022-01-17 06:20:02 +00:00
|
|
|
// wait for audio export to finish
|
|
|
|
void waitAudioFile();
|
2022-01-17 04:32:13 +00:00
|
|
|
// stop audio file export
|
|
|
|
bool haltAudioFile();
|
2023-08-21 19:14:09 +00:00
|
|
|
// return back to playback cores if necessary
|
|
|
|
void finishAudioFile();
|
2022-01-18 04:59:52 +00:00
|
|
|
// notify instrument parameter change
|
|
|
|
void notifyInsChange(int ins);
|
2022-01-18 05:25:10 +00:00
|
|
|
// notify wavetable change
|
|
|
|
void notifyWaveChange(int wave);
|
2021-05-11 20:08:08 +00:00
|
|
|
|
2023-03-26 23:48:16 +00:00
|
|
|
// dispatch a command
|
|
|
|
int dispatchCmd(DivCommand c);
|
|
|
|
|
2022-09-30 05:26:54 +00:00
|
|
|
// get system IDs
|
2022-11-13 20:41:40 +00:00
|
|
|
static DivSystem systemFromFileFur(unsigned char val);
|
|
|
|
static unsigned char systemToFileFur(DivSystem val);
|
|
|
|
static DivSystem systemFromFileDMF(unsigned char val);
|
|
|
|
static unsigned char systemToFileDMF(DivSystem val);
|
2022-09-30 05:26:54 +00:00
|
|
|
|
2022-11-13 21:25:50 +00:00
|
|
|
// convert old flags
|
|
|
|
static void convertOldFlags(unsigned int oldFlags, DivConfig& newFlags, DivSystem sys);
|
|
|
|
|
2023-05-16 09:29:26 +00:00
|
|
|
// check whether an asset directory is complete (UNSAFE)
|
|
|
|
void checkAssetDir(std::vector<DivAssetDir>& dir, size_t entries);
|
2022-11-13 21:25:50 +00:00
|
|
|
|
2022-07-19 22:01:19 +00:00
|
|
|
// benchmark (returns time in seconds)
|
|
|
|
double benchmarkPlayback();
|
|
|
|
double benchmarkSeek();
|
|
|
|
|
2022-04-02 02:40:32 +00:00
|
|
|
// returns the minimum VGM version which may carry the specified system, or 0 if none.
|
|
|
|
int minVGMVersion(DivSystem which);
|
2022-01-26 05:26:15 +00:00
|
|
|
|
2022-07-24 03:11:30 +00:00
|
|
|
// determine and setup config dir
|
|
|
|
void initConfDir();
|
|
|
|
|
2021-12-19 21:52:04 +00:00
|
|
|
// save config
|
|
|
|
bool saveConf();
|
|
|
|
|
|
|
|
// load config
|
|
|
|
bool loadConf();
|
|
|
|
|
|
|
|
// get a config value
|
|
|
|
bool getConfBool(String key, bool fallback);
|
|
|
|
int getConfInt(String key, int fallback);
|
|
|
|
float getConfFloat(String key, float fallback);
|
|
|
|
double getConfDouble(String key, double fallback);
|
|
|
|
String getConfString(String key, String fallback);
|
|
|
|
|
2023-12-21 23:14:28 +00:00
|
|
|
// get config object
|
|
|
|
DivConfig& getConfObject();
|
|
|
|
|
2021-12-19 21:52:04 +00:00
|
|
|
// set a config value
|
|
|
|
void setConf(String key, bool value);
|
|
|
|
void setConf(String key, int value);
|
|
|
|
void setConf(String key, float value);
|
|
|
|
void setConf(String key, double value);
|
2022-09-10 23:53:27 +00:00
|
|
|
void setConf(String key, const char* value);
|
2021-12-19 21:52:04 +00:00
|
|
|
void setConf(String key, String value);
|
|
|
|
|
2023-02-06 23:52:51 +00:00
|
|
|
// get whether config value exists
|
|
|
|
bool hasConf(String key);
|
|
|
|
|
2024-05-18 21:01:47 +00:00
|
|
|
// reset all settings
|
|
|
|
void factoryReset();
|
|
|
|
|
2022-01-28 05:55:51 +00:00
|
|
|
// calculate base frequency/period
|
2022-03-24 04:19:16 +00:00
|
|
|
double calcBaseFreq(double clock, double divider, int note, bool period);
|
2022-01-28 05:55:51 +00:00
|
|
|
|
2022-04-25 03:45:59 +00:00
|
|
|
// calculate base frequency in f-num/block format
|
2022-05-11 04:17:40 +00:00
|
|
|
int calcBaseFreqFNumBlock(double clock, double divider, int note, int bits);
|
2022-04-25 03:45:59 +00:00
|
|
|
|
2021-12-28 05:51:38 +00:00
|
|
|
// calculate frequency/period
|
2022-12-17 07:07:24 +00:00
|
|
|
int calcFreq(int base, int pitch, int arp, bool arpFixed, bool period=false, int octave=0, int pitch2=0, double clock=1.0, double divider=1.0, int blockBits=0);
|
2021-12-28 05:51:38 +00:00
|
|
|
|
2022-08-22 20:59:45 +00:00
|
|
|
// calculate arpeggio
|
|
|
|
int calcArp(int note, int arp, int offset=0);
|
|
|
|
|
2022-04-29 04:58:11 +00:00
|
|
|
// convert panning formats
|
|
|
|
int convertPanSplitToLinear(unsigned int val, unsigned char bits, int range);
|
2022-04-30 04:41:14 +00:00
|
|
|
int convertPanSplitToLinearLR(unsigned char left, unsigned char right, int range);
|
2022-04-29 04:58:11 +00:00
|
|
|
unsigned int convertPanLinearToSplit(int val, unsigned char bits, int range);
|
|
|
|
|
2022-01-25 20:06:29 +00:00
|
|
|
// find song loop position
|
2022-01-27 06:04:26 +00:00
|
|
|
void walkSong(int& loopOrder, int& loopRow, int& loopEnd);
|
2022-01-25 20:06:29 +00:00
|
|
|
|
2023-09-09 22:12:49 +00:00
|
|
|
// play (returns whether successful)
|
|
|
|
bool play();
|
2021-05-11 20:08:08 +00:00
|
|
|
|
2023-09-09 22:12:49 +00:00
|
|
|
// play to row (returns whether successful)
|
|
|
|
bool playToRow(int row);
|
2022-02-06 05:07:35 +00:00
|
|
|
|
2022-02-06 05:42:07 +00:00
|
|
|
// play by one row
|
|
|
|
void stepOne(int row);
|
|
|
|
|
2021-12-11 08:34:43 +00:00
|
|
|
// stop
|
|
|
|
void stop();
|
|
|
|
|
2021-12-15 05:37:27 +00:00
|
|
|
// reset playback state
|
2021-12-20 02:11:23 +00:00
|
|
|
void syncReset();
|
2021-12-15 05:37:27 +00:00
|
|
|
|
2022-09-30 22:47:17 +00:00
|
|
|
// sample preview query
|
|
|
|
bool isPreviewingSample();
|
2023-09-05 20:38:02 +00:00
|
|
|
int getSamplePreviewSample();
|
2022-09-30 22:47:17 +00:00
|
|
|
int getSamplePreviewPos();
|
|
|
|
double getSamplePreviewRate();
|
|
|
|
|
2023-09-11 21:04:19 +00:00
|
|
|
// set sample preview volume (1.0 = 100%)
|
|
|
|
void setSamplePreviewVol(float vol);
|
|
|
|
|
2021-12-21 18:06:14 +00:00
|
|
|
// trigger sample preview
|
2022-05-29 07:13:08 +00:00
|
|
|
void previewSample(int sample, int note=-1, int pStart=-1, int pEnd=-1);
|
2022-01-20 21:51:31 +00:00
|
|
|
void stopSamplePreview();
|
2021-12-21 18:06:14 +00:00
|
|
|
|
2022-01-20 05:07:53 +00:00
|
|
|
// trigger wave preview
|
|
|
|
void previewWave(int wave, int note);
|
|
|
|
void stopWavePreview();
|
|
|
|
|
2022-11-06 07:06:51 +00:00
|
|
|
// trigger sample preview
|
|
|
|
void previewSampleNoLock(int sample, int note=-1, int pStart=-1, int pEnd=-1);
|
|
|
|
void stopSamplePreviewNoLock();
|
|
|
|
|
|
|
|
// trigger wave preview
|
|
|
|
void previewWaveNoLock(int wave, int note);
|
|
|
|
void stopWavePreviewNoLock();
|
|
|
|
|
2021-12-19 08:16:24 +00:00
|
|
|
// get config path
|
|
|
|
String getConfigPath();
|
|
|
|
|
2021-12-12 09:21:09 +00:00
|
|
|
// get sys channel count
|
|
|
|
int getChannelCount(DivSystem sys);
|
|
|
|
|
2022-01-08 06:57:37 +00:00
|
|
|
// get channel count
|
2022-01-03 08:35:13 +00:00
|
|
|
int getTotalChannelCount();
|
|
|
|
|
2022-04-27 09:48:56 +00:00
|
|
|
// get instrument types available for use
|
|
|
|
std::vector<DivInstrumentType>& getPossibleInsTypes();
|
|
|
|
|
2022-01-20 18:48:20 +00:00
|
|
|
// get effect description
|
2022-04-19 23:44:05 +00:00
|
|
|
const char* getEffectDesc(unsigned char effect, int chan, bool notNull=false);
|
2022-01-20 18:48:20 +00:00
|
|
|
|
2021-12-23 22:09:33 +00:00
|
|
|
// get channel type
|
|
|
|
// - 0: FM
|
|
|
|
// - 1: pulse
|
|
|
|
// - 2: noise
|
|
|
|
// - 3: wave/other
|
|
|
|
// - 4: PCM
|
|
|
|
// - 5: FM operator
|
|
|
|
int getChannelType(int ch);
|
|
|
|
|
2022-01-16 03:11:40 +00:00
|
|
|
// get preferred instrument type
|
|
|
|
DivInstrumentType getPreferInsType(int ch);
|
|
|
|
|
2022-04-28 04:32:07 +00:00
|
|
|
// get alternate instrument type
|
|
|
|
DivInstrumentType getPreferInsSecondType(int ch);
|
|
|
|
|
2022-02-23 08:54:06 +00:00
|
|
|
// get song system name
|
2022-07-23 22:02:03 +00:00
|
|
|
String getSongSystemLegacyName(DivSong& ds, bool isMultiSystemAcceptable=true);
|
2022-02-23 08:54:06 +00:00
|
|
|
|
2021-12-15 22:32:08 +00:00
|
|
|
// get sys name
|
|
|
|
const char* getSystemName(DivSystem sys);
|
2022-01-25 23:46:27 +00:00
|
|
|
|
|
|
|
// get japanese system name
|
|
|
|
const char* getSystemNameJ(DivSystem sys);
|
2022-08-16 16:24:18 +00:00
|
|
|
|
2022-08-27 00:30:13 +00:00
|
|
|
// get sys definition
|
|
|
|
const DivSysDef* getSystemDef(DivSystem sys);
|
2022-08-28 15:54:20 +00:00
|
|
|
|
2021-12-23 23:04:44 +00:00
|
|
|
// convert sample rate format
|
|
|
|
int fileToDivRate(int frate);
|
|
|
|
int divToFileRate(int drate);
|
|
|
|
|
|
|
|
// get effective sample rate
|
|
|
|
int getEffectiveSampleRate(int rate);
|
2021-12-15 22:32:08 +00:00
|
|
|
|
2021-12-12 09:21:09 +00:00
|
|
|
// is FM system
|
|
|
|
bool isFMSystem(DivSystem sys);
|
|
|
|
|
2021-12-18 03:14:41 +00:00
|
|
|
// is STD system
|
|
|
|
bool isSTDSystem(DivSystem sys);
|
|
|
|
|
2021-12-18 08:25:42 +00:00
|
|
|
// is channel muted
|
|
|
|
bool isChannelMuted(int chan);
|
|
|
|
|
|
|
|
// toggle mute
|
|
|
|
void toggleMute(int chan);
|
|
|
|
|
|
|
|
// toggle solo
|
|
|
|
void toggleSolo(int chan);
|
|
|
|
|
|
|
|
// set mute status
|
|
|
|
void muteChannel(int chan, bool mute);
|
|
|
|
|
2022-02-11 23:20:39 +00:00
|
|
|
// unmute all
|
|
|
|
void unmuteAll();
|
|
|
|
|
2021-12-13 18:10:56 +00:00
|
|
|
// get channel name
|
|
|
|
const char* getChannelName(int chan);
|
|
|
|
|
2021-12-12 09:21:09 +00:00
|
|
|
// get channel short name
|
|
|
|
const char* getChannelShortName(int chan);
|
|
|
|
|
2021-12-13 22:09:46 +00:00
|
|
|
// get channel max volume
|
|
|
|
int getMaxVolumeChan(int chan);
|
|
|
|
|
2023-12-17 20:08:52 +00:00
|
|
|
// map MIDI velocity to volume
|
|
|
|
int mapVelocity(int ch, float vel);
|
|
|
|
|
2021-12-11 08:34:43 +00:00
|
|
|
// get current order
|
|
|
|
unsigned char getOrder();
|
|
|
|
|
2021-12-13 22:09:46 +00:00
|
|
|
// get current row
|
|
|
|
int getRow();
|
|
|
|
|
2023-09-16 20:04:11 +00:00
|
|
|
// synchronous get order/row
|
|
|
|
void getPlayPos(int& order, int& row);
|
|
|
|
|
2022-11-10 06:26:59 +00:00
|
|
|
// get beat/bar
|
|
|
|
int getElapsedBars();
|
|
|
|
int getElapsedBeats();
|
|
|
|
|
2022-05-15 06:42:49 +00:00
|
|
|
// get current subsong
|
|
|
|
size_t getCurrentSubSong();
|
|
|
|
|
2023-02-05 07:56:39 +00:00
|
|
|
// get speeds
|
|
|
|
const DivGroovePattern& getSpeeds();
|
2021-12-21 07:30:09 +00:00
|
|
|
|
|
|
|
// get Hz
|
2022-03-16 04:30:15 +00:00
|
|
|
float getHz();
|
2021-12-21 07:30:09 +00:00
|
|
|
|
2022-01-12 07:45:26 +00:00
|
|
|
// get current Hz
|
2022-03-16 04:30:15 +00:00
|
|
|
float getCurHz();
|
2022-01-12 07:45:26 +00:00
|
|
|
|
2024-03-15 19:56:55 +00:00
|
|
|
// get virtual tempo
|
|
|
|
short getVirtualTempoN();
|
|
|
|
short getVirtualTempoD();
|
|
|
|
|
|
|
|
// tell engine about virtual tempo changes
|
|
|
|
void virtualTempoChanged();
|
|
|
|
|
2021-12-21 07:30:09 +00:00
|
|
|
// get time
|
2022-01-12 07:45:26 +00:00
|
|
|
int getTotalTicks(); // 1/1000000th of a second
|
|
|
|
int getTotalSeconds();
|
2021-12-21 07:30:09 +00:00
|
|
|
|
2021-12-21 22:42:27 +00:00
|
|
|
// get repeat pattern
|
|
|
|
bool getRepeatPattern();
|
|
|
|
|
|
|
|
// set repeat pattern
|
|
|
|
void setRepeatPattern(bool value);
|
|
|
|
|
2021-12-21 00:46:49 +00:00
|
|
|
// has ext value
|
|
|
|
bool hasExtValue();
|
|
|
|
|
|
|
|
// get ext value
|
|
|
|
unsigned char getExtValue();
|
|
|
|
|
2023-10-17 19:11:35 +00:00
|
|
|
// dump song info to stdout
|
|
|
|
void dumpSongInfo();
|
|
|
|
|
2021-12-13 22:09:46 +00:00
|
|
|
// is playing
|
|
|
|
bool isPlaying();
|
2022-08-16 16:24:18 +00:00
|
|
|
|
2022-06-29 06:37:12 +00:00
|
|
|
// is running
|
|
|
|
bool isRunning();
|
2021-12-13 22:09:46 +00:00
|
|
|
|
2022-02-06 05:42:07 +00:00
|
|
|
// is stepping
|
|
|
|
bool isStepping();
|
|
|
|
|
2022-01-18 04:34:29 +00:00
|
|
|
// is exporting
|
|
|
|
bool isExporting();
|
|
|
|
|
2021-12-17 08:33:12 +00:00
|
|
|
// add instrument
|
2022-11-13 23:29:37 +00:00
|
|
|
int addInstrument(int refChan=0, DivInstrumentType fallbackType=DIV_INS_STD);
|
2021-12-17 08:33:12 +00:00
|
|
|
|
2022-04-03 06:56:49 +00:00
|
|
|
// add instrument from pointer
|
|
|
|
int addInstrumentPtr(DivInstrument* which);
|
|
|
|
|
|
|
|
// get instrument from file
|
|
|
|
// if the returned vector is empty then there was an error.
|
2023-09-16 23:15:03 +00:00
|
|
|
std::vector<DivInstrument*> instrumentFromFile(const char* path, bool loadAssets=true, bool readInsName=true);
|
2022-01-19 07:59:44 +00:00
|
|
|
|
2022-04-25 23:23:12 +00:00
|
|
|
// load temporary instrument
|
|
|
|
void loadTempIns(DivInstrument* which);
|
|
|
|
|
2021-12-17 08:33:12 +00:00
|
|
|
// delete instrument
|
|
|
|
void delInstrument(int index);
|
2023-09-08 07:52:15 +00:00
|
|
|
void delInstrumentUnsafe(int index);
|
2021-12-17 08:33:12 +00:00
|
|
|
|
|
|
|
// add wavetable
|
|
|
|
int addWave();
|
|
|
|
|
2022-08-13 09:17:32 +00:00
|
|
|
// add wavetable from pointer
|
|
|
|
int addWavePtr(DivWavetable* which);
|
|
|
|
|
|
|
|
// get wavetable from file
|
|
|
|
DivWavetable* waveFromFile(const char* path, bool loadRaw=true);
|
2022-01-11 21:25:55 +00:00
|
|
|
|
2021-12-17 08:33:12 +00:00
|
|
|
// delete wavetable
|
|
|
|
void delWave(int index);
|
2023-09-08 07:52:15 +00:00
|
|
|
void delWaveUnsafe(int index);
|
2021-12-17 08:33:12 +00:00
|
|
|
|
|
|
|
// add sample
|
|
|
|
int addSample();
|
|
|
|
|
2022-08-13 09:17:32 +00:00
|
|
|
// add sample from pointer
|
|
|
|
int addSamplePtr(DivSample* which);
|
|
|
|
|
|
|
|
// get sample from file
|
|
|
|
DivSample* sampleFromFile(const char* path);
|
|
|
|
|
|
|
|
// get raw sample
|
2024-01-17 02:12:34 +00:00
|
|
|
DivSample* sampleFromFileRaw(const char* path, DivSampleDepth depth, int channels, bool bigEndian, bool unsign, bool swapNibbles, int rate);
|
2021-12-17 08:33:12 +00:00
|
|
|
|
|
|
|
// delete sample
|
|
|
|
void delSample(int index);
|
2023-09-08 07:52:15 +00:00
|
|
|
void delSampleUnsafe(int index, bool render=true);
|
2021-12-17 08:33:12 +00:00
|
|
|
|
2021-12-22 22:39:16 +00:00
|
|
|
// add order
|
2023-02-06 00:06:13 +00:00
|
|
|
void addOrder(int pos, bool duplicate, bool where);
|
2021-12-22 22:39:16 +00:00
|
|
|
|
2022-02-12 08:59:05 +00:00
|
|
|
// deep clone orders
|
2023-02-06 00:06:13 +00:00
|
|
|
void deepCloneOrder(int pos, bool where);
|
2022-02-12 08:59:05 +00:00
|
|
|
|
2021-12-22 22:39:16 +00:00
|
|
|
// delete order
|
2023-02-06 00:06:13 +00:00
|
|
|
void deleteOrder(int pos);
|
2021-12-22 22:39:16 +00:00
|
|
|
|
|
|
|
// move order up
|
2023-02-06 00:06:13 +00:00
|
|
|
void moveOrderUp(int& pos);
|
2021-12-22 22:39:16 +00:00
|
|
|
|
|
|
|
// move order down
|
2023-02-06 00:06:13 +00:00
|
|
|
void moveOrderDown(int& pos);
|
2021-12-22 22:39:16 +00:00
|
|
|
|
2022-01-11 08:52:11 +00:00
|
|
|
// move thing up
|
|
|
|
bool moveInsUp(int which);
|
|
|
|
bool moveWaveUp(int which);
|
|
|
|
bool moveSampleUp(int which);
|
|
|
|
|
|
|
|
// move thing down
|
|
|
|
bool moveInsDown(int which);
|
|
|
|
bool moveWaveDown(int which);
|
|
|
|
bool moveSampleDown(int which);
|
|
|
|
|
2023-01-06 23:44:20 +00:00
|
|
|
// automatic patchbay
|
|
|
|
void autoPatchbay();
|
2023-01-10 20:58:15 +00:00
|
|
|
void autoPatchbayP();
|
2023-01-06 23:44:20 +00:00
|
|
|
|
2023-01-09 00:23:17 +00:00
|
|
|
// connect in patchbay
|
|
|
|
// returns false if connection already made
|
|
|
|
bool patchConnect(unsigned int src, unsigned int dest);
|
|
|
|
|
|
|
|
// disconnect in patchbay
|
|
|
|
// returns false if connection doesn't exist
|
|
|
|
bool patchDisconnect(unsigned int src, unsigned int dest);
|
|
|
|
|
2023-01-12 08:56:18 +00:00
|
|
|
// disconnect all in patchbay
|
|
|
|
void patchDisconnectAll(unsigned int portSet);
|
|
|
|
|
2021-12-28 23:23:57 +00:00
|
|
|
// play note
|
|
|
|
void noteOn(int chan, int ins, int note, int vol=-1);
|
|
|
|
|
|
|
|
// stop note
|
|
|
|
void noteOff(int chan);
|
|
|
|
|
2023-10-15 22:02:25 +00:00
|
|
|
// returns whether it could
|
|
|
|
bool autoNoteOn(int chan, int ins, int note, int vol=-1);
|
2022-03-31 06:51:57 +00:00
|
|
|
void autoNoteOff(int chan, int note, int vol=-1);
|
2022-04-16 05:10:52 +00:00
|
|
|
void autoNoteOffAll();
|
2022-08-16 16:24:18 +00:00
|
|
|
|
2022-06-03 23:05:07 +00:00
|
|
|
// set whether autoNoteIn is mono or poly
|
|
|
|
void setAutoNotePoly(bool poly);
|
2022-03-31 06:51:57 +00:00
|
|
|
|
2021-12-11 08:34:43 +00:00
|
|
|
// go to order
|
|
|
|
void setOrder(unsigned char order);
|
|
|
|
|
2022-09-30 07:14:54 +00:00
|
|
|
// update system flags
|
2023-10-11 07:48:39 +00:00
|
|
|
void updateSysFlags(int system, bool restart, bool render);
|
2022-01-28 23:12:56 +00:00
|
|
|
|
2021-12-15 22:32:08 +00:00
|
|
|
// set Hz
|
2023-06-11 23:57:32 +00:00
|
|
|
void setSongRate(float hz);
|
2021-12-15 22:32:08 +00:00
|
|
|
|
2021-12-07 09:22:36 +00:00
|
|
|
// set remaining loops. -1 means loop forever.
|
|
|
|
void setLoops(int loops);
|
|
|
|
|
2022-01-27 05:29:16 +00:00
|
|
|
// get channel state
|
|
|
|
DivChannelState* getChanState(int chan);
|
|
|
|
|
|
|
|
// get dispatch channel state
|
|
|
|
void* getDispatchChanState(int chan);
|
2022-08-16 16:24:18 +00:00
|
|
|
|
2023-10-08 01:35:25 +00:00
|
|
|
// get channel pairs
|
|
|
|
DivChannelPair getChanPaired(int chan);
|
|
|
|
|
2023-10-27 00:03:45 +00:00
|
|
|
// get channel mode hints
|
|
|
|
DivChannelModeHints getChanModeHints(int chan);
|
|
|
|
|
2022-02-22 03:31:27 +00:00
|
|
|
// get register pool
|
2022-02-22 09:01:57 +00:00
|
|
|
unsigned char* getRegisterPool(int sys, int& size, int& depth);
|
2022-01-27 05:29:16 +00:00
|
|
|
|
2022-04-30 08:58:30 +00:00
|
|
|
// get macro interpreter
|
|
|
|
DivMacroInt* getMacroInt(int chan);
|
|
|
|
|
2023-08-24 08:25:38 +00:00
|
|
|
// get channel panning
|
|
|
|
unsigned short getChanPan(int chan);
|
|
|
|
|
2023-03-19 08:12:08 +00:00
|
|
|
// get sample position
|
|
|
|
DivSamplePos getSamplePos(int chan);
|
|
|
|
|
2022-04-30 08:58:30 +00:00
|
|
|
// get osc buffer
|
|
|
|
DivDispatchOscBuffer* getOscBuffer(int chan);
|
|
|
|
|
2022-02-16 21:11:15 +00:00
|
|
|
// enable command stream dumping
|
|
|
|
void enableCommandStream(bool enable);
|
|
|
|
|
|
|
|
// get command stream
|
|
|
|
void getCommandStream(std::vector<DivCommand>& where);
|
|
|
|
|
2021-06-09 08:33:03 +00:00
|
|
|
// set the audio system.
|
|
|
|
void setAudio(DivAudioEngines which);
|
|
|
|
|
|
|
|
// set the view mode.
|
|
|
|
void setView(DivStatusView which);
|
|
|
|
|
2022-02-14 02:42:57 +00:00
|
|
|
// get available audio devices
|
|
|
|
std::vector<String>& getAudioDevices();
|
|
|
|
|
2022-03-28 08:46:50 +00:00
|
|
|
// get available MIDI inputs
|
|
|
|
std::vector<String>& getMidiIns();
|
|
|
|
|
|
|
|
// get available MIDI inputs
|
|
|
|
std::vector<String>& getMidiOuts();
|
|
|
|
|
2022-02-14 02:42:57 +00:00
|
|
|
// rescan audio devices
|
|
|
|
void rescanAudioDevices();
|
|
|
|
|
2023-12-27 07:53:09 +00:00
|
|
|
/** rescan midi devices */
|
|
|
|
void rescanMidiDevices();
|
|
|
|
|
2021-12-18 09:26:17 +00:00
|
|
|
// set the console mode.
|
2024-04-23 09:38:08 +00:00
|
|
|
void setConsoleMode(bool enable, bool statusOut=true);
|
2022-08-16 16:24:18 +00:00
|
|
|
|
2022-01-04 05:02:41 +00:00
|
|
|
// get metronome
|
|
|
|
bool getMetronome();
|
|
|
|
|
|
|
|
// set metronome
|
|
|
|
void setMetronome(bool enable);
|
2021-12-18 09:26:17 +00:00
|
|
|
|
2022-04-13 07:29:07 +00:00
|
|
|
// set metronome volume (1.0 = 100%)
|
|
|
|
void setMetronomeVol(float vol);
|
|
|
|
|
2023-01-03 06:09:46 +00:00
|
|
|
// get buffer position
|
|
|
|
int getBufferPos();
|
|
|
|
|
2022-02-03 23:38:57 +00:00
|
|
|
// halt now
|
|
|
|
void halt();
|
|
|
|
|
|
|
|
// resume from halt
|
|
|
|
void resume();
|
|
|
|
|
|
|
|
// halt on next something
|
|
|
|
void haltWhen(DivHaltPositions when);
|
|
|
|
|
|
|
|
// is engine halted
|
|
|
|
bool isHalted();
|
|
|
|
|
|
|
|
// get register cheatsheet
|
|
|
|
const char** getRegisterSheet(int sys);
|
|
|
|
|
2022-05-11 21:39:36 +00:00
|
|
|
// load sample ROMs
|
2022-05-13 03:15:03 +00:00
|
|
|
int loadSampleROMs();
|
2022-05-11 21:39:36 +00:00
|
|
|
|
2022-10-02 06:32:12 +00:00
|
|
|
// get the sample format mask
|
|
|
|
unsigned int getSampleFormatMask();
|
|
|
|
|
2022-03-19 08:42:44 +00:00
|
|
|
// UNSAFE render samples - only execute when locked
|
2023-09-08 06:19:48 +00:00
|
|
|
void renderSamples(int whichSample=-1);
|
2022-03-19 08:42:44 +00:00
|
|
|
|
2021-12-17 08:33:12 +00:00
|
|
|
// public render samples
|
2023-09-08 06:19:48 +00:00
|
|
|
// values for whichSample
|
|
|
|
// -2: don't render anything - just update chip sample memory
|
|
|
|
// -1: render all samples
|
|
|
|
// >=0: render specific sample
|
|
|
|
void renderSamplesP(int whichSample=-1);
|
2021-12-17 08:33:12 +00:00
|
|
|
|
2022-04-28 08:36:15 +00:00
|
|
|
// public swap channels
|
|
|
|
void swapChannelsP(int src, int dest);
|
|
|
|
|
2022-05-15 06:42:49 +00:00
|
|
|
// public change song
|
|
|
|
void changeSongP(size_t index);
|
|
|
|
|
|
|
|
// add subsong
|
|
|
|
int addSubSong();
|
|
|
|
|
2023-07-01 04:37:22 +00:00
|
|
|
// duplicate subsong
|
|
|
|
int duplicateSubSong(int index);
|
|
|
|
|
2022-05-15 06:42:49 +00:00
|
|
|
// remove subsong
|
|
|
|
bool removeSubSong(int index);
|
|
|
|
|
2022-06-01 23:50:30 +00:00
|
|
|
// move subsong
|
|
|
|
void moveSubSongUp(size_t index);
|
|
|
|
void moveSubSongDown(size_t index);
|
|
|
|
|
2022-05-17 06:42:21 +00:00
|
|
|
// clear all subsong data
|
|
|
|
void clearSubSongs();
|
|
|
|
|
2023-09-08 07:52:15 +00:00
|
|
|
// optimize assets
|
|
|
|
void delUnusedIns();
|
|
|
|
void delUnusedWaves();
|
|
|
|
void delUnusedSamples();
|
|
|
|
|
2021-12-18 03:14:41 +00:00
|
|
|
// change system
|
2024-02-21 20:55:15 +00:00
|
|
|
bool changeSystem(int index, DivSystem which, bool preserveOrder=true);
|
2022-01-08 21:03:32 +00:00
|
|
|
|
|
|
|
// add system
|
2022-01-08 23:18:23 +00:00
|
|
|
bool addSystem(DivSystem which);
|
2022-01-08 21:03:32 +00:00
|
|
|
|
2024-02-21 20:55:15 +00:00
|
|
|
// duplicate system
|
|
|
|
bool duplicateSystem(int index, bool pat=true, bool end=false);
|
|
|
|
|
2022-01-08 21:03:32 +00:00
|
|
|
// remove system
|
2022-04-28 08:36:15 +00:00
|
|
|
bool removeSystem(int index, bool preserveOrder=true);
|
2022-08-19 21:25:32 +00:00
|
|
|
|
|
|
|
// move system
|
|
|
|
bool swapSystem(int src, int dest, bool preserveOrder=true);
|
2022-08-28 15:54:20 +00:00
|
|
|
|
2023-05-21 09:39:36 +00:00
|
|
|
// add effect
|
|
|
|
bool addEffect(DivEffectType which);
|
|
|
|
|
|
|
|
// remove effect
|
|
|
|
bool removeEffect(int index);
|
|
|
|
|
2022-02-01 23:08:19 +00:00
|
|
|
// write to register on system
|
|
|
|
void poke(int sys, unsigned int addr, unsigned short val);
|
|
|
|
|
|
|
|
// write to register on system
|
|
|
|
void poke(int sys, std::vector<DivRegWrite>& wlist);
|
2021-12-18 03:14:41 +00:00
|
|
|
|
2021-12-21 04:20:30 +00:00
|
|
|
// get last error
|
|
|
|
String getLastError();
|
2022-01-29 06:22:32 +00:00
|
|
|
|
|
|
|
// get warnings
|
|
|
|
String getWarnings();
|
2022-08-16 16:24:18 +00:00
|
|
|
|
2022-10-02 06:02:01 +00:00
|
|
|
// get debug info
|
|
|
|
String getPlaybackDebugInfo();
|
|
|
|
|
2022-01-17 06:42:26 +00:00
|
|
|
// switch master
|
2022-12-14 22:18:19 +00:00
|
|
|
bool switchMaster(bool full=false);
|
2021-12-21 04:20:30 +00:00
|
|
|
|
2022-03-31 06:51:57 +00:00
|
|
|
// set MIDI base channel
|
|
|
|
void setMidiBaseChan(int chan);
|
|
|
|
|
2022-04-01 07:21:10 +00:00
|
|
|
// set MIDI direct channel map
|
|
|
|
void setMidiDirect(bool value);
|
|
|
|
|
2023-12-17 20:30:51 +00:00
|
|
|
// set MIDI direct program change
|
|
|
|
void setMidiDirectProgram(bool value);
|
|
|
|
|
2023-12-17 00:52:37 +00:00
|
|
|
// set MIDI volume curve exponent
|
|
|
|
void setMidiVolExp(float value);
|
|
|
|
|
2022-03-28 20:24:09 +00:00
|
|
|
// set MIDI input callback
|
2022-03-28 23:19:47 +00:00
|
|
|
// if the specified function returns -2, note feedback will be inhibited.
|
|
|
|
void setMidiCallback(std::function<int(const TAMidiMessage&)> what);
|
2022-03-28 20:24:09 +00:00
|
|
|
|
2022-05-08 07:01:32 +00:00
|
|
|
// send MIDI message
|
|
|
|
bool sendMidiMessage(TAMidiMessage& msg);
|
|
|
|
|
2024-01-25 20:29:37 +00:00
|
|
|
// enable MIDI debug
|
|
|
|
void setMidiDebug(bool enable);
|
|
|
|
|
2022-03-19 08:42:44 +00:00
|
|
|
// perform secure/sync operation
|
|
|
|
void synchronized(const std::function<void()>& what);
|
|
|
|
|
2022-03-21 21:17:51 +00:00
|
|
|
// perform secure/sync song operation
|
|
|
|
void lockSave(const std::function<void()>& what);
|
|
|
|
|
|
|
|
// perform secure/sync song operation (and lock audio too)
|
|
|
|
void lockEngine(const std::function<void()>& what);
|
|
|
|
|
2022-02-06 02:26:24 +00:00
|
|
|
// get audio desc want
|
|
|
|
TAAudioDesc& getAudioDescWant();
|
|
|
|
|
|
|
|
// get audio desc
|
|
|
|
TAAudioDesc& getAudioDescGot();
|
|
|
|
|
2021-12-13 19:51:35 +00:00
|
|
|
// init dispatch
|
2023-08-18 06:40:18 +00:00
|
|
|
void initDispatch(bool isRender=false);
|
2021-12-13 19:51:35 +00:00
|
|
|
|
|
|
|
// quit dispatch
|
|
|
|
void quitDispatch();
|
|
|
|
|
2024-06-01 21:36:00 +00:00
|
|
|
// pre-pre-initialize the engine.
|
|
|
|
bool prePreInit();
|
|
|
|
|
2023-10-16 19:55:01 +00:00
|
|
|
// pre-initialize the engine. returns whether Furnace should run in safe mode.
|
|
|
|
bool preInit(bool noSafeMode=true);
|
2022-12-18 06:55:21 +00:00
|
|
|
|
2022-04-26 23:32:33 +00:00
|
|
|
// initialize the engine.
|
2022-01-17 04:32:13 +00:00
|
|
|
bool init();
|
2021-05-12 08:58:55 +00:00
|
|
|
|
2023-10-16 19:55:01 +00:00
|
|
|
// confirm that the engine is running (delete safe mode file).
|
|
|
|
void everythingOK();
|
|
|
|
|
2021-12-13 22:09:46 +00:00
|
|
|
// terminate the engine.
|
2024-03-14 07:06:36 +00:00
|
|
|
bool quit(bool saveConfig=true);
|
2021-12-13 22:09:46 +00:00
|
|
|
|
2022-05-13 03:15:03 +00:00
|
|
|
unsigned char* yrw801ROM;
|
|
|
|
unsigned char* tg100ROM;
|
|
|
|
unsigned char* mu5ROM;
|
2022-05-11 21:39:36 +00:00
|
|
|
|
2021-05-12 08:58:55 +00:00
|
|
|
DivEngine():
|
2022-01-17 06:20:02 +00:00
|
|
|
output(NULL),
|
2022-01-18 04:34:29 +00:00
|
|
|
exportThread(NULL),
|
2021-05-12 08:58:55 +00:00
|
|
|
chans(0),
|
2024-06-01 21:36:00 +00:00
|
|
|
configLoaded(false),
|
2021-12-20 19:20:05 +00:00
|
|
|
active(false),
|
2022-01-17 06:42:26 +00:00
|
|
|
lowQuality(false),
|
2023-10-29 20:25:23 +00:00
|
|
|
dcHiPass(true),
|
2021-05-12 08:58:55 +00:00
|
|
|
playing(false),
|
2021-12-28 23:23:57 +00:00
|
|
|
freelance(false),
|
2022-09-29 05:27:40 +00:00
|
|
|
shallStop(false),
|
2022-10-22 08:46:39 +00:00
|
|
|
shallStopSched(false),
|
2021-12-07 09:22:36 +00:00
|
|
|
endOfSong(false),
|
2021-12-18 09:26:17 +00:00
|
|
|
consoleMode(false),
|
2024-04-23 09:38:08 +00:00
|
|
|
disableStatusOut(false),
|
2021-12-21 00:46:49 +00:00
|
|
|
extValuePresent(false),
|
2021-12-21 22:42:27 +00:00
|
|
|
repeatPattern(false),
|
2022-01-04 05:02:41 +00:00
|
|
|
metronome(false),
|
2022-01-18 04:34:29 +00:00
|
|
|
exporting(false),
|
2022-04-14 07:26:47 +00:00
|
|
|
stopExport(false),
|
2022-02-03 23:38:57 +00:00
|
|
|
halted(false),
|
2022-02-04 22:04:36 +00:00
|
|
|
forceMono(false),
|
2022-02-16 21:11:15 +00:00
|
|
|
cmdStreamEnabled(false),
|
2022-03-24 04:56:59 +00:00
|
|
|
softLocked(false),
|
|
|
|
firstTick(false),
|
2022-03-31 08:33:05 +00:00
|
|
|
skipping(false),
|
2022-04-01 07:21:10 +00:00
|
|
|
midiIsDirect(false),
|
2023-12-17 20:30:51 +00:00
|
|
|
midiIsDirectProgram(false),
|
2022-04-15 10:37:23 +00:00
|
|
|
lowLatency(false),
|
2022-04-27 05:56:15 +00:00
|
|
|
systemsRegistered(false),
|
2022-04-30 06:37:37 +00:00
|
|
|
hasLoadedSomething(false),
|
2022-09-26 06:27:36 +00:00
|
|
|
midiOutClock(false),
|
2023-05-10 07:57:59 +00:00
|
|
|
midiOutTime(false),
|
2023-03-22 04:51:54 +00:00
|
|
|
midiOutProgramChange(false),
|
2022-09-26 06:27:36 +00:00
|
|
|
midiOutMode(DIV_MIDI_MODE_NOTE),
|
2023-05-10 07:57:59 +00:00
|
|
|
midiOutTimeRate(0),
|
2023-12-17 00:52:37 +00:00
|
|
|
midiVolExp(2.0f), // General MIDI standard
|
2022-03-24 03:05:09 +00:00
|
|
|
softLockCount(0),
|
2022-04-15 10:37:23 +00:00
|
|
|
subticks(0),
|
2021-05-12 08:58:55 +00:00
|
|
|
ticks(0),
|
2021-12-05 21:11:12 +00:00
|
|
|
curRow(0),
|
2021-05-12 08:58:55 +00:00
|
|
|
curOrder(0),
|
2022-06-06 06:05:06 +00:00
|
|
|
prevRow(0),
|
|
|
|
prevOrder(0),
|
2021-12-07 09:22:36 +00:00
|
|
|
remainingLoops(-1),
|
2022-06-06 08:05:55 +00:00
|
|
|
totalLoops(0),
|
|
|
|
lastLoopPos(0),
|
|
|
|
exportLoopCount(0),
|
2021-12-08 05:27:20 +00:00
|
|
|
nextSpeed(3),
|
2022-11-10 06:26:59 +00:00
|
|
|
elapsedBars(0),
|
|
|
|
elapsedBeats(0),
|
2023-02-05 07:56:39 +00:00
|
|
|
curSpeed(0),
|
2022-05-15 06:42:49 +00:00
|
|
|
curSubSongIndex(0),
|
2023-01-03 06:09:46 +00:00
|
|
|
bufferPos(0),
|
2022-01-12 07:45:26 +00:00
|
|
|
divider(60),
|
2022-01-12 22:45:07 +00:00
|
|
|
cycles(0),
|
|
|
|
clockDrift(0),
|
2023-05-09 10:05:53 +00:00
|
|
|
midiClockCycles(0),
|
|
|
|
midiClockDrift(0),
|
|
|
|
midiTimeCycles(0),
|
|
|
|
midiTimeDrift(0),
|
2022-02-06 05:42:07 +00:00
|
|
|
stepPlay(0),
|
2021-05-12 10:22:01 +00:00
|
|
|
changeOrd(-1),
|
|
|
|
changePos(0),
|
2022-01-12 07:45:26 +00:00
|
|
|
totalSeconds(0),
|
2021-05-19 07:05:24 +00:00
|
|
|
totalTicks(0),
|
2022-01-12 07:45:26 +00:00
|
|
|
totalTicksR(0),
|
2023-05-10 03:12:14 +00:00
|
|
|
curMidiClock(0),
|
|
|
|
curMidiTime(0),
|
2021-05-19 07:05:24 +00:00
|
|
|
totalCmds(0),
|
|
|
|
lastCmds(0),
|
|
|
|
cmdsPerSecond(0),
|
2022-04-14 23:25:59 +00:00
|
|
|
globalPitch(0),
|
2023-05-10 07:57:59 +00:00
|
|
|
curMidiTimePiece(0),
|
|
|
|
curMidiTimeCode(0),
|
2021-12-21 00:46:49 +00:00
|
|
|
extValue(0),
|
2022-11-10 04:52:10 +00:00
|
|
|
pendingMetroTick(0),
|
2024-03-15 19:56:55 +00:00
|
|
|
virtualTempoN(150),
|
|
|
|
virtualTempoD(150),
|
2022-05-18 05:05:25 +00:00
|
|
|
tempoAccum(0),
|
2021-12-13 22:09:46 +00:00
|
|
|
view(DIV_STATUS_NOTHING),
|
2022-02-03 23:38:57 +00:00
|
|
|
haltOn(DIV_HALT_NONE),
|
2022-01-23 04:50:49 +00:00
|
|
|
audioEngine(DIV_AUDIO_NULL),
|
2022-04-14 23:25:59 +00:00
|
|
|
exportMode(DIV_EXPORT_MODE_ONE),
|
2024-05-11 19:25:53 +00:00
|
|
|
exportFormat(DIV_EXPORT_FORMAT_S16),
|
2022-06-06 08:05:55 +00:00
|
|
|
exportFadeOut(0.0),
|
2024-05-11 01:01:12 +00:00
|
|
|
exportOutputs(2),
|
2023-03-26 23:48:16 +00:00
|
|
|
cmdStreamInt(NULL),
|
2022-03-31 06:51:57 +00:00
|
|
|
midiBaseChan(0),
|
2022-06-03 23:05:07 +00:00
|
|
|
midiPoly(true),
|
2024-01-25 20:29:37 +00:00
|
|
|
midiDebug(false),
|
2022-04-28 10:04:34 +00:00
|
|
|
midiAgeCounter(0),
|
2022-04-14 23:25:59 +00:00
|
|
|
samp_bb(NULL),
|
2022-01-08 21:03:32 +00:00
|
|
|
samp_bbInLen(0),
|
|
|
|
samp_temp(0),
|
|
|
|
samp_prevSample(0),
|
2022-04-14 23:25:59 +00:00
|
|
|
samp_bbIn(NULL),
|
|
|
|
samp_bbOut(NULL),
|
2022-01-04 05:02:41 +00:00
|
|
|
metroTick(NULL),
|
|
|
|
metroTickLen(0),
|
2023-01-12 08:31:43 +00:00
|
|
|
metroBuf(NULL),
|
|
|
|
metroBufLen(0),
|
2022-01-04 05:29:59 +00:00
|
|
|
metroFreq(0),
|
2022-01-04 05:02:41 +00:00
|
|
|
metroPos(0),
|
|
|
|
metroAmp(0.0f),
|
2022-04-13 07:29:07 +00:00
|
|
|
metroVol(1.0f),
|
2023-09-11 21:04:19 +00:00
|
|
|
previewVol(1.0f),
|
2021-12-10 09:22:13 +00:00
|
|
|
totalProcessed(0),
|
2023-09-06 19:23:47 +00:00
|
|
|
renderPoolThreads(0),
|
|
|
|
renderPool(NULL),
|
2022-05-15 06:42:49 +00:00
|
|
|
curOrders(NULL),
|
|
|
|
curPat(NULL),
|
2022-04-25 23:23:12 +00:00
|
|
|
tempIns(NULL),
|
2022-01-27 22:49:00 +00:00
|
|
|
oscSize(1),
|
2022-04-09 07:42:58 +00:00
|
|
|
oscReadPos(0),
|
|
|
|
oscWritePos(0),
|
2022-05-03 07:29:12 +00:00
|
|
|
tickMult(1),
|
2023-07-06 23:29:29 +00:00
|
|
|
lastNBIns(0),
|
|
|
|
lastNBOuts(0),
|
|
|
|
lastNBSize(0),
|
2022-05-11 21:39:36 +00:00
|
|
|
processTime(0),
|
2022-05-13 03:15:03 +00:00
|
|
|
yrw801ROM(NULL),
|
|
|
|
tg100ROM(NULL),
|
|
|
|
mu5ROM(NULL) {
|
2022-04-14 23:25:59 +00:00
|
|
|
memset(isMuted,0,DIV_MAX_CHANS*sizeof(bool));
|
|
|
|
memset(keyHit,0,DIV_MAX_CHANS*sizeof(bool));
|
2023-10-08 01:35:25 +00:00
|
|
|
memset(dispatchFirstChan,0,DIV_MAX_CHANS*sizeof(int));
|
2022-04-14 23:25:59 +00:00
|
|
|
memset(dispatchChanOfChan,0,DIV_MAX_CHANS*sizeof(int));
|
|
|
|
memset(dispatchOfChan,0,DIV_MAX_CHANS*sizeof(int));
|
|
|
|
memset(sysOfChan,0,DIV_MAX_CHANS*sizeof(int));
|
|
|
|
memset(vibTable,0,64*sizeof(short));
|
2023-02-04 21:08:20 +00:00
|
|
|
memset(tremTable,0,128*sizeof(short));
|
2022-04-14 23:25:59 +00:00
|
|
|
memset(reversePitchTable,0,4096*sizeof(int));
|
|
|
|
memset(pitchTable,0,4096*sizeof(int));
|
2023-05-21 09:39:36 +00:00
|
|
|
memset(effectSlotMap,-1,4096*sizeof(short));
|
2023-02-05 03:46:23 +00:00
|
|
|
memset(sysDefs,0,DIV_MAX_CHIP_DEFS*sizeof(void*));
|
2022-09-10 06:39:42 +00:00
|
|
|
memset(walked,0,8192);
|
2023-01-05 07:40:17 +00:00
|
|
|
memset(oscBuf,0,DIV_MAX_OUTPUTS*(sizeof(float*)));
|
2024-05-11 19:25:53 +00:00
|
|
|
memset(exportChannelMask,1,DIV_MAX_CHANS*sizeof(bool));
|
2022-04-27 05:56:15 +00:00
|
|
|
|
2023-02-05 03:46:23 +00:00
|
|
|
for (int i=0; i<DIV_MAX_CHIP_DEFS; i++) {
|
2022-04-27 05:56:15 +00:00
|
|
|
sysFileMapFur[i]=DIV_SYSTEM_NULL;
|
|
|
|
sysFileMapDMF[i]=DIV_SYSTEM_NULL;
|
|
|
|
}
|
2022-05-15 06:42:49 +00:00
|
|
|
|
|
|
|
changeSong(0);
|
2022-04-14 23:25:59 +00:00
|
|
|
}
|
2021-05-11 20:08:08 +00:00
|
|
|
};
|
2021-05-12 10:22:01 +00:00
|
|
|
#endif
|