[CM] sound-loop-info / mus_sound_loop_info
Thu, 24 May 2007 23:04:49 -0400
So here's a sort of follow-up question (although the connection may
seem obscure): should it be possible to read a sound file backwards
using "file->frame" ? (to do something like forward/backward looping)
I tried creating a modified version of fullmix.ins that decrements
that starts the input location somewhere in the middle of the file
and then decrements the input index. This seems to hang clm (or at
least it goes into a very tight loop).
Some investigations in clm.c suggest that it is rebuffering at each
sample. My hack solution (beginning at line 5518 in clm.c) is this:
/* read in first buffer start either at samp (dir > 0) or
samp-bufsize (dir < 0) */
newloc = (int)(samp - (gen->file_buffer_size * .5));
which keeps the buffer always centered on the read pointer.
Is there a better way to do this -- for example a way switch the
"direction" of the file->frame generator?
Also, just curious why is the file descriptor opened/closed every
time the buffer is refilled? Wouldn't this be a performance hit?
Maybe it doesn't matter much with big buffers.
At 5:51 PM -0700 5/24/07, Bill Schottstaedt wrote:
> > Thanks, that seems to do the trick! So the header info is stored in a
>> static variable and is updated whenever a header is read? As long as
>> I call mus-header-mark-position immediately following sound-loop-info
>> I presume all will be well.
>yes and yes. Or call mus-header-read rather than sound-loop-info --
>its code is in ffi.lisp. I wonder why I don't just return the mark positions
>in sound-loop-info -- is there any reason not to? (I've never used
>these loop points -- maybe someone knows why they are set up in
>such a convoluted manner).