summaryrefslogtreecommitdiff
path: root/src/instrument.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2012-01-12 16:31:36 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2012-01-12 16:31:36 +0100
commit5e4cb10f72ef69d73fbd2c1bc42465c9111a4c41 (patch)
treefc830f6272849d78cf97d7645dd6dabb483b2f23 /src/instrument.cc
parentec9148f95b0c47c8eecf26f6f2f16c1db558a3b9 (diff)
Fix memory leak when unloading a drumkit.
Diffstat (limited to 'src/instrument.cc')
-rw-r--r--src/instrument.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/instrument.cc b/src/instrument.cc
index 8cfaec7..b10d990 100644
--- a/src/instrument.cc
+++ b/src/instrument.cc
@@ -34,12 +34,28 @@
Instrument::Instrument()
{
+ printf("new Instrument %p\n", this);
mod = 1.0;
lastpos = 0;
}
+Instrument::~Instrument()
+{
+ printf("delete Instrument %p\n", this);
+ std::vector<AudioFile*>::iterator i = audiofiles.begin();
+ while(i != audiofiles.end()) {
+ delete *i;
+ i++;
+ }
+}
+
Sample *Instrument::sample(level_t level, size_t pos)
{
+ if(Conf::enable_velocity_modifier == false) {
+ mod = 1.0;
+ lastpos = 0;
+ }
+
if(Conf::enable_velocity_randomiser) {
float r = (float)rand() / (float)RAND_MAX; // random number: [0;1]
r -= 0.5; // random number [-0.5;0.5]