Merge branch 'master' of https://github.com/tildearrow/furnace into es5506_alt
* 'master' of https://github.com/tildearrow/furnace: maybe uninitialized GUI: prepare for a per-channel oscilloscope? GUI: add backdrop if system file picker is open GUI: add ability to customize startup system GUI: finally implement "don't scroll when moving c ursor" setting new panning effects (80/81/82) GUI: fix sample paste crash GUI: implement sample scroll with mouse wheel sysDef oopsie # Conflicts: # src/gui/guiConst.cpp
This commit is contained in:
commit
5414213710
52 changed files with 1021 additions and 342 deletions
|
|
@ -21,6 +21,7 @@
|
|||
#define _DISPATCH_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <vector>
|
||||
|
||||
#define ONE_SEMITONE 2200
|
||||
|
|
@ -49,7 +50,7 @@ enum DivDispatchCmds {
|
|||
DIV_CMD_GET_VOLMAX, // () -> volMax
|
||||
DIV_CMD_NOTE_PORTA, // (target, speed) -> 2 if target reached
|
||||
DIV_CMD_PITCH, // (pitch)
|
||||
DIV_CMD_PANNING, // (pan)
|
||||
DIV_CMD_PANNING, // (left, right)
|
||||
DIV_CMD_LEGATO, // (note)
|
||||
DIV_CMD_PRE_PORTA, // (inPorta, isPortaOrSlide)
|
||||
DIV_CMD_PRE_NOTE, // used in C64 (note)
|
||||
|
|
@ -214,6 +215,18 @@ struct DivRegWrite {
|
|||
addr(a), val(v) {}
|
||||
};
|
||||
|
||||
struct DivDispatchOscBuffer {
|
||||
unsigned int rate;
|
||||
unsigned short needle;
|
||||
short data[65536];
|
||||
|
||||
DivDispatchOscBuffer():
|
||||
rate(65536),
|
||||
needle(0) {
|
||||
memset(data,0,65536*sizeof(short));
|
||||
}
|
||||
};
|
||||
|
||||
class DivEngine;
|
||||
class DivMacroInt;
|
||||
|
||||
|
|
@ -277,6 +290,12 @@ class DivDispatch {
|
|||
* @return a pointer, or NULL.
|
||||
*/
|
||||
virtual DivMacroInt* getChanMacroInt(int chan);
|
||||
|
||||
/**
|
||||
* get an oscilloscope buffer for a channel.
|
||||
* @return a pointer to a DivDispatchOscBuffer, or NULL if not supported.
|
||||
*/
|
||||
virtual DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||
|
||||
/**
|
||||
* get the register pool of this dispatch.
|
||||
|
|
|
|||
|
|
@ -69,6 +69,12 @@ const char* DivEngine::getEffectDesc(unsigned char effect, int chan, bool notNul
|
|||
return "0Dxx: Jump to next pattern";
|
||||
case 0x0f:
|
||||
return "0Fxx: Set speed 2";
|
||||
case 0x80:
|
||||
return "80xx: Set panning (00: left; 80: center; FF: right)";
|
||||
case 0x81:
|
||||
return "81xx: Set panning (left channel)";
|
||||
case 0x82:
|
||||
return "82xx: Set panning (right channel)";
|
||||
case 0xc0: case 0xc1: case 0xc2: case 0xc3:
|
||||
return "Cxxx: Set tick rate (hz)";
|
||||
case 0xe0:
|
||||
|
|
@ -645,6 +651,101 @@ void DivEngine::renderSamples() {
|
|||
es5506MemLen=memPos+256;
|
||||
}
|
||||
|
||||
String DivEngine::encodeSysDesc(std::vector<int>& desc) {
|
||||
String ret;
|
||||
if (desc[0]!=0) {
|
||||
int index=0;
|
||||
for (size_t i=0; i<desc.size(); i+=4) {
|
||||
ret+=fmt::sprintf("%d %d %d %d ",systemToFileFur((DivSystem)desc[i]),desc[i+1],desc[i+2],desc[i+3]);
|
||||
index++;
|
||||
if (index>=32) break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::vector<int> DivEngine::decodeSysDesc(String desc) {
|
||||
std::vector<int> ret;
|
||||
bool hasVal=false;
|
||||
bool negative=false;
|
||||
int val=0;
|
||||
int curStage=0;
|
||||
int sysID=0;
|
||||
int sysVol=0;
|
||||
int sysPan=0;
|
||||
int sysFlags=0;
|
||||
desc+=' '; // ha
|
||||
for (char i: desc) {
|
||||
switch (i) {
|
||||
case ' ':
|
||||
if (hasVal) {
|
||||
if (negative) val=-val;
|
||||
switch (curStage) {
|
||||
case 0:
|
||||
sysID=val;
|
||||
curStage++;
|
||||
break;
|
||||
case 1:
|
||||
sysVol=val;
|
||||
curStage++;
|
||||
break;
|
||||
case 2:
|
||||
sysPan=val;
|
||||
curStage++;
|
||||
break;
|
||||
case 3:
|
||||
sysFlags=val;
|
||||
|
||||
if (systemFromFileFur(sysID)!=0) {
|
||||
if (sysVol<-128) sysVol=-128;
|
||||
if (sysVol>127) sysVol=127;
|
||||
if (sysPan<-128) sysPan=-128;
|
||||
if (sysPan>127) sysPan=127;
|
||||
ret.push_back(systemFromFileFur(sysID));
|
||||
ret.push_back(sysVol);
|
||||
ret.push_back(sysPan);
|
||||
ret.push_back(sysFlags);
|
||||
}
|
||||
|
||||
curStage=0;
|
||||
break;
|
||||
}
|
||||
hasVal=false;
|
||||
negative=false;
|
||||
val=0;
|
||||
}
|
||||
break;
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
val=(val*10)+(i-'0');
|
||||
hasVal=true;
|
||||
break;
|
||||
case '-':
|
||||
if (!hasVal) negative=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void DivEngine::initSongWithDesc(const int* description) {
|
||||
int chanCount=0;
|
||||
if (description[0]!=0) {
|
||||
int index=0;
|
||||
for (int i=0; description[i]; i+=4) {
|
||||
song.system[index]=(DivSystem)description[i];
|
||||
song.systemVol[index]=description[i+1];
|
||||
song.systemPan[index]=description[i+2];
|
||||
song.systemFlags[index]=description[i+3];
|
||||
index++;
|
||||
chanCount+=getChannelCount(song.system[index]);
|
||||
if (chanCount>=63) break;
|
||||
if (index>=32) break;
|
||||
}
|
||||
song.systemLen=index;
|
||||
}
|
||||
}
|
||||
|
||||
void DivEngine::createNew(const int* description) {
|
||||
quitDispatch();
|
||||
BUSY_BEGIN;
|
||||
|
|
@ -652,18 +753,7 @@ void DivEngine::createNew(const int* description) {
|
|||
song.unload();
|
||||
song=DivSong();
|
||||
if (description!=NULL) {
|
||||
if (description[0]!=0) {
|
||||
int index=0;
|
||||
for (int i=0; description[i]; i+=4) {
|
||||
song.system[index]=(DivSystem)description[i];
|
||||
song.systemVol[index]=description[i+1];
|
||||
song.systemPan[index]=description[i+2];
|
||||
song.systemFlags[index]=description[i+3];
|
||||
index++;
|
||||
if (index>=32) break;
|
||||
}
|
||||
song.systemLen=index;
|
||||
}
|
||||
initSongWithDesc(description);
|
||||
}
|
||||
recalcChans();
|
||||
renderSamples();
|
||||
|
|
@ -930,6 +1020,16 @@ unsigned char* DivEngine::getRegisterPool(int sys, int& size, int& depth) {
|
|||
return disCont[sys].dispatch->getRegisterPool();
|
||||
}
|
||||
|
||||
DivMacroInt* DivEngine::getMacroInt(int chan) {
|
||||
if (chan<0 || chan>=chans) return NULL;
|
||||
return disCont[dispatchOfChan[chan]].dispatch->getChanMacroInt(dispatchChanOfChan[chan]);
|
||||
}
|
||||
|
||||
DivDispatchOscBuffer* DivEngine::getOscBuffer(int chan) {
|
||||
if (chan<0 || chan>=chans) return NULL;
|
||||
return disCont[dispatchOfChan[chan]].dispatch->getOscBuffer(dispatchChanOfChan[chan]);
|
||||
}
|
||||
|
||||
void DivEngine::enableCommandStream(bool enable) {
|
||||
cmdStreamEnabled=enable;
|
||||
}
|
||||
|
|
@ -1083,6 +1183,10 @@ int DivEngine::convertPanSplitToLinear(unsigned int val, unsigned char bits, int
|
|||
return pan*range;
|
||||
}
|
||||
|
||||
int DivEngine::convertPanSplitToLinearLR(unsigned char left, unsigned char right, int range) {
|
||||
return convertPanSplitToLinear((left<<8)|right,8,range);
|
||||
}
|
||||
|
||||
unsigned int DivEngine::convertPanLinearToSplit(int val, unsigned char bits, int range) {
|
||||
if (val<0) val=0;
|
||||
if (val>range) val=range;
|
||||
|
|
@ -1231,6 +1335,8 @@ void DivEngine::recalcChans() {
|
|||
for (int i=0; i<DIV_INS_MAX; i++) {
|
||||
if (isInsTypePossible[i]) possibleInsTypes.push_back((DivInstrumentType)i);
|
||||
}
|
||||
|
||||
hasLoadedSomething=true;
|
||||
}
|
||||
|
||||
void DivEngine::reset() {
|
||||
|
|
@ -2700,6 +2806,18 @@ bool DivEngine::init() {
|
|||
|
||||
loadConf();
|
||||
|
||||
// set default system preset
|
||||
if (!hasLoadedSomething) {
|
||||
logI("setting");
|
||||
std::vector<int> preset=decodeSysDesc(getConfString("initialSys",""));
|
||||
logI("preset size %ld",preset.size());
|
||||
if (preset.size()>0 && (preset.size()&3)==0) {
|
||||
preset.push_back(0);
|
||||
initSongWithDesc(preset.data());
|
||||
}
|
||||
hasLoadedSomething=true;
|
||||
}
|
||||
|
||||
// init the rest of engine
|
||||
bool haveAudio=false;
|
||||
if (!initAudioBackend()) {
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ struct DivChannelState {
|
|||
int delayOrder, delayRow, retrigSpeed, retrigTick;
|
||||
int vibratoDepth, vibratoRate, vibratoPos, vibratoDir, vibratoFine;
|
||||
int tremoloDepth, tremoloRate, tremoloPos;
|
||||
unsigned char arp, arpStage, arpTicks;
|
||||
unsigned char arp, arpStage, arpTicks, panL, panR;
|
||||
bool doNote, legato, portaStop, keyOn, keyOff, nowYouCanStop, stopOnOff;
|
||||
bool arpYield, delayLocked, inPorta, scheduledSlideReset, shorthandPorta, noteOnInhibit, resetArp;
|
||||
|
||||
|
|
@ -119,6 +119,8 @@ struct DivChannelState {
|
|||
arp(0),
|
||||
arpStage(-1),
|
||||
arpTicks(1),
|
||||
panL(255),
|
||||
panR(255),
|
||||
doNote(false),
|
||||
legato(false),
|
||||
portaStop(false),
|
||||
|
|
@ -296,6 +298,7 @@ class DivEngine {
|
|||
bool midiIsDirect;
|
||||
bool lowLatency;
|
||||
bool systemsRegistered;
|
||||
bool hasLoadedSomething;
|
||||
int softLockCount;
|
||||
int subticks, ticks, curRow, curOrder, remainingLoops, nextSpeed;
|
||||
double divider;
|
||||
|
|
@ -398,6 +401,7 @@ class DivEngine {
|
|||
bool deinitAudioBackend();
|
||||
|
||||
void registerSystems();
|
||||
void initSongWithDesc(const int* description);
|
||||
|
||||
void exchangeIns(int one, int two);
|
||||
void swapChannels(int src, int dest);
|
||||
|
|
@ -420,6 +424,9 @@ class DivEngine {
|
|||
DivInstrument* getIns(int index, DivInstrumentType fallbackType=DIV_INS_FM);
|
||||
DivWavetable* getWave(int index);
|
||||
DivSample* getSample(int index);
|
||||
// parse system setup description
|
||||
String encodeSysDesc(std::vector<int>& desc);
|
||||
std::vector<int> decodeSysDesc(String desc);
|
||||
// start fresh
|
||||
void createNew(const int* description);
|
||||
// load a file.
|
||||
|
|
@ -479,6 +486,7 @@ class DivEngine {
|
|||
|
||||
// convert panning formats
|
||||
int convertPanSplitToLinear(unsigned int val, unsigned char bits, int range);
|
||||
int convertPanSplitToLinearLR(unsigned char left, unsigned char right, int range);
|
||||
unsigned int convertPanLinearToSplit(int val, unsigned char bits, int range);
|
||||
|
||||
// find song loop position
|
||||
|
|
@ -716,6 +724,12 @@ class DivEngine {
|
|||
// get register pool
|
||||
unsigned char* getRegisterPool(int sys, int& size, int& depth);
|
||||
|
||||
// get macro interpreter
|
||||
DivMacroInt* getMacroInt(int chan);
|
||||
|
||||
// get osc buffer
|
||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||
|
||||
// enable command stream dumping
|
||||
void enableCommandStream(bool enable);
|
||||
|
||||
|
|
@ -877,6 +891,7 @@ class DivEngine {
|
|||
midiIsDirect(false),
|
||||
lowLatency(false),
|
||||
systemsRegistered(false),
|
||||
hasLoadedSomething(false),
|
||||
softLockCount(0),
|
||||
subticks(0),
|
||||
ticks(0),
|
||||
|
|
|
|||
|
|
@ -33,6 +33,10 @@ DivMacroInt* DivDispatch::getChanMacroInt(int chan) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
DivDispatchOscBuffer* DivDispatch::getOscBuffer(int chan) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unsigned char* DivDispatch::getRegisterPool() {
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,12 +91,15 @@ const char* DivPlatformAmiga::getEffectName(unsigned char effect) {
|
|||
}
|
||||
|
||||
void DivPlatformAmiga::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||
static int outL, outR;
|
||||
static int outL, outR, output;
|
||||
for (size_t h=start; h<start+len; h++) {
|
||||
outL=0;
|
||||
outR=0;
|
||||
for (int i=0; i<4; i++) {
|
||||
if (!chan[i].active) continue;
|
||||
if (!chan[i].active) {
|
||||
oscBuf[i]->data[oscBuf[i]->needle++]=0;
|
||||
continue;
|
||||
}
|
||||
if (chan[i].useWave || (chan[i].sample>=0 && chan[i].sample<parent->song.sampleLen)) {
|
||||
chan[i].audSub-=AMIGA_DIVIDER;
|
||||
if (chan[i].audSub<0) {
|
||||
|
|
@ -139,13 +142,17 @@ void DivPlatformAmiga::acquire(short* bufL, short* bufR, size_t start, size_t le
|
|||
}
|
||||
}
|
||||
if (!isMuted[i]) {
|
||||
output=chan[i].audDat*chan[i].outVol;
|
||||
if (i==0 || i==3) {
|
||||
outL+=((chan[i].audDat*chan[i].outVol)*sep1)>>7;
|
||||
outR+=((chan[i].audDat*chan[i].outVol)*sep2)>>7;
|
||||
outL+=(output*sep1)>>7;
|
||||
outR+=(output*sep2)>>7;
|
||||
} else {
|
||||
outL+=((chan[i].audDat*chan[i].outVol)*sep2)>>7;
|
||||
outR+=((chan[i].audDat*chan[i].outVol)*sep1)>>7;
|
||||
outL+=(output*sep2)>>7;
|
||||
outR+=(output*sep1)>>7;
|
||||
}
|
||||
oscBuf[i]->data[oscBuf[i]->needle++]=output<<2;
|
||||
} else {
|
||||
oscBuf[i]->data[oscBuf[i]->needle++]=0;
|
||||
}
|
||||
}
|
||||
filter[0][0]+=(filtConst*(outL-filter[0][0]))>>12;
|
||||
|
|
@ -419,6 +426,10 @@ void* DivPlatformAmiga::getChanState(int ch) {
|
|||
return &chan[ch];
|
||||
}
|
||||
|
||||
DivDispatchOscBuffer* DivPlatformAmiga::getOscBuffer(int ch) {
|
||||
return oscBuf[ch];
|
||||
}
|
||||
|
||||
void DivPlatformAmiga::reset() {
|
||||
for (int i=0; i<4; i++) {
|
||||
chan[i]=DivPlatformAmiga::Channel();
|
||||
|
|
@ -469,6 +480,9 @@ void DivPlatformAmiga::setFlags(unsigned int flags) {
|
|||
chipClock=COLOR_NTSC;
|
||||
}
|
||||
rate=chipClock/AMIGA_DIVIDER;
|
||||
for (int i=0; i<4; i++) {
|
||||
oscBuf[i]->rate=rate;
|
||||
}
|
||||
sep1=((flags>>8)&127)+127;
|
||||
sep2=127-((flags>>8)&127);
|
||||
amigaModel=flags&2;
|
||||
|
|
@ -487,6 +501,7 @@ int DivPlatformAmiga::init(DivEngine* p, int channels, int sugRate, unsigned int
|
|||
dumpWrites=false;
|
||||
skipRegisterWrites=false;
|
||||
for (int i=0; i<4; i++) {
|
||||
oscBuf[i]=new DivDispatchOscBuffer;
|
||||
isMuted[i]=false;
|
||||
}
|
||||
setFlags(flags);
|
||||
|
|
@ -495,4 +510,7 @@ int DivPlatformAmiga::init(DivEngine* p, int channels, int sugRate, unsigned int
|
|||
}
|
||||
|
||||
void DivPlatformAmiga::quit() {
|
||||
for (int i=0; i<4; i++) {
|
||||
delete oscBuf[i];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ class DivPlatformAmiga: public DivDispatch {
|
|||
outVol(64) {}
|
||||
};
|
||||
Channel chan[4];
|
||||
DivDispatchOscBuffer* oscBuf[4];
|
||||
bool isMuted[4];
|
||||
bool bypassLimits;
|
||||
bool amigaModel;
|
||||
|
|
@ -91,6 +92,7 @@ class DivPlatformAmiga: public DivDispatch {
|
|||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
||||
int dispatch(DivCommand c);
|
||||
void* getChanState(int chan);
|
||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick(bool sysTick=true);
|
||||
|
|
|
|||
|
|
@ -543,8 +543,8 @@ int DivPlatformArcade::dispatch(DivCommand c) {
|
|||
chan[c.chan].ins=c.value;
|
||||
break;
|
||||
case DIV_CMD_PANNING: {
|
||||
chan[c.chan].chVolL=((c.value>>4)>0);
|
||||
chan[c.chan].chVolR=((c.value&15)>0);
|
||||
chan[c.chan].chVolL=(c.value>0);
|
||||
chan[c.chan].chVolR=(c.value2>0);
|
||||
if (isMuted[c.chan]) {
|
||||
rWrite(chanOffs[c.chan]+ADDR_LR_FB_ALG,(chan[c.chan].state.alg&7)|(chan[c.chan].state.fb<<3));
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -146,6 +146,12 @@ void DivPlatformAY8910::acquire(short* bufL, short* bufR, size_t start, size_t l
|
|||
bufR[i+start]=bufL[i+start];
|
||||
}
|
||||
}
|
||||
|
||||
for (int ch=0; ch<3; ch++) {
|
||||
for (size_t i=0; i<len; i++) {
|
||||
oscBuf[ch]->data[oscBuf[ch]->needle++]=ayBuf[ch][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DivPlatformAY8910::updateOutSel(bool immediate) {
|
||||
|
|
@ -500,6 +506,10 @@ void* DivPlatformAY8910::getChanState(int ch) {
|
|||
return &chan[ch];
|
||||
}
|
||||
|
||||
DivDispatchOscBuffer* DivPlatformAY8910::getOscBuffer(int ch) {
|
||||
return oscBuf[ch];
|
||||
}
|
||||
|
||||
unsigned char* DivPlatformAY8910::getRegisterPool() {
|
||||
return regPool;
|
||||
}
|
||||
|
|
@ -615,6 +625,9 @@ void DivPlatformAY8910::setFlags(unsigned int flags) {
|
|||
break;
|
||||
}
|
||||
rate=chipClock/8;
|
||||
for (int i=0; i<3; i++) {
|
||||
oscBuf[i]->rate=rate;
|
||||
}
|
||||
|
||||
if (ay!=NULL) delete ay;
|
||||
switch ((flags>>4)&3) {
|
||||
|
|
@ -650,6 +663,7 @@ int DivPlatformAY8910::init(DivEngine* p, int channels, int sugRate, unsigned in
|
|||
skipRegisterWrites=false;
|
||||
for (int i=0; i<3; i++) {
|
||||
isMuted[i]=false;
|
||||
oscBuf[i]=new DivDispatchOscBuffer;
|
||||
}
|
||||
ay=NULL;
|
||||
setFlags(flags);
|
||||
|
|
@ -660,6 +674,9 @@ int DivPlatformAY8910::init(DivEngine* p, int channels, int sugRate, unsigned in
|
|||
}
|
||||
|
||||
void DivPlatformAY8910::quit() {
|
||||
for (int i=0; i<3; i++) delete[] ayBuf[i];
|
||||
for (int i=0; i<3; i++) {
|
||||
delete oscBuf[i];
|
||||
delete[] ayBuf[i];
|
||||
}
|
||||
if (ay!=NULL) delete ay;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ class DivPlatformAY8910: public DivDispatch {
|
|||
};
|
||||
std::queue<QueuedWrite> writes;
|
||||
ay8910_device* ay;
|
||||
DivDispatchOscBuffer* oscBuf[3];
|
||||
unsigned char regPool[16];
|
||||
unsigned char lastBusy;
|
||||
|
||||
|
|
@ -90,6 +91,7 @@ class DivPlatformAY8910: public DivDispatch {
|
|||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
||||
int dispatch(DivCommand c);
|
||||
void* getChanState(int chan);
|
||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||
unsigned char* getRegisterPool();
|
||||
int getRegisterPoolSize();
|
||||
void flushWrites();
|
||||
|
|
|
|||
|
|
@ -25,12 +25,21 @@
|
|||
#define CHIP_FREQBASE 2048
|
||||
|
||||
void DivPlatformDummy::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||
int chanOut;
|
||||
for (size_t i=start; i<start+len; i++) {
|
||||
int out=0;
|
||||
for (unsigned char j=0; j<chans; j++) {
|
||||
if (chan[j].active) {
|
||||
if (!isMuted[j]) out+=(((signed short)chan[j].pos)*chan[j].amp*chan[j].vol)>>12;
|
||||
if (!isMuted[j]) {
|
||||
chanOut=(((signed short)chan[j].pos)*chan[j].amp*chan[j].vol)>>12;
|
||||
oscBuf[j]->data[oscBuf[j]->needle++]=chanOut;
|
||||
out+=chanOut;
|
||||
} else {
|
||||
oscBuf[j]->data[oscBuf[j]->needle++]=0;
|
||||
}
|
||||
chan[j].pos+=chan[j].freq;
|
||||
} else {
|
||||
oscBuf[j]->data[oscBuf[j]->needle++]=0;
|
||||
}
|
||||
}
|
||||
if (out<-32768) out=-32768;
|
||||
|
|
@ -61,6 +70,10 @@ void* DivPlatformDummy::getChanState(int ch) {
|
|||
return &chan[ch];
|
||||
}
|
||||
|
||||
DivDispatchOscBuffer* DivPlatformDummy::getOscBuffer(int ch) {
|
||||
return oscBuf[ch];
|
||||
}
|
||||
|
||||
int DivPlatformDummy::dispatch(DivCommand c) {
|
||||
switch (c.cmd) {
|
||||
case DIV_CMD_NOTE_ON:
|
||||
|
|
@ -131,6 +144,10 @@ int DivPlatformDummy::init(DivEngine* p, int channels, int sugRate, unsigned int
|
|||
skipRegisterWrites=false;
|
||||
for (int i=0; i<DIV_MAX_CHANS; i++) {
|
||||
isMuted[i]=false;
|
||||
if (i<channels) {
|
||||
oscBuf[i]=new DivDispatchOscBuffer;
|
||||
oscBuf[i]->rate=65536;
|
||||
}
|
||||
}
|
||||
rate=65536;
|
||||
chipClock=65536;
|
||||
|
|
@ -140,6 +157,9 @@ int DivPlatformDummy::init(DivEngine* p, int channels, int sugRate, unsigned int
|
|||
}
|
||||
|
||||
void DivPlatformDummy::quit() {
|
||||
for (int i=0; i<chans; i++) {
|
||||
delete oscBuf[i];
|
||||
}
|
||||
}
|
||||
|
||||
DivPlatformDummy::~DivPlatformDummy() {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ class DivPlatformDummy: public DivDispatch {
|
|||
Channel(): freq(0), baseFreq(0), pitch(0), pos(0), active(false), freqChanged(false), vol(0), amp(64) {}
|
||||
};
|
||||
Channel chan[128];
|
||||
DivDispatchOscBuffer* oscBuf[128];
|
||||
bool isMuted[128];
|
||||
unsigned char chans;
|
||||
friend void putDispatchChan(void*,int,int);
|
||||
|
|
@ -39,6 +40,7 @@ class DivPlatformDummy: public DivDispatch {
|
|||
void muteChannel(int ch, bool mute);
|
||||
int dispatch(DivCommand c);
|
||||
void* getChanState(int chan);
|
||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||
void reset();
|
||||
void tick(bool sysTick=true);
|
||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||
|
|
|
|||
|
|
@ -642,24 +642,21 @@ int DivPlatformES5506::dispatch(DivCommand c) {
|
|||
break;
|
||||
case DIV_CMD_PANNING: {
|
||||
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
|
||||
// 08LR, each nibble means volume multipler for each channels
|
||||
// Left volume
|
||||
const unsigned int lVol=(0xff*((c.value>>4)&0xf))/0xf;
|
||||
if (chan[c.chan].lVol!=lVol) {
|
||||
chan[c.chan].lVol=lVol;
|
||||
if (chan[c.chan].lVol!=(unsigned int)(c.value)) {
|
||||
chan[c.chan].lVol=c.value;
|
||||
if (!chan[c.chan].std.panL.has) {
|
||||
chan[c.chan].outLVol=(ins->es5506.lVol*lVol)/0xff;
|
||||
chan[c.chan].outLVol=(ins->es5506.lVol*c.value)/0xff;
|
||||
if (!isMuted[c.chan]) {
|
||||
chan[c.chan].volChanged.lVol=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Right volume
|
||||
const unsigned int rVol=(0xff*((c.value>>0)&0xf))/0xf;
|
||||
if (chan[c.chan].rVol!=rVol) {
|
||||
chan[c.chan].rVol=rVol;
|
||||
if (chan[c.chan].rVol!=(unsigned int)(c.value2)) {
|
||||
chan[c.chan].rVol=c.value2;
|
||||
if (!chan[c.chan].std.panR.has) {
|
||||
chan[c.chan].outRVol=(ins->es5506.rVol*rVol)/0xff;
|
||||
chan[c.chan].outRVol=(ins->es5506.rVol*c.value2)/0xff;
|
||||
if (!isMuted[c.chan]) {
|
||||
chan[c.chan].volChanged.rVol=1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -371,9 +371,11 @@ int DivPlatformGB::dispatch(DivCommand c) {
|
|||
break;
|
||||
case DIV_CMD_PANNING: {
|
||||
lastPan&=~(0x11<<c.chan);
|
||||
if (c.value==0) c.value=0x11;
|
||||
c.value=((c.value&15)>0)|(((c.value>>4)>0)<<4);
|
||||
lastPan|=c.value<<c.chan;
|
||||
int pan=0;
|
||||
if (c.value>0) pan|=0x10;
|
||||
if (c.value2>0) pan|=0x01;
|
||||
if (pan==0) pan=0x11;
|
||||
lastPan|=pan<<c.chan;
|
||||
rWrite(0x25,procMute());
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -635,10 +635,10 @@ int DivPlatformGenesis::dispatch(DivCommand c) {
|
|||
chan[c.chan].ins=c.value;
|
||||
break;
|
||||
case DIV_CMD_PANNING: {
|
||||
if (c.value==0) {
|
||||
if (c.value==0 && c.value2==0) {
|
||||
chan[c.chan].pan=3;
|
||||
} else {
|
||||
chan[c.chan].pan=((c.value&15)>0)|(((c.value>>4)>0)<<1);
|
||||
chan[c.chan].pan=(c.value2>0)|((c.value>0)<<1);
|
||||
}
|
||||
rWrite(chanOffs[c.chan]+ADDR_LRAF,(isMuted[c.chan]?0:(chan[c.chan].pan<<6))|(chan[c.chan].state.fms&7)|((chan[c.chan].state.ams&3)<<4));
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -107,10 +107,10 @@ int DivPlatformGenesisExt::dispatch(DivCommand c) {
|
|||
opChan[ch].ins=c.value;
|
||||
break;
|
||||
case DIV_CMD_PANNING: {
|
||||
if (c.value==0) {
|
||||
if (c.value==0 && c.value2==0) {
|
||||
opChan[ch].pan=3;
|
||||
} else {
|
||||
opChan[ch].pan=((c.value&15)>0)|(((c.value>>4)>0)<<1);
|
||||
opChan[ch].pan=(c.value2>0)|((c.value>0)<<1);
|
||||
}
|
||||
if (parent->song.sharedExtStat) {
|
||||
for (int i=0; i<4; i++) {
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ int DivPlatformLynx::dispatch(DivCommand c) {
|
|||
}
|
||||
break;
|
||||
case DIV_CMD_PANNING:
|
||||
chan[c.chan].pan=c.value;
|
||||
chan[c.chan].pan=(c.value&0xf0)|(c.value2>>4);
|
||||
WRITE_ATTEN(c.chan,chan[c.chan].pan);
|
||||
break;
|
||||
case DIV_CMD_GET_VOLUME:
|
||||
|
|
|
|||
|
|
@ -680,10 +680,10 @@ int DivPlatformOPL::dispatch(DivCommand c) {
|
|||
break;
|
||||
case DIV_CMD_PANNING: {
|
||||
if (oplType!=3) break;
|
||||
if (c.value==0) {
|
||||
if (c.value==0 && c.value2==0) {
|
||||
chan[c.chan].pan=3;
|
||||
} else {
|
||||
chan[c.chan].pan=(((c.value&15)>0)<<1)|((c.value>>4)>0);
|
||||
chan[c.chan].pan=(c.value2>0)|((c.value>0)<<1);
|
||||
}
|
||||
int ops=(slots[3][c.chan]!=255 && chan[c.chan].state.ops==4 && oplType==3)?4:2;
|
||||
if (isMuted[c.chan]) {
|
||||
|
|
|
|||
|
|
@ -94,7 +94,10 @@ void DivPlatformOPLL::acquire_nuked(short* bufL, short* bufR, size_t start, size
|
|||
OPLL_Clock(&fm,o);
|
||||
unsigned char nextOut=cycleMapOPLL[fm.cycles];
|
||||
if ((nextOut>=6 && properDrums) || !isMuted[nextOut]) {
|
||||
oscBuf[nextOut]->data[oscBuf[nextOut]->needle++]=(o[0]+o[1])<<6;
|
||||
os+=(o[0]+o[1]);
|
||||
} else {
|
||||
oscBuf[nextOut]->data[oscBuf[nextOut]->needle++]=0;
|
||||
}
|
||||
}
|
||||
os*=50;
|
||||
|
|
@ -731,6 +734,10 @@ void* DivPlatformOPLL::getChanState(int ch) {
|
|||
return &chan[ch];
|
||||
}
|
||||
|
||||
DivDispatchOscBuffer* DivPlatformOPLL::getOscBuffer(int ch) {
|
||||
return oscBuf[ch];
|
||||
}
|
||||
|
||||
unsigned char* DivPlatformOPLL::getRegisterPool() {
|
||||
return regPool;
|
||||
}
|
||||
|
|
@ -842,6 +849,9 @@ void DivPlatformOPLL::setFlags(unsigned int flags) {
|
|||
}
|
||||
rate=chipClock/36;
|
||||
patchSet=flags>>4;
|
||||
for (int i=0; i<11; i++) {
|
||||
oscBuf[i]->rate=rate/2;
|
||||
}
|
||||
}
|
||||
|
||||
int DivPlatformOPLL::init(DivEngine* p, int channels, int sugRate, unsigned int flags) {
|
||||
|
|
@ -851,14 +861,18 @@ int DivPlatformOPLL::init(DivEngine* p, int channels, int sugRate, unsigned int
|
|||
patchSet=0;
|
||||
for (int i=0; i<11; i++) {
|
||||
isMuted[i]=false;
|
||||
oscBuf[i]=new DivDispatchOscBuffer;
|
||||
}
|
||||
setFlags(flags);
|
||||
|
||||
reset();
|
||||
return 10;
|
||||
return 11;
|
||||
}
|
||||
|
||||
void DivPlatformOPLL::quit() {
|
||||
for (int i=0; i<11; i++) {
|
||||
delete oscBuf[i];
|
||||
}
|
||||
}
|
||||
|
||||
DivPlatformOPLL::~DivPlatformOPLL() {
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ class DivPlatformOPLL: public DivDispatch {
|
|||
};
|
||||
Channel chan[11];
|
||||
bool isMuted[11];
|
||||
DivDispatchOscBuffer* oscBuf[11];
|
||||
struct QueuedWrite {
|
||||
unsigned short addr;
|
||||
unsigned char val;
|
||||
|
|
@ -100,6 +101,7 @@ class DivPlatformOPLL: public DivDispatch {
|
|||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
||||
int dispatch(DivCommand c);
|
||||
void* getChanState(int chan);
|
||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||
unsigned char* getRegisterPool();
|
||||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
|
|
|
|||
|
|
@ -424,7 +424,7 @@ int DivPlatformPCE::dispatch(DivCommand c) {
|
|||
}
|
||||
break;
|
||||
case DIV_CMD_PANNING: {
|
||||
chan[c.chan].pan=c.value;
|
||||
chan[c.chan].pan=(c.value&0xf0)|(c.value2>>4);
|
||||
chWrite(c.chan,0x05,isMuted[c.chan]?0:chan[c.chan].pan);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -441,7 +441,7 @@ int DivPlatformQSound::dispatch(DivCommand c) {
|
|||
return chan[c.chan].outVol;
|
||||
break;
|
||||
case DIV_CMD_PANNING:
|
||||
chan[c.chan].panning=parent->convertPanSplitToLinear(c.value,4,32);
|
||||
chan[c.chan].panning=parent->convertPanSplitToLinearLR(c.value,c.value2,32);
|
||||
immWrite(Q1_PAN+c.chan,chan[c.chan].panning+0x110+(chan[c.chan].surround?0:0x30));
|
||||
break;
|
||||
case DIV_CMD_QSOUND_ECHO_LEVEL:
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ int DivPlatformSAA1099::dispatch(DivCommand c) {
|
|||
break;
|
||||
}
|
||||
case DIV_CMD_PANNING:
|
||||
chan[c.chan].pan=c.value;
|
||||
chan[c.chan].pan=(c.value&0xf0)|(c.value2>>4);
|
||||
if (isMuted[c.chan]) {
|
||||
rWrite(c.chan,0);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -46,9 +46,11 @@ void DivPlatformSegaPCM::acquire(short* bufL, short* bufR, size_t start, size_t
|
|||
DivSample* s=parent->getSample(chan[i].pcm.sample);
|
||||
if (s->samples<=0) {
|
||||
chan[i].pcm.sample=-1;
|
||||
oscBuf[i]->data[oscBuf[i]->needle++]=0;
|
||||
continue;
|
||||
}
|
||||
if (!isMuted[i]) {
|
||||
oscBuf[i]->data[oscBuf[i]->needle++]=s->data8[chan[i].pcm.pos>>8]*(chan[i].chVolL+chan[i].chVolR)>>1;
|
||||
pcmL+=(s->data8[chan[i].pcm.pos>>8]*chan[i].chVolL);
|
||||
pcmR+=(s->data8[chan[i].pcm.pos>>8]*chan[i].chVolR);
|
||||
}
|
||||
|
|
@ -60,6 +62,8 @@ void DivPlatformSegaPCM::acquire(short* bufL, short* bufR, size_t start, size_t
|
|||
chan[i].pcm.sample=-1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
oscBuf[i]->data[oscBuf[i]->needle++]=0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -268,8 +272,8 @@ int DivPlatformSegaPCM::dispatch(DivCommand c) {
|
|||
chan[c.chan].ins=c.value;
|
||||
break;
|
||||
case DIV_CMD_PANNING: {
|
||||
chan[c.chan].chVolL=(c.value>>4)|(((c.value>>4)>>1)<<4);
|
||||
chan[c.chan].chVolR=(c.value&15)|(((c.value&15)>>1)<<4);
|
||||
chan[c.chan].chVolL=c.value>>1;
|
||||
chan[c.chan].chVolR=c.value2>>1;
|
||||
if (dumpWrites) {
|
||||
addWrite(0x10002+(c.chan<<3),chan[c.chan].chVolL);
|
||||
addWrite(0x10003+(c.chan<<3),chan[c.chan].chVolR);
|
||||
|
|
@ -359,6 +363,10 @@ void* DivPlatformSegaPCM::getChanState(int ch) {
|
|||
return &chan[ch];
|
||||
}
|
||||
|
||||
DivDispatchOscBuffer* DivPlatformSegaPCM::getOscBuffer(int ch) {
|
||||
return oscBuf[ch];
|
||||
}
|
||||
|
||||
unsigned char* DivPlatformSegaPCM::getRegisterPool() {
|
||||
return regPool;
|
||||
}
|
||||
|
|
@ -408,6 +416,9 @@ void DivPlatformSegaPCM::reset() {
|
|||
void DivPlatformSegaPCM::setFlags(unsigned int flags) {
|
||||
chipClock=8000000.0;
|
||||
rate=31250;
|
||||
for (int i=0; i<16; i++) {
|
||||
oscBuf[i]->rate=rate;
|
||||
}
|
||||
}
|
||||
|
||||
bool DivPlatformSegaPCM::isStereo() {
|
||||
|
|
@ -420,6 +431,7 @@ int DivPlatformSegaPCM::init(DivEngine* p, int channels, int sugRate, unsigned i
|
|||
skipRegisterWrites=false;
|
||||
for (int i=0; i<16; i++) {
|
||||
isMuted[i]=false;
|
||||
oscBuf[i]=new DivDispatchOscBuffer;
|
||||
}
|
||||
setFlags(flags);
|
||||
reset();
|
||||
|
|
@ -428,6 +440,9 @@ int DivPlatformSegaPCM::init(DivEngine* p, int channels, int sugRate, unsigned i
|
|||
}
|
||||
|
||||
void DivPlatformSegaPCM::quit() {
|
||||
for (int i=0; i<16; i++) {
|
||||
delete oscBuf[i];
|
||||
}
|
||||
}
|
||||
|
||||
DivPlatformSegaPCM::~DivPlatformSegaPCM() {
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ class DivPlatformSegaPCM: public DivDispatch {
|
|||
Channel(): freqH(0), freqL(0), freq(0), baseFreq(0), pitch(0), pitch2(0), note(0), ins(-1), active(false), insChanged(true), freqChanged(false), keyOn(false), keyOff(false), inPorta(false), portaPause(false), furnacePCM(false), vol(0), outVol(0), chVolL(127), chVolR(127) {}
|
||||
};
|
||||
Channel chan[16];
|
||||
DivDispatchOscBuffer* oscBuf[16];
|
||||
struct QueuedWrite {
|
||||
unsigned short addr;
|
||||
unsigned char val;
|
||||
|
|
@ -77,6 +78,7 @@ class DivPlatformSegaPCM: public DivDispatch {
|
|||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
||||
int dispatch(DivCommand c);
|
||||
void* getChanState(int chan);
|
||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||
unsigned char* getRegisterPool();
|
||||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
|
|
|
|||
|
|
@ -270,7 +270,7 @@ int DivPlatformSoundUnit::dispatch(DivCommand c) {
|
|||
break;
|
||||
}
|
||||
case DIV_CMD_PANNING: {
|
||||
chan[c.chan].pan=parent->convertPanSplitToLinear(c.value,4,254)-127;
|
||||
chan[c.chan].pan=parent->convertPanSplitToLinearLR(c.value,c.value2,254)-127;
|
||||
chWrite(c.chan,0x03,chan[c.chan].pan);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -412,7 +412,7 @@ int DivPlatformSwan::dispatch(DivCommand c) {
|
|||
}
|
||||
break;
|
||||
case DIV_CMD_PANNING: {
|
||||
chan[c.chan].pan=c.value;
|
||||
chan[c.chan].pan=(c.value&0xf0)|(c.value2>>4);
|
||||
calcAndWriteOutVol(c.chan,chan[c.chan].std.vol.will?chan[c.chan].std.vol.val:15);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -525,8 +525,8 @@ int DivPlatformTX81Z::dispatch(DivCommand c) {
|
|||
chan[c.chan].ins=c.value;
|
||||
break;
|
||||
case DIV_CMD_PANNING: {
|
||||
chan[c.chan].chVolL=((c.value>>4)>0);
|
||||
chan[c.chan].chVolR=((c.value&15)>0);
|
||||
chan[c.chan].chVolL=(c.value>0);
|
||||
chan[c.chan].chVolR=(c.value2>0);
|
||||
chan[c.chan].freqChanged=true;
|
||||
/*
|
||||
if (isMuted[c.chan]) {
|
||||
|
|
|
|||
|
|
@ -345,8 +345,8 @@ int DivPlatformVERA::dispatch(DivCommand c) {
|
|||
break;
|
||||
case DIV_CMD_PANNING: {
|
||||
tmp=0;
|
||||
tmp|=(c.value&0x10)?1:0;
|
||||
tmp|=(c.value&0x01)?2:0;
|
||||
tmp|=(c.value>0)?1:0;
|
||||
tmp|=(c.value2>0)?2:0;
|
||||
chan[c.chan].pan=tmp&3;
|
||||
if (c.chan<16) {
|
||||
rWriteHi(c.chan,2,isMuted[c.chan]?0:chan[c.chan].pan);
|
||||
|
|
|
|||
|
|
@ -694,8 +694,9 @@ int DivPlatformX1_010::dispatch(DivCommand c) {
|
|||
break;
|
||||
case DIV_CMD_PANNING: {
|
||||
if (!stereo) break;
|
||||
if (chan[c.chan].pan!=c.value) {
|
||||
chan[c.chan].pan=c.value;
|
||||
unsigned char newPan=(c.value&0xf0)|(c.value2>>4);
|
||||
if (chan[c.chan].pan!=newPan) {
|
||||
chan[c.chan].pan=newPan;
|
||||
if (!isMuted[c.chan]) {
|
||||
chan[c.chan].envChanged=true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -839,10 +839,10 @@ int DivPlatformYM2610::dispatch(DivCommand c) {
|
|||
chan[c.chan].ins=c.value;
|
||||
break;
|
||||
case DIV_CMD_PANNING: {
|
||||
if (c.value==0) {
|
||||
if (c.value==0 && c.value2==0) {
|
||||
chan[c.chan].pan=3;
|
||||
} else {
|
||||
chan[c.chan].pan=((c.value&15)>0)|(((c.value>>4)>0)<<1);
|
||||
chan[c.chan].pan=(c.value2>0)|((c.value>0)<<1);
|
||||
}
|
||||
if (c.chan>12) {
|
||||
immWrite(0x11,isMuted[c.chan]?0:(chan[c.chan].pan<<6));
|
||||
|
|
|
|||
|
|
@ -902,10 +902,10 @@ int DivPlatformYM2610B::dispatch(DivCommand c) {
|
|||
chan[c.chan].ins=c.value;
|
||||
break;
|
||||
case DIV_CMD_PANNING: {
|
||||
if (c.value==0) {
|
||||
if (c.value==0 && c.value2==0) {
|
||||
chan[c.chan].pan=3;
|
||||
} else {
|
||||
chan[c.chan].pan=((c.value&15)>0)|(((c.value>>4)>0)<<1);
|
||||
chan[c.chan].pan=(c.value2>0)|((c.value>0)<<1);
|
||||
}
|
||||
if (c.chan>14) {
|
||||
immWrite(0x11,isMuted[c.chan]?0:(chan[c.chan].pan<<6));
|
||||
|
|
|
|||
|
|
@ -99,10 +99,10 @@ int DivPlatformYM2610BExt::dispatch(DivCommand c) {
|
|||
opChan[ch].ins=c.value;
|
||||
break;
|
||||
case DIV_CMD_PANNING: {
|
||||
if (c.value==0) {
|
||||
if (c.value==0 && c.value2==0) {
|
||||
opChan[ch].pan=3;
|
||||
} else {
|
||||
opChan[ch].pan=((c.value&15)>0)|(((c.value>>4)>0)<<1);
|
||||
opChan[ch].pan=(c.value2>0)|((c.value>0)<<1);
|
||||
}
|
||||
DivInstrument* ins=parent->getIns(opChan[ch].ins,DIV_INS_FM);
|
||||
if (parent->song.sharedExtStat) {
|
||||
|
|
|
|||
|
|
@ -99,10 +99,10 @@ int DivPlatformYM2610Ext::dispatch(DivCommand c) {
|
|||
opChan[ch].ins=c.value;
|
||||
break;
|
||||
case DIV_CMD_PANNING: {
|
||||
if (c.value==0) {
|
||||
if (c.value==0 && c.value2==0) {
|
||||
opChan[ch].pan=3;
|
||||
} else {
|
||||
opChan[ch].pan=((c.value&15)>0)|(((c.value>>4)>0)<<1);
|
||||
opChan[ch].pan=(c.value2>0)|((c.value>0)<<1);
|
||||
}
|
||||
DivInstrument* ins=parent->getIns(opChan[ch].ins,DIV_INS_FM);
|
||||
if (parent->song.sharedExtStat) {
|
||||
|
|
|
|||
|
|
@ -1070,6 +1070,7 @@ void DivEngine::processRow(int i, bool afterDelay) {
|
|||
|
||||
short lastSlide=-1;
|
||||
bool calledPorta=false;
|
||||
bool panChanged=false;
|
||||
|
||||
// effects
|
||||
for (int j=0; j<song.pat[i].effectCols; j++) {
|
||||
|
|
@ -1098,8 +1099,25 @@ void DivEngine::processRow(int i, bool afterDelay) {
|
|||
changePos=effectVal;
|
||||
}
|
||||
break;
|
||||
case 0x08: // panning
|
||||
dispatchCmd(DivCommand(DIV_CMD_PANNING,i,effectVal));
|
||||
case 0x08: // panning (split 4-bit)
|
||||
chan[i].panL=(effectVal>>4)|(effectVal&0xf0);
|
||||
chan[i].panR=(effectVal&15)|((effectVal&15)<<4);
|
||||
panChanged=true;
|
||||
break;
|
||||
case 0x80: { // panning (linear)
|
||||
unsigned short pan=convertPanLinearToSplit(effectVal,8,255);
|
||||
chan[i].panL=pan>>8;
|
||||
chan[i].panR=pan&0xff;
|
||||
panChanged=true;
|
||||
break;
|
||||
}
|
||||
case 0x81: // panning left (split 8-bit)
|
||||
chan[i].panL=effectVal;
|
||||
panChanged=true;
|
||||
break;
|
||||
case 0x82: // panning right (split 8-bit)
|
||||
chan[i].panR=effectVal;
|
||||
panChanged=true;
|
||||
break;
|
||||
case 0x01: // ramp up
|
||||
if (song.ignoreDuplicateSlides && (lastSlide==0x01 || lastSlide==0x1337)) break;
|
||||
|
|
@ -1354,6 +1372,10 @@ void DivEngine::processRow(int i, bool afterDelay) {
|
|||
}
|
||||
}
|
||||
|
||||
if (panChanged) {
|
||||
dispatchCmd(DivCommand(DIV_CMD_PANNING,i,chan[i].panL,chan[i].panR));
|
||||
}
|
||||
|
||||
if (insChanged && (chan[i].inPorta || calledPorta) && song.newInsTriggersInPorta) {
|
||||
dispatchCmd(DivCommand(DIV_CMD_NOTE_ON,i,DIV_NOTE_NULL));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -312,46 +312,8 @@ DivInstrumentType DivEngine::getPreferInsSecondType(int chan) {
|
|||
}
|
||||
|
||||
int DivEngine::minVGMVersion(DivSystem which) {
|
||||
switch (which) {
|
||||
case DIV_SYSTEM_YM2612:
|
||||
case DIV_SYSTEM_YM2612_EXT:
|
||||
case DIV_SYSTEM_SMS:
|
||||
case DIV_SYSTEM_OPLL:
|
||||
case DIV_SYSTEM_OPLL_DRUMS:
|
||||
case DIV_SYSTEM_VRC7:
|
||||
case DIV_SYSTEM_YM2151:
|
||||
return 0x150; // due to usage of data blocks
|
||||
case DIV_SYSTEM_SEGAPCM:
|
||||
case DIV_SYSTEM_SEGAPCM_COMPAT:
|
||||
case DIV_SYSTEM_YM2610:
|
||||
case DIV_SYSTEM_YM2610_EXT:
|
||||
case DIV_SYSTEM_YM2610_FULL:
|
||||
case DIV_SYSTEM_YM2610_FULL_EXT:
|
||||
case DIV_SYSTEM_YM2610B:
|
||||
case DIV_SYSTEM_YM2610B_EXT:
|
||||
case DIV_SYSTEM_OPL:
|
||||
case DIV_SYSTEM_OPL_DRUMS:
|
||||
case DIV_SYSTEM_OPL2:
|
||||
case DIV_SYSTEM_OPL2_DRUMS:
|
||||
case DIV_SYSTEM_OPL3:
|
||||
case DIV_SYSTEM_OPL3_DRUMS:
|
||||
case DIV_SYSTEM_AY8910:
|
||||
case DIV_SYSTEM_AY8930:
|
||||
return 0x151;
|
||||
case DIV_SYSTEM_GB:
|
||||
case DIV_SYSTEM_PCE:
|
||||
case DIV_SYSTEM_NES:
|
||||
case DIV_SYSTEM_FDS:
|
||||
case DIV_SYSTEM_QSOUND:
|
||||
return 0x161;
|
||||
case DIV_SYSTEM_SAA1099:
|
||||
case DIV_SYSTEM_X1_010:
|
||||
case DIV_SYSTEM_SWAN:
|
||||
return 0x171;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
if (sysDefs[which]==NULL) return 0;
|
||||
return sysDefs[which]->vgmVersion;
|
||||
}
|
||||
|
||||
// define systems like:
|
||||
|
|
@ -544,7 +506,6 @@ void DivEngine::registerSystems() {
|
|||
{DIV_INS_PET}
|
||||
);
|
||||
|
||||
// TODO: DIV_INS_SNES
|
||||
sysDefs[DIV_SYSTEM_SNES]=new DivSysDef(
|
||||
"SNES", NULL, 0x87, 0, 8, false, true, 0, false,
|
||||
{"Channel 1", "Channel 2", "Channel 3", "Channel 4", "Channel 5", "Channel 6", "Channel 7", "Channel 8"},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue