From ed54ecfc42371545ea438c21ba4d736cdd6f15ff Mon Sep 17 00:00:00 2001
From: Bent Bisballe Nyeng <deva@aasimon.org>
Date: Wed, 19 Mar 2014 19:25:57 +0100
Subject: Clean up more of the dist files mess.

---
 dgedit/Makefile.am | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/dgedit/Makefile.am b/dgedit/Makefile.am
index 09bfe22..2925f74 100644
--- a/dgedit/Makefile.am
+++ b/dgedit/Makefile.am
@@ -5,8 +5,8 @@ if HAVE_EDITOR
 
 bin_PROGRAMS = dgedit
 
-dgedit_LDADD = $(SNDFILE_LIBS) $(QT_LIBS) $(shell ../tools/MocList o ) \
-	$(AO_LIBS)
+dgedit_LDADD = $(SNDFILE_LIBS) $(QT_LIBS) $(AO_LIBS) \
+	$(shell ../tools/MocList o ) qrc_dgedit.o 
 
 dgedit_CXXFLAGS = $(SNDFILE_CXXFLAGS) $(QT_CFLAGS) $(AO_CFLAGS)
 AM_CXXFLAGS = $(QT_CFLAGS)
@@ -23,8 +23,7 @@ dgedit_SOURCES = \
 	itemeditor.cc \
 	mainwindow.cc \
 	mipmap.cc \
-	samplesorter.cc \
-	dgedit.qrc
+	samplesorter.cc
 
 EXTRA_DIST = \
 	audioextractor.h \
@@ -38,25 +37,28 @@ EXTRA_DIST = \
 	mainwindow.h \
 	mipmap.h \
 	samplesorter.h \
-	selection.h
+	selection.h \
+	dgedit.qrc
 
 dgedit_MOC = $(shell ../tools/MocList cc )
 
-dgedit_qrc.cpp: dgedit.qrc
-	rcc $< > $@
-
-BUILT_SOURCES = $(dgedit_MOC) dgedit_qrc.cpp
+BUILT_SOURCES = $(dgedit_MOC) qrc_dgedit.cc
 
 CLEANFILES = $(BUILT_SOURCES)
 
+qrc_%.cc: %.qrc
+	rcc $< > $@
+
 %.moc.cc: %.h
 	$(QT_MOC) -o $@ $<
 
-%.h: %.ui
-	$(QT_UIC) -o $@ $<
-
-%.cc: %.ui
-	$(QT_UIC) -o $@ -impl $*.h $<
+#
+# ui files not used in this project...
+#%.h: %.ui
+#	$(QT_UIC) -o $@ $<
+#
+#%.cc: %.ui
+#	$(QT_UIC) -o $@ -impl $*.h $<
 
 # command for creating .res file from .rc on Win32
 %.res: %.rc
-- 
cgit v1.2.3


From 63bf74ffaeb5580af677719485c40fe50e248f51 Mon Sep 17 00:00:00 2001
From: Bent Bisballe Nyeng <deva@aasimon.org>
Date: Wed, 19 Mar 2014 21:04:47 +0100
Subject: Make editor store calculated sample energies in the xml files.

---
 dgedit/audioextractor.cc | 1 +
 dgedit/samplesorter.cc   | 4 +++-
 dgedit/selection.h       | 2 ++
 3 files changed, 6 insertions(+), 1 deletion(-)

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;
 };
 
-- 
cgit v1.2.3