summaryrefslogtreecommitdiff
path: root/src/drumgizmo.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2013-06-29 21:48:09 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2013-06-29 21:48:09 +0200
commit1d552637fd68a82b454b7d5c50d3599707914d5b (patch)
tree9268a6410f0e677302e502bb1e0a017b939c7651 /src/drumgizmo.cc
parent1deb487ccc9fbb40f4abbe7695048609a6c5a99d (diff)
Add some more AudioFile protection (mutex/magic word)
Diffstat (limited to 'src/drumgizmo.cc')
-rw-r--r--src/drumgizmo.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/drumgizmo.cc b/src/drumgizmo.cc
index 135975d..5e14179 100644
--- a/src/drumgizmo.cc
+++ b/src/drumgizmo.cc
@@ -351,11 +351,14 @@ void DrumGizmo::getSamples(int ch, int pos, sample_t *s, size_t sz)
EventSample *evt = (EventSample *)event;
AudioFile *af = evt->file;
- if(!af->isLoaded() || s == NULL) {
+ if(!af->isLoaded() || !af->isValid() || s == NULL) {
removeevent = true;
break;
}
+ {
+ MutexAutolock l(af->mutex);
+
size_t n = 0;
if(evt->offset > (size_t)pos) n = evt->offset - pos;
size_t end = sz;
@@ -389,6 +392,8 @@ void DrumGizmo::getSamples(int ch, int pos, sample_t *s, size_t sz)
// LAZYLOAD:
// loader.reset(af);
}
+
+ }
}
break;
}