summaryrefslogtreecommitdiff
path: root/src/jackclient.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/jackclient.cc')
-rw-r--r--src/jackclient.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/jackclient.cc b/src/jackclient.cc
index 1f91e6c..00eda52 100644
--- a/src/jackclient.cc
+++ b/src/jackclient.cc
@@ -128,7 +128,6 @@ int JackClient::process(jack_nframes_t nframes)
AudioFiles::iterator ai = sample->audiofiles.begin();
while(ai != sample->audiofiles.end()) {
- printf("!\n");
AudioFile *audiofile = ai->second;
audiofile->load();
@@ -171,12 +170,12 @@ int JackClient::process(jack_nframes_t nframes)
jack_default_audio_sample_t *buffer;
buffer = (jack_default_audio_sample_t *)jack_port_get_buffer(event.port, nframes);
- size_t size = (event.sample->size - event.duration) < nframes ?
- (event.sample->size - event.duration) - event.time : nframes - event.time;
+ size_t dtime = nframes - event.time; // how much buffer is left?
+ size_t size = event.sample->size - event.duration; // how much audio is left?
+ if(size > dtime) size = dtime;
for(size_t j = event.time; j < event.time + size; j++) {
- //memcpy(buffer + event.time, event.sample->data + event.duration, size);
- buffer[j] += event.sample->data[event.duration + j];
+ buffer[j] += event.sample->data[event.duration + j - event.time];
}
if(event.duration + size < event.sample->size) {