From e5251544ea7605cdea4750df5d5e21a14edb9ea6 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Thu, 11 Oct 2012 09:38:55 -0700 Subject: [PATCH] Don't save separate wavs for each selected line Instead, save a single wav spanning the full range of all selected lines. --- aegisub/src/command/audio.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/aegisub/src/command/audio.cpp b/aegisub/src/command/audio.cpp index 8772ba0c5..e590d7800 100644 --- a/aegisub/src/command/audio.cpp +++ b/aegisub/src/command/audio.cpp @@ -220,11 +220,17 @@ struct audio_save_clip : public Command { void operator()(agi::Context *c) { Selection sel = c->selectionController->GetSelectedSet(); + if (sel.empty()) return; + + AssTime start = INT_MAX, end = 0; for (Selection::iterator it = sel.begin(); it != sel.end(); ++it) { - c->audioController->SaveClip( - wxFileSelector(_("Save audio clip"), "", "", "wav", "", wxFD_SAVE|wxFD_OVERWRITE_PROMPT, c->parent), - TimeRange((*it)->Start, (*it)->End)); + start = std::min(start, (*it)->Start); + end = std::max(end, (*it)->End); } + + c->audioController->SaveClip( + wxFileSelector(_("Save audio clip"), "", "", "wav", "", wxFD_SAVE|wxFD_OVERWRITE_PROMPT, c->parent), + TimeRange(start, end)); } };