summaryrefslogtreecommitdiff
path: root/src/jackclient.cc
diff options
context:
space:
mode:
authordeva <deva>2008-07-22 21:24:59 +0000
committerdeva <deva>2008-07-22 21:24:59 +0000
commit8c0e853723666df7696e4e52cac4522336141125 (patch)
treecf673d365dfdb9e8ed274edac1f287219fc3d89b /src/jackclient.cc
parentf6cabfe8fe888e00388a815541084b0fa332a462 (diff)
Fixed 'scratchy' bug.
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) {