From 541f6c214762cceb348f9657258c3db758ea667f Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 25 Apr 2014 19:36:01 +0200 Subject: Sort samples by power before export. --- dgedit/audioextractor.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'dgedit') diff --git a/dgedit/audioextractor.cc b/dgedit/audioextractor.cc index 99010e9..f4fd4f3 100644 --- a/dgedit/audioextractor.cc +++ b/dgedit/audioextractor.cc @@ -73,6 +73,23 @@ void AudioExtractor::exportSelections() idx = 1; QVector sels = selections.ids(); + + // Sort selections by velocity + for(int v1 = 0; v1 < sels.size(); v1++) { + for(int v2 = 0; v2 < sels.size(); v2++) { + + Selection sel1 = selections.get(sels[v1]); + Selection sel2 = selections.get(sels[v2]); + + if(sel1.energy < sel2.energy) { + sel_id_t vtmp = sels[v1]; + sels[v1] = sels[v2]; + sels[v2] = vtmp; + } + } + } + + // Iterate and write audio files QVector::iterator si = sels.begin(); while(si != sels.end()) { Selection sel = selections.get(*si); -- cgit v1.2.3