Skip to content

Commit

Permalink
update DspxProjectAudioExporter
Browse files Browse the repository at this point in the history
  • Loading branch information
CrSjimo committed Sep 18, 2024
1 parent 0b70676 commit 98f491a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 8 additions & 6 deletions src/dspx/DspxProjectAudioExporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,15 @@ namespace talcs {
mixerSourceData.source->setSilentFlags(mixerSourceData.actualSilentFlags);
}
savedMixerSourceDataIt++;
projectContext->transport()->setPosition(projectContext->timeConverter()(startTick));
masterTrack->setNextReadPosition(projectContext->timeConverter()(startTick));
return {mixerSourceData.trackContext, taskSources.value(mixerSourceData.source)};
}
return {nullptr, nullptr};
}

DspxProjectAudioExporter::DspxProjectAudioExporter(DspxProjectContext *context, QObject *parent) : QObject(parent), d_ptr(new DspxProjectAudioExporterPrivate) {
Q_D(DspxProjectAudioExporter);
d->q_ptr = this;
d->projectContext = context;
}

Expand Down Expand Up @@ -231,6 +232,7 @@ namespace talcs {

DspxProjectAudioExporter::Result ret = DspxProjectAudioExporter::OK;

savedMixerSourceDataIt = savedMixerSourceDataList.cbegin();
while (true) {
auto [trackContext, io] = makeNextSeparatedThruMasterTaskMixerLayoutAndGetCorrespondingData();
if (!trackContext)
Expand Down Expand Up @@ -260,10 +262,10 @@ namespace talcs {
writer.moveToThread(&exportThread);
QObject::connect(&exportThread, &QThread::started, &writer, &AudioSourceProcessorBase::start);

int clippingFlag = 0;
bool clippingFlag = false;
QObject::connect(&writer, &DspxProjectAudioExporterSourceWriter::clippingDetected, q, [&] {
if (!clippingFlag) {
clippingFlag = DspxProjectAudioExporter::ClippingDetected;
clippingFlag = true;
emit q->clippingDetected(trackContext);
}
});
Expand All @@ -272,11 +274,11 @@ namespace talcs {
});
QObject::connect(&writer, &AudioSourceProcessorBase::finished, q, [&] {
if (writer.status() == AudioSourceProcessorBase::Completed) {
eventLoop.exit(DspxProjectAudioExporter::OK | clippingFlag);
eventLoop.exit(DspxProjectAudioExporter::OK);
} else if (writer.status() == AudioSourceProcessorBase::Failed) {
eventLoop.exit(DspxProjectAudioExporter::Fail | clippingFlag);
eventLoop.exit(DspxProjectAudioExporter::Fail);
} else if (writer.status() == AudioSourceProcessorBase::Interrupted) {
eventLoop.exit((interruptionFlagIsFail ? DspxProjectAudioExporter::Fail : DspxProjectAudioExporter::Interrupted) | clippingFlag);
eventLoop.exit(interruptionFlagIsFail ? DspxProjectAudioExporter::Fail : DspxProjectAudioExporter::Interrupted);
}
});
exportThread.start();
Expand Down
2 changes: 0 additions & 2 deletions src/dspx/DspxProjectAudioExporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ namespace talcs {
OK = 0x0000,
Fail = 0x0001,
Interrupted = 0x0002,

ClippingDetected = 0x0010,
};
Q_DECLARE_FLAGS(Result, ResultFlag)
Result exec();
Expand Down

0 comments on commit 98f491a

Please sign in to comment.