mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-23 13:05:11 +00:00
fix gap in audio export
This commit is contained in:
parent
3bab6faf0f
commit
6118e75ec7
2 changed files with 15 additions and 14 deletions
|
@ -1860,7 +1860,7 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi
|
|||
output->midiIn->queue.pop();
|
||||
}
|
||||
|
||||
// process audio
|
||||
// process sample/wave preview
|
||||
if ((sPreview.sample>=0 && sPreview.sample<(int)song.sample.size()) || (sPreview.wave>=0 && sPreview.wave<(int)song.wave.size())) {
|
||||
unsigned int samp_bbOff=0;
|
||||
unsigned int prevAvail=blip_samples_avail(samp_bb);
|
||||
|
@ -2007,7 +2007,9 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi
|
|||
memset(samp_bbOut,0,size*sizeof(short));
|
||||
}
|
||||
|
||||
if (playing && !halted) {
|
||||
// process audio
|
||||
bool mustPlay=playing && !halted;
|
||||
if (mustPlay) {
|
||||
// logic starts here
|
||||
for (int i=0; i<song.systemLen; i++) {
|
||||
// TODO: we may have a problem here
|
||||
|
@ -2136,6 +2138,7 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi
|
|||
renderPool->wait();
|
||||
}
|
||||
|
||||
// process metronome
|
||||
if (metroBufLen<size || metroBuf==NULL) {
|
||||
if (metroBuf!=NULL) delete[] metroBuf;
|
||||
metroBuf=new float[size];
|
||||
|
@ -2144,7 +2147,7 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi
|
|||
|
||||
memset(metroBuf,0,metroBufLen*sizeof(float));
|
||||
|
||||
if (playing && !halted && metronome) {
|
||||
if (mustPlay && metronome) {
|
||||
for (size_t i=0; i<size; i++) {
|
||||
if (metroTick[i]) {
|
||||
if (metroTick[i]==2) {
|
||||
|
@ -2226,6 +2229,7 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi
|
|||
// nothing/invalid
|
||||
}
|
||||
|
||||
// dump to oscillator buffer
|
||||
for (unsigned int i=0; i<size; i++) {
|
||||
for (int j=0; j<outChans; j++) {
|
||||
if (oscBuf[j]==NULL) continue;
|
||||
|
@ -2235,6 +2239,7 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi
|
|||
}
|
||||
oscSize=size;
|
||||
|
||||
// force mono audio (if enabled)
|
||||
if (forceMono && outChans>1) {
|
||||
for (size_t i=0; i<size; i++) {
|
||||
float chanSum=out[0][i];
|
||||
|
@ -2247,6 +2252,8 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// clamp output (if enabled)
|
||||
if (clampSamples) {
|
||||
for (size_t i=0; i<size; i++) {
|
||||
for (int j=0; j<outChans; j++) {
|
||||
|
|
|
@ -89,6 +89,7 @@ void DivEngine::runExportThread() {
|
|||
if (lastLoopPos>-1 && i>=lastLoopPos && totalLoops>=exportLoopCount) {
|
||||
logD("start fading out...");
|
||||
isFadingOut=true;
|
||||
if (fadeOutSamples==0) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -197,6 +198,7 @@ void DivEngine::runExportThread() {
|
|||
if (lastLoopPos>-1 && j>=lastLoopPos && totalLoops>=exportLoopCount) {
|
||||
logD("start fading out...");
|
||||
isFadingOut=true;
|
||||
if (fadeOutSamples==0) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -239,7 +241,6 @@ void DivEngine::runExportThread() {
|
|||
outBuf[0]=new float[EXPORT_BUFSIZE];
|
||||
outBuf[1]=new float[EXPORT_BUFSIZE];
|
||||
outBuf[2]=new float[EXPORT_BUFSIZE*2];
|
||||
int loopCount=remainingLoops;
|
||||
|
||||
logI("rendering to files...");
|
||||
|
||||
|
@ -281,11 +282,7 @@ void DivEngine::runExportThread() {
|
|||
lastLoopPos=-1;
|
||||
totalLoops=0;
|
||||
isFadingOut=false;
|
||||
if (exportFadeOut<=0.01) {
|
||||
remainingLoops=loopCount;
|
||||
} else {
|
||||
remainingLoops=-1;
|
||||
}
|
||||
playSub(false);
|
||||
|
||||
while (playing) {
|
||||
|
@ -311,6 +308,7 @@ void DivEngine::runExportThread() {
|
|||
if (lastLoopPos>-1 && j>=lastLoopPos && totalLoops>=exportLoopCount) {
|
||||
logD("start fading out...");
|
||||
isFadingOut=true;
|
||||
if (fadeOutSamples==0) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -399,11 +397,7 @@ bool DivEngine::saveAudio(const char* path, int loops, DivAudioExportModes mode,
|
|||
stop();
|
||||
repeatPattern=false;
|
||||
setOrder(0);
|
||||
if (exportFadeOut<=0.01) {
|
||||
remainingLoops=loops;
|
||||
} else {
|
||||
remainingLoops=-1;
|
||||
}
|
||||
|
||||
if (shallSwitchCores()) {
|
||||
bool isMutedBefore[DIV_MAX_CHANS];
|
||||
|
|
Loading…
Reference in a new issue