summaryrefslogtreecommitdiff
path: root/dgedit
diff options
context:
space:
mode:
Diffstat (limited to 'dgedit')
-rw-r--r--dgedit/audioextractor.cc1
-rw-r--r--dgedit/samplesorter.cc4
-rw-r--r--dgedit/selection.h2
3 files changed, 6 insertions, 1 deletions
diff --git a/dgedit/audioextractor.cc b/dgedit/audioextractor.cc
index 2a0dcf5..9692b0b 100644
--- a/dgedit/audioextractor.cc
+++ b/dgedit/audioextractor.cc
@@ -161,6 +161,7 @@ void AudioExtractor::exportSelections(Selections selections,
QDomElement sample = doc.createElement("sample");
sample.setAttribute("name", i->name);
+ sample.setAttribute("power", QString::number(i->energy));
samples.appendChild(sample);
AudioFileList::iterator j = audiofiles.begin();
diff --git a/dgedit/samplesorter.cc b/dgedit/samplesorter.cc
index adfdf65..8f857a6 100644
--- a/dgedit/samplesorter.cc
+++ b/dgedit/samplesorter.cc
@@ -139,7 +139,7 @@ void SampleSorter::resort()
QMap<int, Selection>::iterator i = _selections.begin();
while(i != _selections.end()) {
float energy = 0.0;
- Selection s = i.value();
+ Selection &s = i.value();
for(size_t idx = s.from;
(idx < (size_t)s.from + (size_t)attackLength()) &&
@@ -152,6 +152,8 @@ void SampleSorter::resort()
energy += 1; // Make sure that the key is unique.
}
+ s.energy = energy;
+
sorted[energy] = i.value();
if(energy < min) min = energy;
diff --git a/dgedit/selection.h b/dgedit/selection.h
index 283b642..64e6d98 100644
--- a/dgedit/selection.h
+++ b/dgedit/selection.h
@@ -42,6 +42,8 @@ public:
int fadein;
int fadeout;
+ double energy;
+
QString name;
};