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
1 changed files with 9 additions and 3 deletions

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) {
start = std::min(start, (*it)->Start);
end = std::max(end, (*it)->End);
}
c->audioController->SaveClip( c->audioController->SaveClip(
wxFileSelector(_("Save audio clip"), "", "", "wav", "", wxFD_SAVE|wxFD_OVERWRITE_PROMPT, c->parent), wxFileSelector(_("Save audio clip"), "", "", "wav", "", wxFD_SAVE|wxFD_OVERWRITE_PROMPT, c->parent),
TimeRange((*it)->Start, (*it)->End)); TimeRange(start, end));
}
} }
}; };