1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-04 09:39:42 +02:00

Merge branch 'master' of github.com:audacity/audacity

This commit is contained in:
Paul Licameli 2016-04-13 00:12:57 -04:00
commit c760361867
4 changed files with 41 additions and 7 deletions

View File

@ -748,6 +748,7 @@ bool Exporter::CheckMix()
// and if mixing will occur.
int downMix = gPrefs->Read(wxT("/FileFormats/ExportDownMix"), true);
int exportedChannels = mPlugins[mFormat]->SetNumExportChannels();
if (downMix) {
if (mNumRight > 0 || mNumLeft > 0) {
@ -763,7 +764,18 @@ bool Exporter::CheckMix()
int numRight = mNumRight + mNumMono;
if (numLeft > 1 || numRight > 1 || mNumLeft + mNumRight + mNumMono > mChannels) {
if (mChannels == 2) {
wxString exportFormat = mPlugins[mFormat]->GetFormat(mSubFormat);
if (exportFormat != wxT("CL") && exportFormat != wxT("FFMPEG") && exportedChannels == -1)
exportedChannels = mChannels;
if (exportedChannels == 1) {
if (ShowWarningDialog(mProject,
wxT("MixMono"),
_("Your tracks will be mixed down to a single mono channel in the exported file."),
true) == wxID_CANCEL)
return false;
}
else if (exportedChannels == 2) {
if (ShowWarningDialog(mProject,
wxT("MixStereo"),
_("Your tracks will be mixed down to two stereo channels in the exported file."),
@ -772,8 +784,8 @@ bool Exporter::CheckMix()
}
else {
if (ShowWarningDialog(mProject,
wxT("MixMono"),
_("Your tracks will be mixed down to a single mono channel in the exported file."),
wxT("MixUnknownChannels"),
_("Your tracks will be mixed down to one exported file according to the encoder settings."),
true) == wxID_CANCEL)
return false;
}
@ -781,9 +793,12 @@ bool Exporter::CheckMix()
}
else
{
if (exportedChannels == -1)
exportedChannels = mPlugins[mFormat]->GetMaxChannels(mSubFormat);
ExportMixerDialog md(mProject->GetTracks(),
mSelectedOnly,
mPlugins[mFormat]->GetMaxChannels(mSubFormat),
exportedChannels,
NULL,
1,
_("Advanced Mixing Options"));
@ -1259,8 +1274,11 @@ ExportMixerDialog::ExportMixerDialog( const TrackList *tracks, bool selectedOnly
// state the number of channels - so we assume there are always at least two.
// The downside is that if someone is exporting to a mono device, the dialog
// will allow them to output to two channels. Hmm. We may need to revisit this.
if (maxNumChannels < 2 )
maxNumChannels = 2;
// STF (April 2016): AMR (narrowband) and MP3 may export 1 channel.
// maxNumChannels = 2;
maxNumChannels = 1;
if (maxNumChannels > 32)
maxNumChannels = 32;

View File

@ -90,6 +90,9 @@ public:
virtual wxWindow *OptionsCreate(wxWindow *parent, int format) = 0;
virtual bool CheckFileName(wxFileName &filename, int format = 0);
/** @brief Exporter plug-ins may override this to specify the number
* of channels in exported file. -1 for unspecified */
virtual int SetNumExportChannels() { return -1; }
/** \brief called to export audio into a file.
*

View File

@ -1605,6 +1605,7 @@ private:
#ifdef USE_LIBID3TAG
void AddFrame(struct id3_tag *tp, const wxString & n, const wxString & v, const char *name);
#endif
int SetNumExportChannels() override;
};
ExportMP3::ExportMP3()
@ -1636,6 +1637,15 @@ bool ExportMP3::CheckFileName(wxFileName & WXUNUSED(filename), int WXUNUSED(form
return true;
}
int ExportMP3::SetNumExportChannels()
{
bool mono;
gPrefs->Read(wxT("/FileFormats/MP3ForceMono"), &mono, 0);
return (mono)? 1 : -1;
}
int ExportMP3::Export(AudacityProject *project,
int channels,
const wxString &fName,

View File

@ -63,11 +63,14 @@ void WarningsPrefs::PopulateOrExchange(ShuttleGui & S)
S.TieCheckBox(_("&Low disk space at program start up"),
wxT("/Warnings/DiskSpaceWarning"),
true);
S.TieCheckBox(_("Mixing down to &mono during export"),
wxT("/Warnings/MixMono"),
true);
S.TieCheckBox(_("Mixing down to &stereo during export"),
wxT("/Warnings/MixStereo"),
true);
S.TieCheckBox(_("Mixing down to &mono during export"),
wxT("/Warnings/MixMono"),
S.TieCheckBox(_("Mixing down on export (Custom FFmpeg or external program)"),
wxT("/Warnings/MixUnknownChannels"),
true);
S.TieCheckBox(_("&Importing uncompressed audio files"),
wxT("/Warnings/CopyOrEditUncompressedDataAsk"),