diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-04-25 19:36:01 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-04-25 19:36:01 +0200 |
commit | 541f6c214762cceb348f9657258c3db758ea667f (patch) | |
tree | 4e0c8ac4f4011023b7a6ec35945609283df03d3e /dgedit | |
parent | 313ded275104952e930d5b11fc5382ccee731b2b (diff) |
Sort samples by power before export.
Diffstat (limited to 'dgedit')
-rw-r--r-- | dgedit/audioextractor.cc | 17 |
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); |