mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-17 16:40:07 +02:00
Bug 2062 - Export as WAV does not remember the previously used setting
This should resolve the final nit for this bug.
This commit is contained in:
parent
8d3e6eb2ad
commit
e09b35f2c8
@ -625,18 +625,34 @@ bool ProjectFileManager::SaveCopyWaveTracks(const FilePath & strProjectPathName,
|
|||||||
auto &trackFactory = TrackFactory::Get( project );
|
auto &trackFactory = TrackFactory::Get( project );
|
||||||
|
|
||||||
wxString extension, fileFormat;
|
wxString extension, fileFormat;
|
||||||
#ifdef USE_LIBVORBIS
|
bool haveVorbis =
|
||||||
if (bLossless) {
|
#if defined(USE_LIBVORBIS)
|
||||||
extension = wxT("wav");
|
true;
|
||||||
fileFormat = wxT("WAVFLT");
|
#else
|
||||||
} else {
|
false;
|
||||||
|
#endif
|
||||||
|
if (!bLossless && haveVorbis) {
|
||||||
extension = wxT("ogg");
|
extension = wxT("ogg");
|
||||||
fileFormat = wxT("OGG");
|
fileFormat = wxT("OGG");
|
||||||
|
} else{
|
||||||
|
extension = wxT("wav");
|
||||||
|
fileFormat = wxT("WAV");
|
||||||
|
|
||||||
|
// LLL: Temporary hack until I can figure out how to add an "ExportPCMCommand"
|
||||||
|
// to create a 32-bit float WAV file. It tells the ExportPCM exporter
|
||||||
|
// to use float when exporting the next WAV file.
|
||||||
|
//
|
||||||
|
// This was done as part of the resolution for bug #2062.
|
||||||
|
//
|
||||||
|
// See: ExportPCM.cpp, LoadEncoding()
|
||||||
|
auto cleanup = finally([&] {
|
||||||
|
gPrefs->DeleteEntry(wxT("/FileFormats/ExportFormat_SF1_ForceFloat"));
|
||||||
|
gPrefs->Flush();
|
||||||
|
});
|
||||||
|
gPrefs->Write(wxT("/FileFormats/ExportFormat_SF1_ForceFloat"), true);
|
||||||
|
gPrefs->Flush();
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
extension = wxT("wav");
|
|
||||||
fileFormat = wxT("WAVFLT");
|
|
||||||
#endif
|
|
||||||
// Some of this is similar to code in ExportMultipleDialog::ExportMultipleByTrack
|
// Some of this is similar to code in ExportMultipleDialog::ExportMultipleByTrack
|
||||||
// but that code is really tied into the dialogs.
|
// but that code is really tied into the dialogs.
|
||||||
|
|
||||||
|
@ -62,8 +62,6 @@ static const kFormats[] =
|
|||||||
{SF_FORMAT_AIFF | SF_FORMAT_PCM_16, wxT("AIFF"), XO("AIFF (Apple/SGI)")},
|
{SF_FORMAT_AIFF | SF_FORMAT_PCM_16, wxT("AIFF"), XO("AIFF (Apple/SGI)")},
|
||||||
#endif
|
#endif
|
||||||
{SF_FORMAT_WAV | SF_FORMAT_PCM_16, wxT("WAV"), XO("WAV (Microsoft)")},
|
{SF_FORMAT_WAV | SF_FORMAT_PCM_16, wxT("WAV"), XO("WAV (Microsoft)")},
|
||||||
{SF_FORMAT_WAV | SF_FORMAT_PCM_24, wxT("WAV24"), XO("WAV (Microsoft) signed 24-bit PCM")},
|
|
||||||
{SF_FORMAT_WAV | SF_FORMAT_FLOAT, wxT("WAVFLT"), XO("WAV (Microsoft) 32-bit float PCM")},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@ -72,8 +70,6 @@ enum
|
|||||||
FMT_AIFF,
|
FMT_AIFF,
|
||||||
#endif
|
#endif
|
||||||
FMT_WAV,
|
FMT_WAV,
|
||||||
FMT_WAV24,
|
|
||||||
FMT_WAVFLT,
|
|
||||||
FMT_OTHER
|
FMT_OTHER
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -83,18 +79,33 @@ enum
|
|||||||
|
|
||||||
static int LoadOtherFormat(int def = 0)
|
static int LoadOtherFormat(int def = 0)
|
||||||
{
|
{
|
||||||
return gPrefs->Read(wxString::Format(wxT("/FileFormats/ExportFormat_SF1")),
|
return gPrefs->Read(wxT("/FileFormats/ExportFormat_SF1"),
|
||||||
kFormats[0].format & SF_FORMAT_TYPEMASK);
|
kFormats[0].format & SF_FORMAT_TYPEMASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SaveOtherFormat(int val)
|
static void SaveOtherFormat(int val)
|
||||||
{
|
{
|
||||||
gPrefs->Write(wxString::Format(wxT("/FileFormats/ExportFormat_SF1")), val);
|
gPrefs->Write(wxT("/FileFormats/ExportFormat_SF1"), val);
|
||||||
gPrefs->Flush();
|
gPrefs->Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int LoadEncoding(int type)
|
static int LoadEncoding(int type)
|
||||||
{
|
{
|
||||||
|
// LLL: Temporary hack until I can figure out how to add an "ExportPCMCommand"
|
||||||
|
// to create a 32-bit float WAV file. It tells the ExportPCM exporter
|
||||||
|
// to use float when exporting the next WAV file.
|
||||||
|
//
|
||||||
|
// This was done as part of the resolution for bug #2062.
|
||||||
|
//
|
||||||
|
// See: ProjectFileManager.cpp, ProjectFileManager::SaveCopyWaveTracks()
|
||||||
|
if (gPrefs->HasEntry(wxT("/FileFormats/ExportFormat_SF1_ForceFloat")))
|
||||||
|
{
|
||||||
|
gPrefs->DeleteEntry(wxT("/FileFormats/ExportFormat_SF1_ForceFloat"));
|
||||||
|
gPrefs->Flush();
|
||||||
|
|
||||||
|
return SF_FORMAT_FLOAT;
|
||||||
|
}
|
||||||
|
|
||||||
return gPrefs->Read(wxString::Format(wxT("/FileFormats/ExportFormat_SF1_Type/%s_%x"),
|
return gPrefs->Read(wxString::Format(wxT("/FileFormats/ExportFormat_SF1_Type/%s_%x"),
|
||||||
sf_header_shortname(type), type), (long int) 0);
|
sf_header_shortname(type), type), (long int) 0);
|
||||||
}
|
}
|
||||||
@ -492,11 +503,6 @@ ProgressResult ExportPCM::Export(AudacityProject *project,
|
|||||||
sf_format = SF_FORMAT_WAV;
|
sf_format = SF_FORMAT_WAV;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FMT_WAV24:
|
|
||||||
case FMT_WAVFLT:
|
|
||||||
sf_format = kFormats[subformat].format;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Retrieve the current format.
|
// Retrieve the current format.
|
||||||
sf_format = LoadOtherFormat();
|
sf_format = LoadOtherFormat();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user