Revert "prepare to add file out - does not compile!"

This reverts commit 45b202b85b.
This commit is contained in:
tildearrow 2021-12-07 04:20:11 -05:00
parent 45b202b85b
commit ada8e71884
7 changed files with 12 additions and 196 deletions

View file

@ -5,7 +5,6 @@
#ifdef HAVE_JACK
#include "../audio/jack.h"
#endif
#include "../audio/file.h"
#include "platform/genesis.h"
#include "platform/genesisext.h"
#include "platform/sms.h"
@ -679,10 +678,6 @@ DivWavetable* DivEngine::getWave(int index) {
return song.wave[index];
}
void DivEngine::setLoops(int loops) {
remainingLoops=loops;
}
void DivEngine::play() {
}
@ -708,9 +703,6 @@ bool DivEngine::init() {
case DIV_AUDIO_SDL:
output=new TAAudioSDL;
break;
case DIV_AUDIO_FILE:
output=new TAAudioFile;
break;
default:
logE("invalid audio engine!\n");
return false;

View file

@ -13,8 +13,7 @@ enum DivStatusView {
enum DivAudioEngines {
DIV_AUDIO_JACK=0,
DIV_AUDIO_SDL,
DIV_AUDIO_FILE
DIV_AUDIO_SDL
};
struct DivChannelState {
@ -59,15 +58,12 @@ class DivEngine {
int chans;
bool playing;
bool speedAB;
bool endOfSong;
int ticks, cycles, curRow, curOrder, remainingLoops;
int ticks, cycles, curRow, curOrder;
int changeOrd, changePos, totalTicks, totalCmds, lastCmds, cmdsPerSecond;
DivStatusView view;
DivChannelState chan[17];
DivAudioEngines audioEngine;
String outName;
short vibTable[64];
blip_buffer_t* bb[2];
@ -80,8 +76,7 @@ class DivEngine {
void processRow(int i, bool afterDelay);
void nextOrder();
void nextRow();
// returns true if end of song.
bool nextTick();
void nextTick();
bool perSystemEffect(int ch, unsigned char effect, unsigned char effectVal);
bool perSystemPostEffect(int ch, unsigned char effect, unsigned char effectVal);
void renderSamples();
@ -99,18 +94,12 @@ class DivEngine {
// play
void play();
// set remaining loops. -1 means loop forever.
void setLoops(int loops);
// set the audio system.
void setAudio(DivAudioEngines which);
// set the view mode.
void setView(DivStatusView which);
// open audio output file.
bool openAudioOut(String filename);
// initialize the engine.
bool init();
@ -118,12 +107,10 @@ class DivEngine {
chans(0),
playing(false),
speedAB(false),
endOfSong(false),
ticks(0),
cycles(0),
curRow(0),
curOrder(0),
remainingLoops(-1),
changeOrd(-1),
changePos(0),
totalTicks(0),

View file

@ -1,11 +1,9 @@
#include "dispatch.h"
#include "engine.h"
#include "../ta-log.h"
void DivEngine::nextOrder() {
curRow=0;
if (++curOrder>=song.ordersLen) {
endOfSong=true;
curOrder=0;
}
}
@ -520,11 +518,9 @@ void DivEngine::nextRow() {
}
if (changeOrd>=0) {
curRow=changePos;
if (changeOrd<=curOrder) endOfSong=true;
curOrder=changeOrd;
if (curOrder>=song.ordersLen) {
curOrder=0;
endOfSong=true;
}
changeOrd=-1;
}
@ -547,8 +543,7 @@ void DivEngine::nextRow() {
}
}
bool DivEngine::nextTick() {
bool ret=false;
void DivEngine::nextTick() {
if (song.customTempo) {
cycles=dispatch->rate/song.hz;
} else {
@ -653,10 +648,6 @@ bool DivEngine::nextTick() {
cmdsPerSecond=totalCmds-lastCmds;
lastCmds=totalCmds;
}
ret=endOfSong;
endOfSong=false;
return ret;
}
void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsigned int size) {
@ -673,26 +664,15 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi
size_t runLeft=runtotal;
size_t runPos=0;
while (runLeft) {
if (!remainingLoops) {
memset(bbIn[0]+runPos,0,runLeft*sizeof(short));
memset(bbIn[1]+runPos,0,runLeft*sizeof(short));
break;
if (runLeft>=cycles) {
runLeft-=cycles;
dispatch->acquire(bbIn[0],bbIn[1],runPos,cycles);
runPos+=cycles;
nextTick();
} else {
if (runLeft>=cycles) {
runLeft-=cycles;
dispatch->acquire(bbIn[0],bbIn[1],runPos,cycles);
runPos+=cycles;
if (nextTick()) {
if (remainingLoops>0) {
remainingLoops--;
if (!remainingLoops) logI("end of song!\n");
}
}
} else {
dispatch->acquire(bbIn[0],bbIn[1],runPos,runLeft);
cycles-=runLeft;
break;
}
dispatch->acquire(bbIn[0],bbIn[1],runPos,runLeft);
cycles-=runLeft;
break;
}
}