Merge branch 'master' into ZSMv1
This commit is contained in:
commit
ca4fb5b7d4
131 changed files with 2913 additions and 3348 deletions
|
|
@ -32,7 +32,8 @@
|
|||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <map>
|
||||
#include <queue>
|
||||
#include <unordered_map>
|
||||
#include <deque>
|
||||
|
||||
#define addWarning(x) \
|
||||
if (warnings.empty()) { \
|
||||
|
|
@ -45,8 +46,8 @@
|
|||
#define BUSY_BEGIN_SOFT softLocked=true; isBusy.lock();
|
||||
#define BUSY_END isBusy.unlock(); softLocked=false;
|
||||
|
||||
#define DIV_VERSION "dev106"
|
||||
#define DIV_ENGINE_VERSION 106
|
||||
#define DIV_VERSION "dev112"
|
||||
#define DIV_ENGINE_VERSION 112
|
||||
|
||||
// for imports
|
||||
#define DIV_VERSION_MOD 0xff01
|
||||
|
|
@ -194,7 +195,29 @@ struct DivDispatchContainer {
|
|||
dcOffCompensation(false) {}
|
||||
};
|
||||
|
||||
typedef std::function<bool(int,unsigned char,unsigned char)> EffectProcess;
|
||||
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;
|
||||
|
||||
struct DivSysDef {
|
||||
const char* name;
|
||||
|
|
@ -211,8 +234,8 @@ struct DivSysDef {
|
|||
// 0: primary
|
||||
// 1: alternate (usually PCM)
|
||||
DivInstrumentType chanInsType[DIV_MAX_CHANS][2];
|
||||
EffectProcess effectFunc;
|
||||
EffectProcess postEffectFunc;
|
||||
const EffectHandlerMap effectHandlers;
|
||||
const EffectHandlerMap postEffectHandlers;
|
||||
DivSysDef(
|
||||
const char* sysName, const char* sysNameJ, unsigned char fileID, unsigned char fileID_DMF, int chans,
|
||||
bool isFMChip, bool isSTDChip, unsigned int vgmVer, bool compound, const char* desc,
|
||||
|
|
@ -221,8 +244,8 @@ struct DivSysDef {
|
|||
std::initializer_list<int> chTypes,
|
||||
std::initializer_list<DivInstrumentType> chInsType1,
|
||||
std::initializer_list<DivInstrumentType> chInsType2={},
|
||||
EffectProcess fxHandler=[](int,unsigned char,unsigned char) -> bool {return false;},
|
||||
EffectProcess postFxHandler=[](int,unsigned char,unsigned char) -> bool {return false;}):
|
||||
const EffectHandlerMap fxHandlers_={},
|
||||
const EffectHandlerMap postFxHandlers_={}):
|
||||
name(sysName),
|
||||
nameJ(sysNameJ),
|
||||
description(desc),
|
||||
|
|
@ -233,8 +256,8 @@ struct DivSysDef {
|
|||
isSTD(isSTDChip),
|
||||
isCompound(compound),
|
||||
vgmVersion(vgmVer),
|
||||
effectFunc(fxHandler),
|
||||
postEffectFunc(postFxHandler) {
|
||||
effectHandlers(fxHandlers_),
|
||||
postEffectHandlers(postFxHandlers_) {
|
||||
memset(chanNames,0,DIV_MAX_CHANS*sizeof(void*));
|
||||
memset(chanShortNames,0,DIV_MAX_CHANS*sizeof(void*));
|
||||
memset(chanTypes,0,DIV_MAX_CHANS*sizeof(int));
|
||||
|
|
@ -334,7 +357,7 @@ class DivEngine {
|
|||
DivAudioExportModes exportMode;
|
||||
double exportFadeOut;
|
||||
std::map<String,String> conf;
|
||||
std::queue<DivNoteEvent> pendingNotes;
|
||||
std::deque<DivNoteEvent> pendingNotes;
|
||||
bool isMuted[DIV_MAX_CHANS];
|
||||
std::mutex isBusy, saveLock;
|
||||
String configPath;
|
||||
|
|
@ -533,6 +556,9 @@ class DivEngine {
|
|||
// calculate frequency/period
|
||||
int calcFreq(int base, int pitch, bool period=false, int octave=0, int pitch2=0, double clock=1.0, double divider=1.0, int blockBits=0);
|
||||
|
||||
// calculate arpeggio
|
||||
int calcArp(int note, int arp, int offset=0);
|
||||
|
||||
// convert panning formats
|
||||
int convertPanSplitToLinear(unsigned int val, unsigned char bits, int range);
|
||||
int convertPanSplitToLinearLR(unsigned char left, unsigned char right, int range);
|
||||
|
|
@ -603,6 +629,9 @@ class DivEngine {
|
|||
// get japanese system name
|
||||
const char* getSystemNameJ(DivSystem sys);
|
||||
|
||||
// get sys definition
|
||||
const DivSysDef* getSystemDef(DivSystem sys);
|
||||
|
||||
// convert sample rate format
|
||||
int fileToDivRate(int frate);
|
||||
int divToFileRate(int drate);
|
||||
|
|
@ -885,6 +914,9 @@ class DivEngine {
|
|||
// remove system
|
||||
bool removeSystem(int index, bool preserveOrder=true);
|
||||
|
||||
// move system
|
||||
bool swapSystem(int src, int dest, bool preserveOrder=true);
|
||||
|
||||
// write to register on system
|
||||
void poke(int sys, unsigned int addr, unsigned short val);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue