summaryrefslogtreecommitdiff
path: root/dgedit/audioextractor.cc
diff options
context:
space:
mode:
Diffstat (limited to 'dgedit/audioextractor.cc')
-rw-r--r--dgedit/audioextractor.cc17
1 files changed, 17 insertions, 0 deletions
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<sel_id_t> 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<sel_id_t>::iterator si = sels.begin();
while(si != sels.end()) {
Selection sel = selections.get(*si);