diff --git a/src/Menus.cpp b/src/Menus.cpp index 7b7d2fcae..07b069cd8 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -69,7 +69,7 @@ simplifies construction of menu items. #include "MixerBoard.h" #include "Internat.h" #include "FileFormats.h" -#include "LoadModules.h" +#include "LoadModules.h" #include "Prefs.h" #include "Printing.h" #include "UploadDialog.h" @@ -279,12 +279,12 @@ void AudacityProject::CreateMenusAndCommands() ///////////////////////////////////////////////////////////////////////////// - // Enable Export commands only when there are tracks + // Enable Export audio commands only when there are audio tracks. c->AddItem(wxT("Export"), _("&Export..."), FN(OnExport), wxT("Ctrl+Shift+E"), AudioIONotBusyFlag | WaveTracksExistFlag, AudioIONotBusyFlag | WaveTracksExistFlag); - // Enable Export Selection commands only when there's a selection + // Enable Export Selection commands only when there's a selection. c->AddItem(wxT("ExportSel"), _("Expo&rt Selection..."), FN(OnExportSelection), AudioIONotBusyFlag | TimeSelectedFlag | WaveTracksSelectedFlag, AudioIONotBusyFlag | TimeSelectedFlag | WaveTracksSelectedFlag); @@ -296,9 +296,10 @@ void AudacityProject::CreateMenusAndCommands() c->AddItem(wxT("ExportLabels"), _("Export &Labels..."), FN(OnExportLabels), AudioIONotBusyFlag | LabelTracksExistFlag, AudioIONotBusyFlag | LabelTracksExistFlag); + // Enable Export audio commands only when there are audio tracks. c->AddItem(wxT("ExportMultiple"), _("Export &Multiple..."), FN(OnExportMultiple), wxT("Ctrl+Shift+L"), - AudioIONotBusyFlag | TracksExistFlag, - AudioIONotBusyFlag | TracksExistFlag); + AudioIONotBusyFlag | WaveTracksExistFlag, + AudioIONotBusyFlag | WaveTracksExistFlag); #if defined(USE_MIDI) c->AddItem(wxT("ExportMIDI"), _("Export MIDI..."), FN(OnExportMIDI), AudioIONotBusyFlag | NoteTracksSelectedFlag, @@ -311,9 +312,10 @@ void AudacityProject::CreateMenusAndCommands() c->AddItem(wxT("ExportLabels"), _("Export &Labels..."), FN(OnExportLabels), AudioIONotBusyFlag | LabelTracksExistFlag, AudioIONotBusyFlag | LabelTracksExistFlag); + // Enable Export audio commands only when there are audio tracks. c->AddItem(wxT("ExportMultiple"), _("Export &Multiple..."), FN(OnExportMultiple), wxT("Ctrl+Shift+L"), - AudioIONotBusyFlag | TracksExistFlag, - AudioIONotBusyFlag | TracksExistFlag); + AudioIONotBusyFlag | WaveTracksExistFlag, + AudioIONotBusyFlag | WaveTracksExistFlag); #if defined(USE_MIDI) c->AddItem(wxT("ExportMIDI"), _("Export MIDI..."), FN(OnExportMIDI), AudioIONotBusyFlag | NoteTracksSelectedFlag, @@ -755,17 +757,17 @@ void AudacityProject::CreateMenusAndCommands() c->BeginMenu(_("&Tracks")); c->SetDefaultFlags(AudioIONotBusyFlag, AudioIONotBusyFlag); - + ////////////////////////////////////////////////////////////////////////// - c->BeginSubMenu(_("Add &New")); + c->BeginSubMenu(_("Add &New")); c->AddItem(wxT("NewAudioTrack"), _("&Audio Track"), FN(OnNewWaveTrack), wxT("Ctrl+Shift+N")); c->AddItem(wxT("NewStereoTrack"), _("&Stereo Track"), FN(OnNewStereoTrack)); c->AddItem(wxT("NewLabelTrack"), _("&Label Track"), FN(OnNewLabelTrack)); c->AddItem(wxT("NewTimeTrack"), _("&Time Track"), FN(OnNewTimeTrack)); - c->EndSubMenu(); + c->EndSubMenu(); ////////////////////////////////////////////////////////////////////////// @@ -953,17 +955,17 @@ void AudacityProject::CreateMenusAndCommands() c->BeginMenu(_("&Tracks")); c->SetDefaultFlags(AudioIONotBusyFlag, AudioIONotBusyFlag); - + ////////////////////////////////////////////////////////////////////////// - c->BeginSubMenu(_("Add &New")); + c->BeginSubMenu(_("Add &New")); c->AddItem(wxT("NewAudioTrack"), _("&Audio Track"), FN(OnNewWaveTrack), wxT("Ctrl+Shift+N")); c->AddItem(wxT("NewStereoTrack"), _("&Stereo Track"), FN(OnNewStereoTrack)); c->AddItem(wxT("NewLabelTrack"), _("&Label Track"), FN(OnNewLabelTrack)); c->AddItem(wxT("NewTimeTrack"), _("&Time Track"), FN(OnNewTimeTrack)); - c->EndSubMenu(); + c->EndSubMenu(); ////////////////////////////////////////////////////////////////////////// @@ -1413,7 +1415,7 @@ void AudacityProject::CreateMenusAndCommands() #ifdef CLEANSPEECH if (mCleanSpeechMode) { - c->AddItem(wxT("About"), _("&About Audacity CleanSpeech..."), FN(OnAbout)); + c->AddItem(wxT("About"), _("&About Audacity CleanSpeech..."), FN(OnAbout)); } else { c->AddItem(wxT("About"), _("&About Audacity..."), FN(OnAbout)); @@ -1988,9 +1990,9 @@ void AudacityProject::ModifyToolbarMenus() void AudacityProject::UpdateMenus() { - //ANSWER-ME: Why UpdateMenus only does active project? - //JKC: Is this test fixing a bug when multiple projects are open? - //so that menu states work even when different in different projects? + //ANSWER-ME: Why UpdateMenus only does active project? + //JKC: Is this test fixing a bug when multiple projects are open? + //so that menu states work even when different in different projects? if (this != GetActiveProject()) return; diff --git a/src/Track.cpp b/src/Track.cpp index 808465f40..8f3b6683b 100644 --- a/src/Track.cpp +++ b/src/Track.cpp @@ -1060,10 +1060,9 @@ int TrackList::GetNumExportChannels(bool selectionOnly) for (tr = iter.First(this); tr != NULL; tr = iter.Next()) { - // Only want wave tracks - if (tr->GetKind() != Track::Wave) { + // Want only unmuted wave tracks. + if ((tr->GetKind() != Track::Wave) || tr->GetMute()) continue; - } // do we only want selected ones? if (selectionOnly && !(tr->GetSelected())) { @@ -1242,14 +1241,3 @@ double TrackList::GetEndTime() const return max; } -// Indentation settings for Vim and Emacs and unique identifier for Arch, a -// version control system. Please do not modify past this point. -// -// Local Variables: -// c-basic-offset: 3 -// indent-tabs-mode: nil -// End: -// -// vim: et sts=3 sw=3 -// arch-tag: 575d97aa-2da9-476d-a39e-2ccad16b7cdd - diff --git a/src/export/ExportMultiple.cpp b/src/export/ExportMultiple.cpp index 82e9759c1..7fee083bf 100644 --- a/src/export/ExportMultiple.cpp +++ b/src/export/ExportMultiple.cpp @@ -150,7 +150,7 @@ void ExportMultiple::CountTracksAndLabels() // Count WaveTracks, and for linked pairs, count only the second of the pair. case Track::Wave: { - if (pTrack->GetLinked() == false) + if (!pTrack->GetMute() && !pTrack->GetLinked()) // Don't count muted tracks. mNumWaveTracks++; break; } @@ -175,9 +175,17 @@ int ExportMultiple::ShowModal() ::wxMessageBox(_("If you have more than one Audio Track, you can\nexport each track \ as a separate audio file.\n\nIf you have a Label Track, you can export a separate\naudio file \ for each label in that track. You can have\nmore than one Label Track, but files will only \ -be\nexported for the uppermost Label Track.\n\nThis Project does not meet the above criteria \ -for\nexporting multiple files."), - _("Can't export multiple files"), +be\nexported for the uppermost Label Track.\n\nMuted tracks will not be exported.\n\nThis \ +Project does not meet the above criteria for\nexporting multiple files."), + _("Cannot Export Multiple Files"), + wxOK | wxCENTRE, this); + return wxID_CANCEL; + } + + // Cannot export if all audio tracks are muted. + if (mNumWaveTracks == 0) { + ::wxMessageBox(_("All the audio is muted."), + _("Cannot Export Multiple Files"), wxOK | wxCENTRE, this); return wxID_CANCEL; } @@ -591,7 +599,7 @@ int ExportMultiple::ExportMultipleByLabel(bool byName, int l = 0; // counter for files done ExportKitArray exportSettings; // dynamic array we will use to store the // settings needed to do the exports with in - exportSettings.Alloc(numFiles); // allocated some guessed space to use + exportSettings.Alloc(numFiles); // Allocate some guessed space to use. // Account for exporting before first label if (mFirst->GetValue()) { @@ -599,8 +607,8 @@ int ExportMultiple::ExportMultipleByLabel(bool byName, numFiles++; } - // Figure out how many channels we should export - int channels = (mTracks->GetNumExportChannels(false)); + // Figure out how many channels we should export. + int channels = mTracks->GetNumExportChannels(false); wxArrayString otherNames; // keep track of file names we will use, so we // don't duplicate them @@ -705,7 +713,6 @@ int ExportMultiple::ExportMultipleByTrack(bool byName, wxASSERT(mProject); bool tagsPrompt = mProject->GetShowId3Dialog(); Track *tr, *tr2; - int channels = 0; // how many channels export? int l = 0; // track counter int numTracks = 0; int ok = eProgressSuccess; @@ -714,7 +721,7 @@ int ExportMultiple::ExportMultipleByTrack(bool byName, selected when we started */ ExportKitArray exportSettings; // dynamic array we will use to store the // settings needed to do the exports with in - exportSettings.Alloc(mNumLabels); // allocated some guessed space to use + exportSettings.Alloc(mNumWaveTracks); // Allocate some guessed space to use. ExportKit setting; // the current batch of settings setting.destfile.SetPath(mDir->GetValue()); setting.destfile.SetExt(mPlugins[mPluginIndex]->GetExtension(mSubFormatIndex)); @@ -741,10 +748,9 @@ int ExportMultiple::ExportMultipleByTrack(bool byName, /* Examine all tracks in turn, collecting export information */ for (tr = mIterator.First(mTracks); tr != NULL; tr = mIterator.Next()) { - // Only want wave tracks - if (tr->GetKind() != Track::Wave) { + // Want only non-muted wave tracks. + if ((tr->GetKind() != Track::Wave) || tr->GetMute()) continue; - } // Get the times for the track setting.t0 = tr->GetStartTime(); @@ -768,11 +774,12 @@ int ExportMultiple::ExportMultipleByTrack(bool byName, } // number of export channels? + // Needs to be per track. if (tr2 == NULL && tr->GetChannel() == WaveTrack::MonoChannel && ((WaveTrack *)tr)->GetPan() == 0.0) - channels = 1; + setting.channels = 1; else - channels = 2; + setting.channels = 2; // Get name and title title = tr->GetName(); @@ -783,7 +790,7 @@ int ExportMultiple::ExportMultipleByTrack(bool byName, name = title; if (addNumber) { name.Prepend(wxString::Format(wxT("%02d-"), l+1)); - } + } } else { name = (wxString::Format(wxT("%s-%02d"), prefix.c_str(), l+1)); @@ -823,8 +830,8 @@ int ExportMultiple::ExportMultipleByTrack(bool byName, ExportKit activeSetting; // pointer to the settings in use for this export for (tr = mIterator.First(mTracks); tr != NULL; tr = mIterator.Next()) { - // Only want wave tracks - if (tr->GetKind() != Track::Wave) { + // Want only non-muted wave tracks. + if ((tr->GetKind() != Track::Wave) || (tr->GetMute() == true)) { continue; } @@ -843,8 +850,8 @@ int ExportMultiple::ExportMultipleByTrack(bool byName, /* get the settings to use for the export from the array */ activeSetting = exportSettings[count]; - // export data - ok = DoExport(channels, activeSetting.destfile, true, activeSetting.t0, activeSetting.t1, activeSetting.filetags); + // Export the data. "channels" are per track. + ok = DoExport(activeSetting.channels, activeSetting.destfile, true, activeSetting.t0, activeSetting.t1, activeSetting.filetags); // Reset selection state tr->SetSelected(false); @@ -959,14 +966,3 @@ void MouseEvtHandler::OnMouse(wxMouseEvent& event) { event.Skip(false); } - -// Indentation settings for Vim and Emacs and unique identifier for Arch, a -// version control system. Please do not modify past this point. -// -// Local Variables: -// c-basic-offset: 3 -// indent-tabs-mode: nil -// End: -// -// vim: et sts=3 sw=3 -// arch-tag: d6904b91-a320-4194-8d60-caa9175b6bb4 diff --git a/src/export/ExportMultiple.h b/src/export/ExportMultiple.h index acd106916..5576ba21f 100644 --- a/src/export/ExportMultiple.h +++ b/src/export/ExportMultiple.h @@ -190,7 +190,7 @@ private: * export. * * We create a set of these during the interactive phase of the export - * cycle, then use them when the actual exports are done */ + * cycle, then use them when the actual exports are done. */ class ExportKit { public: @@ -198,6 +198,7 @@ private: wxFileName destfile; /**< The file to export to */ double t0; /**< Start time for the export */ double t1; /**< End time for the export */ + int channels; /**< Number of channels for ExportMultipleByTrack */ }; // end of ExportKit declaration /* we are going to want an set of these kits, and don't know how many until * runtime. I would dearly like to use a std::vector, but it seems that @@ -208,14 +209,3 @@ private: #endif - -// Indentation settings for Vim and Emacs and unique identifier for Arch, a -// version control system. Please do not modify past this point. -// -// Local Variables: -// c-basic-offset: 3 -// indent-tabs-mode: nil -// End: -// -// vim: et sts=3 sw=3 -// arch-tag: d6904b91-a320-4194-8d60-caa9175b6bb4