summaryrefslogtreecommitdiff
path: root/src/instrument.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2013-04-07 13:01:34 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2013-04-07 13:01:34 +0200
commit331be8dc452bf47705556d2a7f7f5988973930ca (patch)
tree164a30fd5cef68a39713315085da8bd7901a1d07 /src/instrument.cc
parent064f0112bd825f1102a94e109e5329710d59eb82 (diff)
Fixed crashbug on drumkit reload.
Diffstat (limited to 'src/instrument.cc')
-rw-r--r--src/instrument.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/instrument.cc b/src/instrument.cc
index 297e6c6..22b6a90 100644
--- a/src/instrument.cc
+++ b/src/instrument.cc
@@ -39,10 +39,14 @@ Instrument::Instrument()
DEBUG(instrument, "new %p\n", this);
mod = 1.0;
lastpos = 0;
+
+ magic = this;
}
Instrument::~Instrument()
{
+ magic = NULL;
+
DEBUG(instrument, "delete %p\n", this);
std::vector<AudioFile*>::iterator i = audiofiles.begin();
while(i != audiofiles.end()) {
@@ -51,6 +55,11 @@ Instrument::~Instrument()
}
}
+bool Instrument::isValid()
+{
+ return this == magic;
+}
+
Sample *Instrument::sample(level_t level, size_t pos)
{
if(Conf::enable_velocity_modifier == false) {