Don't save separate wavs for each selected line

Instead, save a single wav spanning the full range of all selected
lines.
This commit is contained in:
Thomas Goyne 2012-10-11 09:38:55 -07:00
parent 254e7564e1
commit e5251544ea

View file

@ -220,11 +220,17 @@ struct audio_save_clip : public Command {
void operator()(agi::Context *c) { void operator()(agi::Context *c) {
Selection sel = c->selectionController->GetSelectedSet(); 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) { for (Selection::iterator it = sel.begin(); it != sel.end(); ++it) {
c->audioController->SaveClip( start = std::min(start, (*it)->Start);
wxFileSelector(_("Save audio clip"), "", "", "wav", "", wxFD_SAVE|wxFD_OVERWRITE_PROMPT, c->parent), end = std::max(end, (*it)->End);
TimeRange((*it)->Start, (*it)->End));
} }
c->audioController->SaveClip(
wxFileSelector(_("Save audio clip"), "", "", "wav", "", wxFD_SAVE|wxFD_OVERWRITE_PROMPT, c->parent),
TimeRange(start, end));
} }
}; };