Skip to content

Commit 1f6952e

Browse files
committed
Fix audio export bugs
1 parent 22c5269 commit 1f6952e

3 files changed

Lines changed: 8 additions & 32 deletions

File tree

src/plugins/audio/audioexport/AudioExporter.cpp

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,9 @@ namespace Audio {
199199
break;
200200
}
201201
case AudioExporterConfig::SO_Custom:
202-
indexes = parameter.source();
203-
for (const auto index : indexes) {
204-
if (index < 0 || index >= trackList.size()) {
205-
if (ok) {
206-
*ok = false;
207-
}
208-
return {};
202+
for (const auto index : parameter.source()) {
203+
if (index >= 0 && index < trackList.size()) {
204+
indexes.append(index);
209205
}
210206
}
211207
break;
@@ -319,23 +315,12 @@ namespace Audio {
319315
preflightWarnings |= AudioExporter::PW_LossyFormat;
320316
}
321317

322-
bool sourcesOk = true;
323-
const auto indexes = sourceIndexes(&sourcesOk);
318+
const auto indexes = sourceIndexes();
324319
const auto isMixed = config.mixingOption() == AudioExporterConfig::MO_Mixed;
325-
if (!sourcesOk || (!isMixed && indexes.isEmpty())) {
320+
if (!isMixed && indexes.isEmpty()) {
326321
preflightWarnings |= AudioExporter::PW_NoFile;
327322
}
328323

329-
if (!sourcesOk || (!isMixed && indexes.isEmpty())) {
330-
if (oldWarnings != preflightWarnings) {
331-
Q_EMIT q->preflightWarningsChanged();
332-
}
333-
if (oldFileList != fileList) {
334-
Q_EMIT q->fileListChanged();
335-
}
336-
return;
337-
}
338-
339324
const auto directory = QDir(projectDirectory()).absoluteFilePath(config.fileDirectory());
340325
if (isMixed) {
341326
auto fileName = config.fileName();
@@ -385,9 +370,6 @@ namespace Audio {
385370
case AudioExporter::InvalidConfig:
386371
newErrorString = AudioExporter::tr("Invalid audio export configuration.");
387372
break;
388-
case AudioExporter::InvalidSource:
389-
newErrorString = AudioExporter::tr("Invalid audio export source.");
390-
break;
391373
case AudioExporter::CannotOpenFile:
392374
newErrorString = AudioExporter::tr("Cannot open file for writing.");
393375
break;
@@ -561,13 +543,7 @@ namespace Audio {
561543
return R_Fail;
562544
}
563545

564-
bool sourcesOk = true;
565-
const auto sourceIndexes = d->sourceIndexes(&sourcesOk);
566-
if (!sourcesOk || d->fileList.isEmpty() ||
567-
(d->config.mixingOption() != AudioExporterConfig::MO_Mixed && sourceIndexes.isEmpty())) {
568-
d->setError(InvalidSource, tr("No file will be exported. Please check if any source is selected."));
569-
return R_Fail;
570-
}
546+
const auto sourceIndexes = d->sourceIndexes();
571547

572548
const auto projectContext = d->projectContext();
573549
QHash<QString, QString> temporaryFiles;
@@ -623,6 +599,7 @@ namespace Audio {
623599

624600
const auto sourceTracks = d->sourceTrackContexts(sourceIndexes);
625601
if (d->config.mixingOption() == AudioExporterConfig::MO_Mixed) {
602+
Q_ASSERT(!d->fileList.isEmpty());
626603
exporter.setMixedTask(sourceTracks, &ioList[0]);
627604
} else {
628605
Q_ASSERT(sourceTracks.size() == d->fileList.size());

src/plugins/audio/audioexport/AudioExporter.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ namespace Audio {
7373
enum Error {
7474
NoError,
7575
InvalidConfig,
76-
InvalidSource,
7776
CannotOpenFile,
7877
UnsupportedFormat,
7978
CannotStartExport,

0 commit comments

Comments
 (0)