mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-25 15:53:52 +02:00
Use enum class ProgressResult, don't interconvert with int or bool
This commit is contained in:
@@ -822,14 +822,12 @@ bool Exporter::CheckMix()
|
||||
|
||||
bool Exporter::ExportTracks()
|
||||
{
|
||||
int success;
|
||||
|
||||
// Keep original in case of failure
|
||||
if (mActualName != mFilename) {
|
||||
::wxRenameFile(mActualName.GetFullPath(), mFilename.GetFullPath());
|
||||
}
|
||||
|
||||
success = mPlugins[mFormat]->Export(mProject,
|
||||
auto success = mPlugins[mFormat]->Export(mProject,
|
||||
mChannels,
|
||||
mActualName.GetFullPath(),
|
||||
mSelectedOnly,
|
||||
@@ -841,7 +839,7 @@ bool Exporter::ExportTracks()
|
||||
|
||||
if (mActualName != mFilename) {
|
||||
// Remove backup
|
||||
if (success == eProgressSuccess || success == eProgressStopped) {
|
||||
if (success == ProgressResult::Success || success == ProgressResult::Stopped) {
|
||||
::wxRemoveFile(mFilename.GetFullPath());
|
||||
}
|
||||
else {
|
||||
@@ -851,7 +849,7 @@ bool Exporter::ExportTracks()
|
||||
}
|
||||
}
|
||||
|
||||
return (success == eProgressSuccess || success == eProgressStopped);
|
||||
return (success == ProgressResult::Success || success == ProgressResult::Stopped);
|
||||
}
|
||||
|
||||
void Exporter::CreateUserPaneCallback(wxWindow *parent, wxUIntPtr userdata)
|
||||
|
||||
@@ -33,6 +33,7 @@ class MixerSpec;
|
||||
class TimeTrack;
|
||||
class Mixer;
|
||||
class WaveTrackConstArray;
|
||||
enum class ProgressResult : unsigned;
|
||||
|
||||
class AUDACITY_DLL_API FormatInfo
|
||||
{
|
||||
@@ -108,7 +109,7 @@ public:
|
||||
* libsndfile export plug-in, but with subformat set to 0, 1, and 2
|
||||
* respectively.
|
||||
*/
|
||||
virtual int Export(AudacityProject *project,
|
||||
virtual ProgressResult Export(AudacityProject *project,
|
||||
unsigned channels,
|
||||
const wxString &fName,
|
||||
bool selectedOnly,
|
||||
|
||||
@@ -284,7 +284,7 @@ public:
|
||||
// Required
|
||||
wxWindow *OptionsCreate(wxWindow *parent, int format);
|
||||
|
||||
int Export(AudacityProject *project,
|
||||
ProgressResult Export(AudacityProject *project,
|
||||
unsigned channels,
|
||||
const wxString &fName,
|
||||
bool selectedOnly,
|
||||
@@ -306,7 +306,7 @@ ExportCL::ExportCL()
|
||||
SetDescription(_("(external program)"),0);
|
||||
}
|
||||
|
||||
int ExportCL::Export(AudacityProject *project,
|
||||
ProgressResult ExportCL::Export(AudacityProject *project,
|
||||
unsigned channels,
|
||||
const wxString &fName,
|
||||
bool selectionOnly,
|
||||
@@ -368,7 +368,7 @@ int ExportCL::Export(AudacityProject *project,
|
||||
process.Detach();
|
||||
process.CloseOutput();
|
||||
|
||||
return false;
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
|
||||
// Turn off logging to prevent broken pipe messages
|
||||
@@ -432,7 +432,7 @@ int ExportCL::Export(AudacityProject *project,
|
||||
|
||||
size_t numBytes = 0;
|
||||
samplePtr mixed = NULL;
|
||||
int updateResult = eProgressSuccess;
|
||||
auto updateResult = ProgressResult::Success;
|
||||
|
||||
{
|
||||
// Prepare the progress display
|
||||
@@ -442,7 +442,7 @@ int ExportCL::Export(AudacityProject *project,
|
||||
_("Exporting the entire project using command-line encoder"));
|
||||
|
||||
// Start piping the mixed data to the command
|
||||
while (updateResult == eProgressSuccess && process.IsActive() && os->IsOk()) {
|
||||
while (updateResult == ProgressResult::Success && process.IsActive() && os->IsOk()) {
|
||||
// Capture any stdout and stderr from the command
|
||||
Drain(process.GetInputStream(), &output);
|
||||
Drain(process.GetErrorStream(), &output);
|
||||
|
||||
@@ -140,7 +140,7 @@ public:
|
||||
///\param metadata tags to write into file
|
||||
///\param subformat index of export type
|
||||
///\return true if export succeded
|
||||
int Export(AudacityProject *project,
|
||||
ProgressResult Export(AudacityProject *project,
|
||||
unsigned channels,
|
||||
const wxString &fName,
|
||||
bool selectedOnly,
|
||||
@@ -823,12 +823,12 @@ bool ExportFFmpeg::EncodeAudioFrame(int16_t *pFrame, size_t frameSize)
|
||||
}
|
||||
|
||||
|
||||
int ExportFFmpeg::Export(AudacityProject *project,
|
||||
ProgressResult ExportFFmpeg::Export(AudacityProject *project,
|
||||
unsigned channels, const wxString &fName,
|
||||
bool selectionOnly, double t0, double t1, MixerSpec *mixerSpec, const Tags *metadata, int subformat)
|
||||
{
|
||||
if (!CheckFFmpegPresence())
|
||||
return false;
|
||||
return ProgressResult::Cancelled;
|
||||
mChannels = channels;
|
||||
// subformat index may not correspond directly to fmts[] index, convert it
|
||||
mSubFormat = AdjustFormatIndex(subformat);
|
||||
@@ -840,20 +840,22 @@ int ExportFFmpeg::Export(AudacityProject *project,
|
||||
channels,
|
||||
ExportFFmpegOptions::fmts[mSubFormat].maxchannels),
|
||||
_("Error"));
|
||||
return false;
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
mName = fName;
|
||||
const TrackList *tracks = project->GetTracks();
|
||||
bool ret = true;
|
||||
|
||||
if (mSubFormat >= FMT_LAST) return false;
|
||||
if (mSubFormat >= FMT_LAST)
|
||||
return ProgressResult::Cancelled;
|
||||
|
||||
wxString shortname(ExportFFmpegOptions::fmts[mSubFormat].shortname);
|
||||
if (mSubFormat == FMT_OTHER)
|
||||
shortname = gPrefs->Read(wxT("/FileFormats/FFmpegFormat"),wxT("matroska"));
|
||||
ret = Init(shortname.mb_str(),project, metadata, subformat);
|
||||
|
||||
if (!ret) return false;
|
||||
if (!ret)
|
||||
return ProgressResult::Cancelled;
|
||||
|
||||
int pcmBufferSize = 1024;
|
||||
const WaveTrackConstArray waveTracks =
|
||||
@@ -864,14 +866,14 @@ int ExportFFmpeg::Export(AudacityProject *project,
|
||||
channels, pcmBufferSize, true,
|
||||
mSampleRate, int16Sample, true, mixerSpec);
|
||||
|
||||
int updateResult = eProgressSuccess;
|
||||
auto updateResult = ProgressResult::Success;
|
||||
{
|
||||
ProgressDialog progress(wxFileName(fName).GetName(),
|
||||
selectionOnly ?
|
||||
wxString::Format(_("Exporting selected audio as %s"), ExportFFmpegOptions::fmts[mSubFormat].description) :
|
||||
wxString::Format(_("Exporting entire file as %s"), ExportFFmpegOptions::fmts[mSubFormat].description));
|
||||
|
||||
while (updateResult == eProgressSuccess) {
|
||||
while (updateResult == ProgressResult::Success) {
|
||||
auto pcmNumSamples = mixer->Process(pcmBufferSize);
|
||||
|
||||
if (pcmNumSamples == 0)
|
||||
|
||||
@@ -182,7 +182,7 @@ public:
|
||||
// Required
|
||||
|
||||
wxWindow *OptionsCreate(wxWindow *parent, int format);
|
||||
int Export(AudacityProject *project,
|
||||
ProgressResult Export(AudacityProject *project,
|
||||
unsigned channels,
|
||||
const wxString &fName,
|
||||
bool selectedOnly,
|
||||
@@ -212,7 +212,7 @@ ExportFLAC::ExportFLAC()
|
||||
SetDescription(_("FLAC Files"),0);
|
||||
}
|
||||
|
||||
int ExportFLAC::Export(AudacityProject *project,
|
||||
ProgressResult ExportFLAC::Export(AudacityProject *project,
|
||||
unsigned numChannels,
|
||||
const wxString &fName,
|
||||
bool selectionOnly,
|
||||
@@ -226,7 +226,7 @@ int ExportFLAC::Export(AudacityProject *project,
|
||||
const TrackList *tracks = project->GetTracks();
|
||||
|
||||
wxLogNull logNo; // temporarily disable wxWidgets error messages
|
||||
int updateResult = eProgressSuccess;
|
||||
auto updateResult = ProgressResult::Success;
|
||||
|
||||
int levelPref;
|
||||
gPrefs->Read(wxT("/FileFormats/FLACLevel"), &levelPref, 5);
|
||||
@@ -244,7 +244,7 @@ int ExportFLAC::Export(AudacityProject *project,
|
||||
|
||||
// See note in GetMetadata() about a bug in libflac++ 1.1.2
|
||||
if (!GetMetadata(project, metadata)) {
|
||||
return false;
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
|
||||
if (mMetadata) {
|
||||
@@ -286,7 +286,7 @@ int ExportFLAC::Export(AudacityProject *project,
|
||||
wxFFile f; // will be closed when it goes out of scope
|
||||
if (!f.Open(fName, wxT("w+b"))) {
|
||||
wxMessageBox(wxString::Format(_("FLAC export couldn't open %s"), fName.c_str()));
|
||||
return false;
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
|
||||
// Even though there is an init() method that takes a filename, use the one that
|
||||
@@ -295,7 +295,7 @@ int ExportFLAC::Export(AudacityProject *project,
|
||||
int status = encoder.init(f.fp());
|
||||
if (status != FLAC__STREAM_ENCODER_INIT_STATUS_OK) {
|
||||
wxMessageBox(wxString::Format(_("FLAC encoder failed to initialize\nStatus: %d"), status));
|
||||
return false;
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -323,7 +323,7 @@ int ExportFLAC::Export(AudacityProject *project,
|
||||
_("Exporting the selected audio as FLAC") :
|
||||
_("Exporting the entire project as FLAC"));
|
||||
|
||||
while (updateResult == eProgressSuccess) {
|
||||
while (updateResult == ProgressResult::Success) {
|
||||
auto samplesThisRun = mixer->Process(SAMPLES_PER_RUN);
|
||||
if (samplesThisRun == 0) { //stop encoding
|
||||
break;
|
||||
|
||||
@@ -173,7 +173,7 @@ public:
|
||||
// Required
|
||||
|
||||
wxWindow *OptionsCreate(wxWindow *parent, int format);
|
||||
int Export(AudacityProject *project,
|
||||
ProgressResult Export(AudacityProject *project,
|
||||
unsigned channels,
|
||||
const wxString &fName,
|
||||
bool selectedOnly,
|
||||
@@ -203,7 +203,7 @@ ExportMP2::ExportMP2()
|
||||
SetDescription(_("MP2 Files"),0);
|
||||
}
|
||||
|
||||
int ExportMP2::Export(AudacityProject *project,
|
||||
ProgressResult ExportMP2::Export(AudacityProject *project,
|
||||
unsigned channels, const wxString &fName,
|
||||
bool selectionOnly, double t0, double t1, MixerSpec *mixerSpec, const Tags *metadata,
|
||||
int WXUNUSED(subformat))
|
||||
@@ -228,7 +228,7 @@ int ExportMP2::Export(AudacityProject *project,
|
||||
wxMessageBox(_("Cannot export MP2 with this sample rate and bit rate"),
|
||||
_("Error"), wxICON_STOP);
|
||||
twolame_close(&encodeOptions);
|
||||
return false;
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
|
||||
// Put ID3 tags at beginning of file
|
||||
@@ -239,7 +239,7 @@ int ExportMP2::Export(AudacityProject *project,
|
||||
if (!outFile.IsOpened()) {
|
||||
wxMessageBox(_("Unable to open target file for writing"));
|
||||
twolame_close(&encodeOptions);
|
||||
return false;
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
|
||||
char *id3buffer = NULL;
|
||||
@@ -260,7 +260,7 @@ int ExportMP2::Export(AudacityProject *project,
|
||||
|
||||
const WaveTrackConstArray waveTracks =
|
||||
tracks->GetWaveTrackConstArray(selectionOnly, false);
|
||||
int updateResult = eProgressSuccess;
|
||||
auto updateResult = ProgressResult::Success;
|
||||
{
|
||||
auto mixer = CreateMixer(waveTracks,
|
||||
tracks->GetTimeTrack(),
|
||||
@@ -273,7 +273,7 @@ int ExportMP2::Export(AudacityProject *project,
|
||||
wxString::Format(_("Exporting selected audio at %ld kbps"), bitrate) :
|
||||
wxString::Format(_("Exporting entire file at %ld kbps"), bitrate));
|
||||
|
||||
while (updateResult == eProgressSuccess) {
|
||||
while (updateResult == ProgressResult::Success) {
|
||||
auto pcmNumSamples = mixer->Process(pcmBufferSize);
|
||||
|
||||
if (pcmNumSamples == 0)
|
||||
|
||||
@@ -1602,7 +1602,7 @@ public:
|
||||
// Required
|
||||
|
||||
wxWindow *OptionsCreate(wxWindow *parent, int format);
|
||||
int Export(AudacityProject *project,
|
||||
ProgressResult Export(AudacityProject *project,
|
||||
unsigned channels,
|
||||
const wxString &fName,
|
||||
bool selectedOnly,
|
||||
@@ -1662,7 +1662,7 @@ int ExportMP3::SetNumExportChannels()
|
||||
}
|
||||
|
||||
|
||||
int ExportMP3::Export(AudacityProject *project,
|
||||
ProgressResult ExportMP3::Export(AudacityProject *project,
|
||||
unsigned channels,
|
||||
const wxString &fName,
|
||||
bool selectionOnly,
|
||||
@@ -1693,7 +1693,7 @@ int ExportMP3::Export(AudacityProject *project,
|
||||
gPrefs->Write(wxT("/MP3/MP3LibPath"), wxString(wxT("")));
|
||||
gPrefs->Flush();
|
||||
|
||||
return false;
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
|
||||
if (!exporter.ValidLibraryLoaded()) {
|
||||
@@ -1701,7 +1701,7 @@ int ExportMP3::Export(AudacityProject *project,
|
||||
gPrefs->Write(wxT("/MP3/MP3LibPath"), wxString(wxT("")));
|
||||
gPrefs->Flush();
|
||||
|
||||
return false;
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
#endif // DISABLE_DYNAMIC_LOADING_LAME
|
||||
|
||||
@@ -1764,7 +1764,7 @@ int ExportMP3::Export(AudacityProject *project,
|
||||
(rate < lowrate) || (rate > highrate)) {
|
||||
rate = AskResample(bitrate, rate, lowrate, highrate);
|
||||
if (rate == 0) {
|
||||
return false;
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1782,7 +1782,7 @@ int ExportMP3::Export(AudacityProject *project,
|
||||
auto inSamples = exporter.InitializeStream(channels, rate);
|
||||
if (((int)inSamples) < 0) {
|
||||
wxMessageBox(_("Unable to initialize MP3 stream"));
|
||||
return false;
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
|
||||
// Put ID3 tags at beginning of file
|
||||
@@ -1793,7 +1793,7 @@ int ExportMP3::Export(AudacityProject *project,
|
||||
wxFFile outFile(fName, wxT("w+b"));
|
||||
if (!outFile.IsOpened()) {
|
||||
wxMessageBox(_("Unable to open target file for writing"));
|
||||
return false;
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
|
||||
char *id3buffer = NULL;
|
||||
@@ -1805,7 +1805,7 @@ int ExportMP3::Export(AudacityProject *project,
|
||||
}
|
||||
|
||||
wxFileOffset pos = outFile.Tell();
|
||||
int updateResult = eProgressSuccess;
|
||||
auto updateResult = ProgressResult::Success;
|
||||
long bytes;
|
||||
|
||||
int bufferSize = exporter.GetOutBufferSize();
|
||||
@@ -1843,7 +1843,7 @@ int ExportMP3::Export(AudacityProject *project,
|
||||
|
||||
ProgressDialog progress(wxFileName(fName).GetName(), title);
|
||||
|
||||
while (updateResult == eProgressSuccess) {
|
||||
while (updateResult == ProgressResult::Success) {
|
||||
auto blockLen = mixer->Process(inSamples);
|
||||
|
||||
if (blockLen == 0) {
|
||||
|
||||
@@ -566,7 +566,7 @@ void ExportMultiple::OnExport(wxCommandEvent& WXUNUSED(event))
|
||||
}
|
||||
|
||||
// bool overwrite = mOverwrite->GetValue();
|
||||
int ok;
|
||||
ProgressResult ok;
|
||||
mExported.Empty();
|
||||
|
||||
if (mLabel->GetValue()) {
|
||||
@@ -584,10 +584,10 @@ void ExportMultiple::OnExport(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf(
|
||||
ok == eProgressSuccess ? _("Successfully exported the following %lld file(s).")
|
||||
: (ok == eProgressFailed ? _("Something went wrong after exporting the following %lld file(s).")
|
||||
: (ok == eProgressCancelled ? _("Export canceled after exporting the following %lld file(s).")
|
||||
: (ok == eProgressStopped ? _("Export stopped after exporting the following %lld file(s).")
|
||||
ok == ProgressResult::Success ? _("Successfully exported the following %lld file(s).")
|
||||
: (ok == ProgressResult::Failed ? _("Something went wrong after exporting the following %lld file(s).")
|
||||
: (ok == ProgressResult::Cancelled ? _("Export canceled after exporting the following %lld file(s).")
|
||||
: (ok == ProgressResult::Stopped ? _("Export stopped after exporting the following %lld file(s).")
|
||||
: _("Something went really wrong after exporting the following %lld file(s).")
|
||||
)
|
||||
)
|
||||
@@ -606,7 +606,7 @@ void ExportMultiple::OnExport(wxCommandEvent& WXUNUSED(event))
|
||||
450,400);
|
||||
}
|
||||
|
||||
if (ok == eProgressSuccess || ok == eProgressStopped) {
|
||||
if (ok == ProgressResult::Success || ok == ProgressResult::Stopped) {
|
||||
EndModal(1);
|
||||
}
|
||||
}
|
||||
@@ -637,7 +637,7 @@ bool ExportMultiple::DirOk()
|
||||
}
|
||||
|
||||
// TODO: JKC July2016: Merge labels/tracks duplicated export code.
|
||||
int ExportMultiple::ExportMultipleByLabel(bool byName,
|
||||
ProgressResult ExportMultiple::ExportMultipleByLabel(bool byName,
|
||||
const wxString &prefix, bool addNumber)
|
||||
{
|
||||
wxASSERT(mProject);
|
||||
@@ -732,7 +732,7 @@ int ExportMultiple::ExportMultipleByLabel(bool byName,
|
||||
setting.filetags.SetTag(TAG_TRACK, l+1);
|
||||
// let the user have a crack at editing it, exit if cancelled
|
||||
if( !setting.filetags.ShowEditDialog(mProject, _("Edit Metadata Tags"), tagsPrompt) )
|
||||
return false;
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
|
||||
/* add the settings to the array of settings to be used for export */
|
||||
@@ -741,7 +741,7 @@ int ExportMultiple::ExportMultipleByLabel(bool byName,
|
||||
l++; // next label, count up one
|
||||
}
|
||||
|
||||
int ok = eProgressSuccess; // did it work?
|
||||
auto ok = ProgressResult::Success; // did it work?
|
||||
int count = 0; // count the number of sucessful runs
|
||||
ExportKit activeSetting; // pointer to the settings in use for this export
|
||||
/* Go round again and do the exporting (so this run is slow but
|
||||
@@ -755,7 +755,7 @@ int ExportMultiple::ExportMultipleByLabel(bool byName,
|
||||
|
||||
// Export it
|
||||
ok = DoExport(channels, activeSetting.destfile, false, activeSetting.t0, activeSetting.t1, activeSetting.filetags);
|
||||
if (ok != eProgressSuccess && ok != eProgressStopped) {
|
||||
if (ok != ProgressResult::Success && ok != ProgressResult::Stopped) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -763,14 +763,14 @@ int ExportMultiple::ExportMultipleByLabel(bool byName,
|
||||
return ok;
|
||||
}
|
||||
|
||||
int ExportMultiple::ExportMultipleByTrack(bool byName,
|
||||
ProgressResult ExportMultiple::ExportMultipleByTrack(bool byName,
|
||||
const wxString &prefix, bool addNumber)
|
||||
{
|
||||
wxASSERT(mProject);
|
||||
bool tagsPrompt = mProject->GetShowId3Dialog();
|
||||
Track *tr, *tr2;
|
||||
int l = 0; // track counter
|
||||
int ok = eProgressSuccess;
|
||||
auto ok = ProgressResult::Success;
|
||||
wxArrayString otherNames;
|
||||
std::vector<Track*> selected; /**< Array of pointers to the tracks which were
|
||||
selected when we started */
|
||||
@@ -874,7 +874,7 @@ int ExportMultiple::ExportMultipleByTrack(bool byName,
|
||||
setting.filetags.SetTag(TAG_TRACK, l+1);
|
||||
// let the user have a crack at editing it, exit if cancelled
|
||||
if (!setting.filetags.ShowEditDialog(mProject,_("Edit Metadata Tags"), tagsPrompt))
|
||||
return false;
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
/* add the settings to the array of settings to be used for export */
|
||||
exportSettings.Add(setting);
|
||||
@@ -924,7 +924,7 @@ int ExportMultiple::ExportMultipleByTrack(bool byName,
|
||||
}
|
||||
|
||||
// Stop if an error occurred
|
||||
if (ok != eProgressSuccess && ok != eProgressStopped) {
|
||||
if (ok != ProgressResult::Success && ok != ProgressResult::Stopped) {
|
||||
break;
|
||||
}
|
||||
// increment export counter
|
||||
@@ -939,7 +939,7 @@ int ExportMultiple::ExportMultipleByTrack(bool byName,
|
||||
return ok ;
|
||||
}
|
||||
|
||||
int ExportMultiple::DoExport(unsigned channels,
|
||||
ProgressResult ExportMultiple::DoExport(unsigned channels,
|
||||
const wxFileName &inName,
|
||||
bool selectedOnly,
|
||||
double t0,
|
||||
@@ -956,7 +956,7 @@ int ExportMultiple::DoExport(unsigned channels,
|
||||
if (mOverwrite->GetValue()) {
|
||||
// Make sure we don't overwrite (corrupt) alias files
|
||||
if (!mProject->GetDirManager()->EnsureSafeFilename(inName)) {
|
||||
return false;
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
name = inName;
|
||||
}
|
||||
@@ -971,7 +971,7 @@ int ExportMultiple::DoExport(unsigned channels,
|
||||
|
||||
// Call the format export routine
|
||||
const wxString fullPath{name.GetFullPath()};
|
||||
int success = mPlugins[mPluginIndex]->Export(mProject,
|
||||
auto success = mPlugins[mPluginIndex]->Export(mProject,
|
||||
channels,
|
||||
fullPath,
|
||||
selectedOnly,
|
||||
@@ -981,7 +981,7 @@ int ExportMultiple::DoExport(unsigned channels,
|
||||
&tags,
|
||||
mSubFormatIndex);
|
||||
|
||||
if (success == eProgressSuccess || success == eProgressStopped) {
|
||||
if (success == ProgressResult::Success || success == ProgressResult::Stopped) {
|
||||
mExported.Add(fullPath);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ private:
|
||||
* labels that define them (true), or just numbered (false).
|
||||
* @param prefix The string used to prefix the file number if files are being
|
||||
* numbered rather than named */
|
||||
int ExportMultipleByLabel(bool byName, const wxString &prefix, bool addNumber);
|
||||
ProgressResult ExportMultipleByLabel(bool byName, const wxString &prefix, bool addNumber);
|
||||
|
||||
/** \brief Export each track in the project to a separate file
|
||||
*
|
||||
@@ -62,7 +62,7 @@ private:
|
||||
* (true), or just numbered (false).
|
||||
* @param prefix The string used to prefix the file number if files are being
|
||||
* numbered rather than named */
|
||||
int ExportMultipleByTrack(bool byName, const wxString &prefix, bool addNumber);
|
||||
ProgressResult ExportMultipleByTrack(bool byName, const wxString &prefix, bool addNumber);
|
||||
|
||||
/** Export one file of an export multiple set
|
||||
*
|
||||
@@ -74,7 +74,7 @@ private:
|
||||
* @param t1 End time for export
|
||||
* @param tags Metadata to include in the file (if possible).
|
||||
*/
|
||||
int DoExport(unsigned channels,
|
||||
ProgressResult DoExport(unsigned channels,
|
||||
const wxFileName &name,
|
||||
bool selectedOnly,
|
||||
double t0,
|
||||
|
||||
@@ -132,7 +132,7 @@ public:
|
||||
// Required
|
||||
wxWindow *OptionsCreate(wxWindow *parent, int format) override;
|
||||
|
||||
int Export(AudacityProject *project,
|
||||
ProgressResult Export(AudacityProject *project,
|
||||
unsigned channels,
|
||||
const wxString &fName,
|
||||
bool selectedOnly,
|
||||
@@ -158,7 +158,7 @@ ExportOGG::ExportOGG()
|
||||
SetDescription(_("Ogg Vorbis Files"),0);
|
||||
}
|
||||
|
||||
int ExportOGG::Export(AudacityProject *project,
|
||||
ProgressResult ExportOGG::Export(AudacityProject *project,
|
||||
unsigned numChannels,
|
||||
const wxString &fName,
|
||||
bool selectionOnly,
|
||||
@@ -173,14 +173,14 @@ int ExportOGG::Export(AudacityProject *project,
|
||||
double quality = (gPrefs->Read(wxT("/FileFormats/OggExportQuality"), 50)/(float)100.0);
|
||||
|
||||
wxLogNull logNo; // temporarily disable wxWidgets error messages
|
||||
int updateResult = eProgressSuccess;
|
||||
auto updateResult = ProgressResult::Success;
|
||||
int eos = 0;
|
||||
|
||||
FileIO outFile(fName, FileIO::Output);
|
||||
|
||||
if (!outFile.IsOpened()) {
|
||||
wxMessageBox(_("Unable to open target file for writing"));
|
||||
return false;
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
|
||||
// All the Ogg and Vorbis encoding data
|
||||
@@ -199,7 +199,7 @@ int ExportOGG::Export(AudacityProject *project,
|
||||
|
||||
// Retrieve tags
|
||||
if (!FillComment(project, &comment, metadata)) {
|
||||
return false;
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
|
||||
// Set up analysis state and auxiliary encoding storage
|
||||
@@ -253,7 +253,7 @@ int ExportOGG::Export(AudacityProject *project,
|
||||
_("Exporting the selected audio as Ogg Vorbis") :
|
||||
_("Exporting the entire project as Ogg Vorbis"));
|
||||
|
||||
while (updateResult == eProgressSuccess && !eos) {
|
||||
while (updateResult == ProgressResult::Success && !eos) {
|
||||
float **vorbis_buffer = vorbis_analysis_buffer(&dsp, SAMPLES_PER_RUN);
|
||||
auto samplesThisRun = mixer->Process(SAMPLES_PER_RUN);
|
||||
|
||||
|
||||
@@ -313,7 +313,7 @@ public:
|
||||
// Required
|
||||
|
||||
wxWindow *OptionsCreate(wxWindow *parent, int format);
|
||||
int Export(AudacityProject *project,
|
||||
ProgressResult Export(AudacityProject *project,
|
||||
unsigned channels,
|
||||
const wxString &fName,
|
||||
bool selectedOnly,
|
||||
@@ -384,7 +384,7 @@ ExportPCM::ExportPCM()
|
||||
* @param subformat Control whether we are doing a "preset" export to a popular
|
||||
* file type, or giving the user full control over libsndfile.
|
||||
*/
|
||||
int ExportPCM::Export(AudacityProject *project,
|
||||
ProgressResult ExportPCM::Export(AudacityProject *project,
|
||||
unsigned numChannels,
|
||||
const wxString &fName,
|
||||
bool selectionOnly,
|
||||
@@ -407,7 +407,7 @@ int ExportPCM::Export(AudacityProject *project,
|
||||
sf_format = kFormats[subformat].format;
|
||||
}
|
||||
|
||||
int updateResult = eProgressSuccess;
|
||||
auto updateResult = ProgressResult::Success;
|
||||
{
|
||||
wxFile f; // will be closed when it goes out of scope
|
||||
SFFile sf; // wraps f
|
||||
@@ -436,7 +436,7 @@ int ExportPCM::Export(AudacityProject *project,
|
||||
info.format = (info.format & SF_FORMAT_TYPEMASK);
|
||||
if (!sf_format_check(&info)) {
|
||||
wxMessageBox(_("Cannot export audio in this format."));
|
||||
return false;
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
|
||||
if (f.Open(fName, wxFile::write)) {
|
||||
@@ -451,7 +451,7 @@ int ExportPCM::Export(AudacityProject *project,
|
||||
if (!sf) {
|
||||
wxMessageBox(wxString::Format(_("Cannot export audio to %s"),
|
||||
fName.c_str()));
|
||||
return false;
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
// Retrieve tags if not given a set
|
||||
if (metadata == NULL)
|
||||
@@ -462,7 +462,7 @@ int ExportPCM::Export(AudacityProject *project,
|
||||
if ((sf_format & SF_FORMAT_TYPEMASK) != SF_FORMAT_WAV &&
|
||||
(sf_format & SF_FORMAT_TYPEMASK) != SF_FORMAT_WAVEX) {
|
||||
if (!AddStrings(project, sf.get(), metadata, sf_format)) {
|
||||
return false;
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -491,7 +491,7 @@ int ExportPCM::Export(AudacityProject *project,
|
||||
wxString::Format(_("Exporting the entire project as %s"),
|
||||
formatStr.c_str()));
|
||||
|
||||
while (updateResult == eProgressSuccess) {
|
||||
while (updateResult == ProgressResult::Success) {
|
||||
sf_count_t samplesWritten;
|
||||
auto numSamples = mixer->Process(maxBlockLen);
|
||||
|
||||
@@ -526,7 +526,7 @@ int ExportPCM::Export(AudacityProject *project,
|
||||
if ((sf_format & SF_FORMAT_TYPEMASK) == SF_FORMAT_WAV ||
|
||||
(sf_format & SF_FORMAT_TYPEMASK) == SF_FORMAT_WAVEX) {
|
||||
if (!AddStrings(project, sf.get(), metadata, sf_format)) {
|
||||
return false;
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user