Es geschah am Sonntag 05 Dezember 2004 11:37 als Andreas Persson schrieb:
> Hello,
>
> I've found a bug in the streaming-from-disk code. I use a test gig with
> a short, mono, non-looped wave. The wave is 120976 samples long, and the
> problem is that not all of it are played when I press and hold a key.
> The disk thread reads the complete wave, but the audio thread does not
> render all samples - it seems as it stops after the cached 32768 samples.
>
> The attached patch (one line) seems to fix the problem - but, I
> definetly don't have a full understanding of the Stream class and the
> interaction between the threads, so it would be nice if someone that
> has, could look at it.
Index: linuxsampler/src/engines/gig/Stream.h
===================================================================
RCS file: /var/cvs/linuxsampler/linuxsampler/src/engines/gig/Stream.h,v
retrieving revision 1.2
diff -u -2 -r1.2 Stream.h
--- linuxsampler/src/engines/gig/Stream.h 27 Apr 2004 09:21:58 -0000 1.2
+++ linuxsampler/src/engines/gig/Stream.h 5 Dec 2004 10:28:18 -0000
@@ -59,5 +59,5 @@
inline int GetReadSpace() {
- return (pRingBuffer && State == state_active) ?
pRingBuffer->read_space() : 0;
+ return (pRingBuffer && State != state_unused) ?
pRingBuffer->read_space() : 0;
}
Ouch, yes, that's definitely a bug. We must have forgotten that when the
meaning of the stream states changed. This bug caused that already read data
of the end of samples were overwritten by silence. The code to write the
silence at the end (in Voice.cpp) should also be modified so that only as
much silence is written as necessary. I will fix that.
Thanks for the report!
CU
Christian
|