1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-03 17:19:43 +02:00

modified version of Steve's patch for bugs 428 and 430

This commit is contained in:
v.audacity 2013-01-05 00:05:59 +00:00
parent 97677e1d9f
commit 72825001f5
4 changed files with 49 additions and 73 deletions

View File

@ -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"), c->AddItem(wxT("Export"), _("&Export..."), FN(OnExport), wxT("Ctrl+Shift+E"),
AudioIONotBusyFlag | WaveTracksExistFlag, AudioIONotBusyFlag | WaveTracksExistFlag,
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), c->AddItem(wxT("ExportSel"), _("Expo&rt Selection..."), FN(OnExportSelection),
AudioIONotBusyFlag | TimeSelectedFlag | WaveTracksSelectedFlag, AudioIONotBusyFlag | TimeSelectedFlag | WaveTracksSelectedFlag,
AudioIONotBusyFlag | TimeSelectedFlag | WaveTracksSelectedFlag); AudioIONotBusyFlag | TimeSelectedFlag | WaveTracksSelectedFlag);
@ -296,9 +296,10 @@ void AudacityProject::CreateMenusAndCommands()
c->AddItem(wxT("ExportLabels"), _("Export &Labels..."), FN(OnExportLabels), c->AddItem(wxT("ExportLabels"), _("Export &Labels..."), FN(OnExportLabels),
AudioIONotBusyFlag | LabelTracksExistFlag, AudioIONotBusyFlag | LabelTracksExistFlag,
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"), c->AddItem(wxT("ExportMultiple"), _("Export &Multiple..."), FN(OnExportMultiple), wxT("Ctrl+Shift+L"),
AudioIONotBusyFlag | TracksExistFlag, AudioIONotBusyFlag | WaveTracksExistFlag,
AudioIONotBusyFlag | TracksExistFlag); AudioIONotBusyFlag | WaveTracksExistFlag);
#if defined(USE_MIDI) #if defined(USE_MIDI)
c->AddItem(wxT("ExportMIDI"), _("Export MIDI..."), FN(OnExportMIDI), c->AddItem(wxT("ExportMIDI"), _("Export MIDI..."), FN(OnExportMIDI),
AudioIONotBusyFlag | NoteTracksSelectedFlag, AudioIONotBusyFlag | NoteTracksSelectedFlag,
@ -311,9 +312,10 @@ void AudacityProject::CreateMenusAndCommands()
c->AddItem(wxT("ExportLabels"), _("Export &Labels..."), FN(OnExportLabels), c->AddItem(wxT("ExportLabels"), _("Export &Labels..."), FN(OnExportLabels),
AudioIONotBusyFlag | LabelTracksExistFlag, AudioIONotBusyFlag | LabelTracksExistFlag,
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"), c->AddItem(wxT("ExportMultiple"), _("Export &Multiple..."), FN(OnExportMultiple), wxT("Ctrl+Shift+L"),
AudioIONotBusyFlag | TracksExistFlag, AudioIONotBusyFlag | WaveTracksExistFlag,
AudioIONotBusyFlag | TracksExistFlag); AudioIONotBusyFlag | WaveTracksExistFlag);
#if defined(USE_MIDI) #if defined(USE_MIDI)
c->AddItem(wxT("ExportMIDI"), _("Export MIDI..."), FN(OnExportMIDI), c->AddItem(wxT("ExportMIDI"), _("Export MIDI..."), FN(OnExportMIDI),
AudioIONotBusyFlag | NoteTracksSelectedFlag, AudioIONotBusyFlag | NoteTracksSelectedFlag,
@ -758,14 +760,14 @@ void AudacityProject::CreateMenusAndCommands()
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
c->BeginSubMenu(_("Add &New")); c->BeginSubMenu(_("Add &New"));
c->AddItem(wxT("NewAudioTrack"), _("&Audio Track"), FN(OnNewWaveTrack), wxT("Ctrl+Shift+N")); c->AddItem(wxT("NewAudioTrack"), _("&Audio Track"), FN(OnNewWaveTrack), wxT("Ctrl+Shift+N"));
c->AddItem(wxT("NewStereoTrack"), _("&Stereo Track"), FN(OnNewStereoTrack)); c->AddItem(wxT("NewStereoTrack"), _("&Stereo Track"), FN(OnNewStereoTrack));
c->AddItem(wxT("NewLabelTrack"), _("&Label Track"), FN(OnNewLabelTrack)); c->AddItem(wxT("NewLabelTrack"), _("&Label Track"), FN(OnNewLabelTrack));
c->AddItem(wxT("NewTimeTrack"), _("&Time Track"), FN(OnNewTimeTrack)); c->AddItem(wxT("NewTimeTrack"), _("&Time Track"), FN(OnNewTimeTrack));
c->EndSubMenu(); c->EndSubMenu();
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
@ -956,14 +958,14 @@ void AudacityProject::CreateMenusAndCommands()
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
c->BeginSubMenu(_("Add &New")); c->BeginSubMenu(_("Add &New"));
c->AddItem(wxT("NewAudioTrack"), _("&Audio Track"), FN(OnNewWaveTrack), wxT("Ctrl+Shift+N")); c->AddItem(wxT("NewAudioTrack"), _("&Audio Track"), FN(OnNewWaveTrack), wxT("Ctrl+Shift+N"));
c->AddItem(wxT("NewStereoTrack"), _("&Stereo Track"), FN(OnNewStereoTrack)); c->AddItem(wxT("NewStereoTrack"), _("&Stereo Track"), FN(OnNewStereoTrack));
c->AddItem(wxT("NewLabelTrack"), _("&Label Track"), FN(OnNewLabelTrack)); c->AddItem(wxT("NewLabelTrack"), _("&Label Track"), FN(OnNewLabelTrack));
c->AddItem(wxT("NewTimeTrack"), _("&Time Track"), FN(OnNewTimeTrack)); c->AddItem(wxT("NewTimeTrack"), _("&Time Track"), FN(OnNewTimeTrack));
c->EndSubMenu(); c->EndSubMenu();
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
@ -1413,7 +1415,7 @@ void AudacityProject::CreateMenusAndCommands()
#ifdef CLEANSPEECH #ifdef CLEANSPEECH
if (mCleanSpeechMode) { if (mCleanSpeechMode) {
c->AddItem(wxT("About"), _("&About Audacity CleanSpeech..."), FN(OnAbout)); c->AddItem(wxT("About"), _("&About Audacity CleanSpeech..."), FN(OnAbout));
} }
else { else {
c->AddItem(wxT("About"), _("&About Audacity..."), FN(OnAbout)); c->AddItem(wxT("About"), _("&About Audacity..."), FN(OnAbout));
@ -1988,9 +1990,9 @@ void AudacityProject::ModifyToolbarMenus()
void AudacityProject::UpdateMenus() void AudacityProject::UpdateMenus()
{ {
//ANSWER-ME: Why UpdateMenus only does active project? //ANSWER-ME: Why UpdateMenus only does active project?
//JKC: Is this test fixing a bug when multiple projects are open? //JKC: Is this test fixing a bug when multiple projects are open?
//so that menu states work even when different in different projects? //so that menu states work even when different in different projects?
if (this != GetActiveProject()) if (this != GetActiveProject())
return; return;

View File

@ -1060,10 +1060,9 @@ int TrackList::GetNumExportChannels(bool selectionOnly)
for (tr = iter.First(this); tr != NULL; tr = iter.Next()) { for (tr = iter.First(this); tr != NULL; tr = iter.Next()) {
// Only want wave tracks // Want only unmuted wave tracks.
if (tr->GetKind() != Track::Wave) { if ((tr->GetKind() != Track::Wave) || tr->GetMute())
continue; continue;
}
// do we only want selected ones? // do we only want selected ones?
if (selectionOnly && !(tr->GetSelected())) { if (selectionOnly && !(tr->GetSelected())) {
@ -1242,14 +1241,3 @@ double TrackList::GetEndTime() const
return max; 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

View File

@ -150,7 +150,7 @@ void ExportMultiple::CountTracksAndLabels()
// Count WaveTracks, and for linked pairs, count only the second of the pair. // Count WaveTracks, and for linked pairs, count only the second of the pair.
case Track::Wave: case Track::Wave:
{ {
if (pTrack->GetLinked() == false) if (!pTrack->GetMute() && !pTrack->GetLinked()) // Don't count muted tracks.
mNumWaveTracks++; mNumWaveTracks++;
break; break;
} }
@ -175,9 +175,17 @@ int ExportMultiple::ShowModal()
::wxMessageBox(_("If you have more than one Audio Track, you can\nexport each track \ ::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 \ 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 \ 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 \ be\nexported for the uppermost Label Track.\n\nMuted tracks will not be exported.\n\nThis \
for\nexporting multiple files."), Project does not meet the above criteria for\nexporting multiple files."),
_("Can't export 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); wxOK | wxCENTRE, this);
return wxID_CANCEL; return wxID_CANCEL;
} }
@ -591,7 +599,7 @@ int ExportMultiple::ExportMultipleByLabel(bool byName,
int l = 0; // counter for files done int l = 0; // counter for files done
ExportKitArray exportSettings; // dynamic array we will use to store the ExportKitArray exportSettings; // dynamic array we will use to store the
// settings needed to do the exports with in // 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 // Account for exporting before first label
if (mFirst->GetValue()) { if (mFirst->GetValue()) {
@ -599,8 +607,8 @@ int ExportMultiple::ExportMultipleByLabel(bool byName,
numFiles++; numFiles++;
} }
// Figure out how many channels we should export // Figure out how many channels we should export.
int channels = (mTracks->GetNumExportChannels(false)); int channels = mTracks->GetNumExportChannels(false);
wxArrayString otherNames; // keep track of file names we will use, so we wxArrayString otherNames; // keep track of file names we will use, so we
// don't duplicate them // don't duplicate them
@ -705,7 +713,6 @@ int ExportMultiple::ExportMultipleByTrack(bool byName,
wxASSERT(mProject); wxASSERT(mProject);
bool tagsPrompt = mProject->GetShowId3Dialog(); bool tagsPrompt = mProject->GetShowId3Dialog();
Track *tr, *tr2; Track *tr, *tr2;
int channels = 0; // how many channels export?
int l = 0; // track counter int l = 0; // track counter
int numTracks = 0; int numTracks = 0;
int ok = eProgressSuccess; int ok = eProgressSuccess;
@ -714,7 +721,7 @@ int ExportMultiple::ExportMultipleByTrack(bool byName,
selected when we started */ selected when we started */
ExportKitArray exportSettings; // dynamic array we will use to store the ExportKitArray exportSettings; // dynamic array we will use to store the
// settings needed to do the exports with in // 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 ExportKit setting; // the current batch of settings
setting.destfile.SetPath(mDir->GetValue()); setting.destfile.SetPath(mDir->GetValue());
setting.destfile.SetExt(mPlugins[mPluginIndex]->GetExtension(mSubFormatIndex)); setting.destfile.SetExt(mPlugins[mPluginIndex]->GetExtension(mSubFormatIndex));
@ -741,10 +748,9 @@ int ExportMultiple::ExportMultipleByTrack(bool byName,
/* Examine all tracks in turn, collecting export information */ /* Examine all tracks in turn, collecting export information */
for (tr = mIterator.First(mTracks); tr != NULL; tr = mIterator.Next()) { for (tr = mIterator.First(mTracks); tr != NULL; tr = mIterator.Next()) {
// Only want wave tracks // Want only non-muted wave tracks.
if (tr->GetKind() != Track::Wave) { if ((tr->GetKind() != Track::Wave) || tr->GetMute())
continue; continue;
}
// Get the times for the track // Get the times for the track
setting.t0 = tr->GetStartTime(); setting.t0 = tr->GetStartTime();
@ -768,11 +774,12 @@ int ExportMultiple::ExportMultipleByTrack(bool byName,
} }
// number of export channels? // number of export channels?
// Needs to be per track.
if (tr2 == NULL && tr->GetChannel() == WaveTrack::MonoChannel && if (tr2 == NULL && tr->GetChannel() == WaveTrack::MonoChannel &&
((WaveTrack *)tr)->GetPan() == 0.0) ((WaveTrack *)tr)->GetPan() == 0.0)
channels = 1; setting.channels = 1;
else else
channels = 2; setting.channels = 2;
// Get name and title // Get name and title
title = tr->GetName(); title = tr->GetName();
@ -823,8 +830,8 @@ int ExportMultiple::ExportMultipleByTrack(bool byName,
ExportKit activeSetting; // pointer to the settings in use for this export ExportKit activeSetting; // pointer to the settings in use for this export
for (tr = mIterator.First(mTracks); tr != NULL; tr = mIterator.Next()) { for (tr = mIterator.First(mTracks); tr != NULL; tr = mIterator.Next()) {
// Only want wave tracks // Want only non-muted wave tracks.
if (tr->GetKind() != Track::Wave) { if ((tr->GetKind() != Track::Wave) || (tr->GetMute() == true)) {
continue; continue;
} }
@ -843,8 +850,8 @@ int ExportMultiple::ExportMultipleByTrack(bool byName,
/* get the settings to use for the export from the array */ /* get the settings to use for the export from the array */
activeSetting = exportSettings[count]; activeSetting = exportSettings[count];
// export data // Export the data. "channels" are per track.
ok = DoExport(channels, activeSetting.destfile, true, activeSetting.t0, activeSetting.t1, activeSetting.filetags); ok = DoExport(activeSetting.channels, activeSetting.destfile, true, activeSetting.t0, activeSetting.t1, activeSetting.filetags);
// Reset selection state // Reset selection state
tr->SetSelected(false); tr->SetSelected(false);
@ -959,14 +966,3 @@ void MouseEvtHandler::OnMouse(wxMouseEvent& event)
{ {
event.Skip(false); 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

View File

@ -190,7 +190,7 @@ private:
* export. * export.
* *
* We create a set of these during the interactive phase of the 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 class ExportKit
{ {
public: public:
@ -198,6 +198,7 @@ private:
wxFileName destfile; /**< The file to export to */ wxFileName destfile; /**< The file to export to */
double t0; /**< Start time for the export */ double t0; /**< Start time for the export */
double t1; /**< End time for the export */ double t1; /**< End time for the export */
int channels; /**< Number of channels for ExportMultipleByTrack */
}; // end of ExportKit declaration }; // end of ExportKit declaration
/* we are going to want an set of these kits, and don't know how many until /* 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 * runtime. I would dearly like to use a std::vector, but it seems that
@ -208,14 +209,3 @@ private:
#endif #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