temporarily disable audio export
I need to rewrite the audio export code so it becomes possible to export audio from the GUI
This commit is contained in:
parent
12236248dd
commit
3026bf8ba9
|
@ -95,12 +95,6 @@ this will play a compatible file.
|
||||||
|
|
||||||
this will play a compatible file and enable the commands view.
|
this will play a compatible file and enable the commands view.
|
||||||
|
|
||||||
```
|
|
||||||
./furnace -output audio.wav <file>
|
|
||||||
```
|
|
||||||
|
|
||||||
this will render a file to .wav.
|
|
||||||
|
|
||||||
# notes
|
# notes
|
||||||
|
|
||||||
> how do I use Neo Geo SSG envelopes?
|
> how do I use Neo Geo SSG envelopes?
|
||||||
|
|
|
@ -3229,7 +3229,7 @@ void DivEngine::quitDispatch() {
|
||||||
#include "winStuff.h"
|
#include "winStuff.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool DivEngine::init(String outName) {
|
bool DivEngine::init() {
|
||||||
// init config
|
// init config
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
configPath=getWinConfigPath();
|
configPath=getWinConfigPath();
|
||||||
|
@ -3263,23 +3263,6 @@ bool DivEngine::init(String outName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// init the rest of engine
|
// init the rest of engine
|
||||||
SNDFILE* outFile=NULL;
|
|
||||||
SF_INFO outInfo;
|
|
||||||
if (outName!="") {
|
|
||||||
// init out file
|
|
||||||
got.bufsize=2048;
|
|
||||||
got.rate=44100;
|
|
||||||
|
|
||||||
outInfo.samplerate=got.rate;
|
|
||||||
outInfo.channels=2;
|
|
||||||
outInfo.format=SF_FORMAT_WAV|SF_FORMAT_PCM_16;
|
|
||||||
|
|
||||||
outFile=sf_open(outName.c_str(),SFM_WRITE,&outInfo);
|
|
||||||
if (outFile==NULL) {
|
|
||||||
logE("could not open file for writing!\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch (audioEngine) {
|
switch (audioEngine) {
|
||||||
case DIV_AUDIO_JACK:
|
case DIV_AUDIO_JACK:
|
||||||
#ifndef HAVE_JACK
|
#ifndef HAVE_JACK
|
||||||
|
@ -3313,7 +3296,6 @@ bool DivEngine::init(String outName) {
|
||||||
logE("error while initializing audio!\n");
|
logE("error while initializing audio!\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
samp_bb=blip_new(32768);
|
samp_bb=blip_new(32768);
|
||||||
if (samp_bb==NULL) {
|
if (samp_bb==NULL) {
|
||||||
|
@ -3340,43 +3322,10 @@ bool DivEngine::init(String outName) {
|
||||||
reset();
|
reset();
|
||||||
active=true;
|
active=true;
|
||||||
|
|
||||||
if (outName!="") {
|
|
||||||
short* ilBuffer=new short[got.bufsize*2];
|
|
||||||
// render to file
|
|
||||||
remainingLoops=1;
|
|
||||||
play();
|
|
||||||
while (remainingLoops) {
|
|
||||||
nextBuf(NULL,NULL,0,2,got.bufsize);
|
|
||||||
|
|
||||||
for (int h=0; h<song.systemLen; h++) {
|
|
||||||
if (disCont[h].dispatch->isStereo()) {
|
|
||||||
for (size_t i=0; i<got.bufsize; i++) {
|
|
||||||
ilBuffer[i<<1]=disCont[h].bbOut[0][i];
|
|
||||||
ilBuffer[1+(i<<1)]=disCont[h].bbOut[1][i];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (size_t i=0; i<got.bufsize; i++) {
|
|
||||||
ilBuffer[i<<1]=disCont[h].bbOut[0][i];
|
|
||||||
ilBuffer[1+(i<<1)]=disCont[h].bbOut[0][i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!remainingLoops) {
|
|
||||||
sf_writef_short(outFile,ilBuffer,totalProcessed);
|
|
||||||
} else {
|
|
||||||
sf_writef_short(outFile,ilBuffer,got.bufsize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
delete[] ilBuffer;
|
|
||||||
sf_close(outFile);
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
if (!output->setRun(true)) {
|
if (!output->setRun(true)) {
|
||||||
logE("error while activating!\n");
|
logE("error while activating!\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -194,6 +194,10 @@ class DivEngine {
|
||||||
SafeWriter* buildROM(int sys);
|
SafeWriter* buildROM(int sys);
|
||||||
// dump to VGM (TODO).
|
// dump to VGM (TODO).
|
||||||
SafeWriter* saveVGM();
|
SafeWriter* saveVGM();
|
||||||
|
// export to an audio file
|
||||||
|
bool saveAudio(const char* path);
|
||||||
|
// stop audio file export
|
||||||
|
bool haltAudioFile();
|
||||||
|
|
||||||
// save config
|
// save config
|
||||||
bool saveConf();
|
bool saveConf();
|
||||||
|
@ -423,7 +427,7 @@ class DivEngine {
|
||||||
void quitDispatch();
|
void quitDispatch();
|
||||||
|
|
||||||
// initialize the engine. optionally provide an output file name.
|
// initialize the engine. optionally provide an output file name.
|
||||||
bool init(String outName="");
|
bool init();
|
||||||
|
|
||||||
// terminate the engine.
|
// terminate the engine.
|
||||||
bool quit();
|
bool quit();
|
||||||
|
|
|
@ -292,7 +292,7 @@ int main(int argc, char** argv) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!e.init(outName)) {
|
if (!e.init()) {
|
||||||
logE("could not initialize engine!\n");
|
logE("could not initialize engine!\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue