On 08/01/2018 08:12 PM, Peter P. wrote:
> Hi list,
> 
> it should be possible to have readsf~ loop without a gap by using a
> soundfile that has no discontinuities in its audio signal at the
> end/start, and whose length is a multiple of Pd's block size (64 by
> default).
> Yet I do get clicks when I try this. In a conversation with the
> helpful and great IOhannes we looked at the logic and timing of readsf~
> banging its right outlet. Can it be that it bangs one block too late in
> order to loop seemlessly?
> 
> See attached patch.
> 


attached is a small patch that might fix the problem (by sending a bang
immediately if the end-of-file has been seen and the queue is is empty)

i'm currently dizzy¹ and cannot really assess whether the change is
actually correct, so it's left as an exercise to the user.

gfmadst
IOhannes

¹ so i haven't done a PR
From 2b4ee32e3261c9a48ade7095e97a83ff3f3671be Mon Sep 17 00:00:00 2001
From: IOhannes m zmoelnig <[email protected]>
Date: Tue, 10 Jul 2018 13:26:47 +0200
Subject: [PATCH] fixed detection of EOF if the queue contains exactly enough
 bytes to fill the buffer

---
 src/d_soundfile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/d_soundfile.c b/src/d_soundfile.c
index 8de46a89..46cb4f3a 100644
--- a/src/d_soundfile.c
+++ b/src/d_soundfile.c
@@ -2056,7 +2056,7 @@ static t_int *readsf_perform(t_int *w)
 #endif
         }
         if (x->x_eof && x->x_fifohead >= x->x_fifotail &&
-            x->x_fifohead < x->x_fifotail + wantbytes-1)
+            x->x_fifohead <= x->x_fifotail + wantbytes)
         {
             int xfersize;
             if (x->x_fileerror)
-- 
2.18.0

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list

Reply via email to