Merge branch 'master' of https://github.com/tildearrow/furnace into sample_macro
This commit is contained in:
commit
0f5a400b29
140 changed files with 2646 additions and 1419 deletions
|
|
@ -147,37 +147,68 @@ void DivEngine::walkSong(int& loopOrder, int& loopRow, int& loopEnd) {
|
|||
int nextOrder=-1;
|
||||
int nextRow=0;
|
||||
int effectVal=0;
|
||||
int lastSuspectedLoopEnd=-1;
|
||||
DivPattern* pat[DIV_MAX_CHANS];
|
||||
unsigned char wsWalked[8192];
|
||||
memset(wsWalked,0,8192);
|
||||
for (int i=0; i<curSubSong->ordersLen; i++) {
|
||||
for (int j=0; j<chans; j++) {
|
||||
pat[j]=curPat[j].getPattern(curOrders->ord[j][i],false);
|
||||
}
|
||||
if (i>lastSuspectedLoopEnd) {
|
||||
lastSuspectedLoopEnd=i;
|
||||
}
|
||||
for (int j=nextRow; j<curSubSong->patLen; j++) {
|
||||
nextRow=0;
|
||||
bool changingOrder=false;
|
||||
bool jumpingOrder=false;
|
||||
if (wsWalked[((i<<5)+(j>>3))&8191]&(1<<(j&7))) {
|
||||
loopOrder=i;
|
||||
loopRow=j;
|
||||
loopEnd=lastSuspectedLoopEnd;
|
||||
return;
|
||||
}
|
||||
for (int k=0; k<chans; k++) {
|
||||
for (int l=0; l<curPat[k].effectCols; l++) {
|
||||
effectVal=pat[k]->data[j][5+(l<<1)];
|
||||
if (effectVal<0) effectVal=0;
|
||||
if (pat[k]->data[j][4+(l<<1)]==0x0d) {
|
||||
if (nextOrder==-1 && (i<curSubSong->ordersLen-1 || !song.ignoreJumpAtEnd)) {
|
||||
nextOrder=i+1;
|
||||
nextRow=effectVal;
|
||||
if (song.jumpTreatment==2) {
|
||||
if ((i<curSubSong->ordersLen-1 || !song.ignoreJumpAtEnd)) {
|
||||
nextOrder=i+1;
|
||||
nextRow=effectVal;
|
||||
jumpingOrder=true;
|
||||
}
|
||||
} else if (song.jumpTreatment==1) {
|
||||
if (nextOrder==-1 && (i<curSubSong->ordersLen-1 || !song.ignoreJumpAtEnd)) {
|
||||
nextOrder=i+1;
|
||||
nextRow=effectVal;
|
||||
jumpingOrder=true;
|
||||
}
|
||||
} else {
|
||||
if ((i<curSubSong->ordersLen-1 || !song.ignoreJumpAtEnd)) {
|
||||
if (!changingOrder) {
|
||||
nextOrder=i+1;
|
||||
}
|
||||
jumpingOrder=true;
|
||||
nextRow=effectVal;
|
||||
}
|
||||
}
|
||||
} else if (pat[k]->data[j][4+(l<<1)]==0x0b) {
|
||||
if (nextOrder==-1) {
|
||||
if (nextOrder==-1 || song.jumpTreatment==0) {
|
||||
nextOrder=effectVal;
|
||||
nextRow=0;
|
||||
if (song.jumpTreatment==1 || song.jumpTreatment==2 || !jumpingOrder) {
|
||||
nextRow=0;
|
||||
}
|
||||
changingOrder=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wsWalked[((i<<5)+(j>>3))&8191]|=1<<(j&7);
|
||||
|
||||
if (nextOrder!=-1) {
|
||||
if (nextOrder<=i) {
|
||||
loopOrder=nextOrder;
|
||||
loopRow=nextRow;
|
||||
loopEnd=i;
|
||||
return;
|
||||
}
|
||||
i=nextOrder-1;
|
||||
nextOrder=-1;
|
||||
break;
|
||||
|
|
@ -1659,6 +1690,7 @@ void DivEngine::playSub(bool preserveDrift, int goalRow) {
|
|||
speedAB=false;
|
||||
playing=true;
|
||||
skipping=true;
|
||||
memset(walked,0,8192);
|
||||
for (int i=0; i<song.systemLen; i++) disCont[i].dispatch->setSkipRegisterWrites(true);
|
||||
while (playing && curOrder<goal) {
|
||||
if (nextTick(preserveDrift)) {
|
||||
|
|
@ -3440,9 +3472,8 @@ void DivEngine::setConsoleMode(bool enable) {
|
|||
}
|
||||
|
||||
bool DivEngine::switchMaster() {
|
||||
deinitAudioBackend();
|
||||
quitDispatch();
|
||||
initDispatch();
|
||||
logI("switching output...");
|
||||
deinitAudioBackend(true);
|
||||
if (initAudioBackend()) {
|
||||
for (int i=0; i<song.systemLen; i++) {
|
||||
disCont[i].setRates(got.rate);
|
||||
|
|
@ -3586,6 +3617,7 @@ void DivEngine::quitDispatch() {
|
|||
|
||||
bool DivEngine::initAudioBackend() {
|
||||
// load values
|
||||
logI("initializing audio.");
|
||||
if (audioEngine==DIV_AUDIO_NULL) {
|
||||
if (getConfString("audioEngine","SDL")=="JACK") {
|
||||
audioEngine=DIV_AUDIO_JACK;
|
||||
|
|
@ -3691,8 +3723,9 @@ bool DivEngine::initAudioBackend() {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool DivEngine::deinitAudioBackend() {
|
||||
bool DivEngine::deinitAudioBackend(bool dueToSwitchMaster) {
|
||||
if (output!=NULL) {
|
||||
logI("closing audio output.");
|
||||
output->quit();
|
||||
if (output->midiIn) {
|
||||
if (output->midiIn->isDeviceOpen()) {
|
||||
|
|
@ -3709,7 +3742,9 @@ bool DivEngine::deinitAudioBackend() {
|
|||
output->quitMidi();
|
||||
delete output;
|
||||
output=NULL;
|
||||
//audioEngine=DIV_AUDIO_NULL;
|
||||
if (dueToSwitchMaster) {
|
||||
audioEngine=DIV_AUDIO_NULL;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue