diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2013-04-21 22:13:40 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2013-04-21 22:13:40 +0200 |
commit | 96cab02d94845ee47f69b87c18c4988a930ba521 (patch) | |
tree | a7beb9bbc4405111fcf3ef47f0cd0bdbc62c9930 /src/drumgizmo.cc | |
parent | 9be3da42a71d99ba23db575c6a70c1486b253366 (diff) |
Fixed accumulating events in the acitve events queue.
Diffstat (limited to 'src/drumgizmo.cc')
-rw-r--r-- | src/drumgizmo.cc | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/drumgizmo.cc b/src/drumgizmo.cc index c6259d4..a16a4e2 100644 --- a/src/drumgizmo.cc +++ b/src/drumgizmo.cc @@ -279,7 +279,8 @@ bool DrumGizmo::run(size_t pos, sample_t *samples, size_t nsamples) ERR(drumgizmo, "Missing Instrument %d.\n", evs[e].instrument); continue; } - + +#if 1 if(i->group() != "") { // Add event to ramp down all existing events with the same groupname. Channels::iterator j = kit.channels.begin(); @@ -291,7 +292,7 @@ bool DrumGizmo::run(size_t pos, sample_t *samples, size_t nsamples) if(ev->type() == Event::sample) { EventSample *sev = (EventSample*)ev; if(sev->group == i->group() && sev->instrument != i) { - sev->rampdown = 3000; // Ramp down 3000 samples + sev->rampdown = 10000; // Ramp down 10000 samples // TODO: This must be configurable at some point... // ... perhaps even by instrument (ie. in the xml file) sev->ramp_start = sev->rampdown; @@ -302,7 +303,8 @@ bool DrumGizmo::run(size_t pos, sample_t *samples, size_t nsamples) j++; } } - +#endif + Sample *s = i->sample(evs[e].velocity, evs[e].offset + pos); if(s == NULL) { @@ -383,9 +385,8 @@ typedef float vNsf __attribute__ ((vector_size(sizeof(float)*N))); void DrumGizmo::getSamples(int ch, int pos, sample_t *s, size_t sz) { - for(std::list< Event* >::iterator i = activeevents[ch].begin(); - i != activeevents[ch].end(); - i++) { + std::list< Event* >::iterator i = activeevents[ch].begin(); + while(i != activeevents[ch].end()) { bool removeevent = false; Event *event = *i; @@ -437,8 +438,9 @@ void DrumGizmo::getSamples(int ch, int pos, sample_t *s, size_t sz) if(removeevent) { delete event; i = activeevents[ch].erase(i); + continue; } - + i++; } } |