Csound Csound-dev Csound-tekno Search About

feature request: ficlose

Date2006-05-30 04:19
FromAndres Cabrera
Subjectfeature request: ficlose
Hi,
I'm writing to request the addition of an ficlose opcode to complement
fiopen.
Currently, a csd like (run in realtime):




sr=44100
ksmps=1
nchnls=2

	instr 1	;untitled
ipreset = p4

Sfilename sprintf "test-%2i.preset", ipreset
ifile fiopen Sfilename, 0
;ifile fiopen "test", 0

foutir ifile, 0, 0, 1, 2, 3, ipreset
;flashtxt 1, "Instr 1 live"
printf "Stored preset :%i in file %s\n",1, ipreset, Sfilename
	endin



i1 0 1 10
i1 2 1 20
i1 3 1 30
i1 4 1 40

f 0 3000
e




Will produce valid files only when csound closes. It would be very nice
if something like ficlose could be added.
I think this would be very useful (among other things) for things like
preset storing, to be able to store a preset and recall it, without
having to exit csound.

Thanks,
Andrés


Date2006-05-31 20:41
FromIstvan Varga
SubjectRe: feature request: ficlose
AttachmentsNone  

Date2006-06-01 02:09
FromAndres Cabrera
SubjectRe: feature request: ficlose
Very nice, thanks a lot! I'll add the docs. Very clean implementation!
I'll also add that calling fiopen on an open file closes it, which I
think is also a nice feature. This is correct, no?

Cheers,
Andrés

On Wed, 2006-05-31 at 21:41 +0200, Istvan Varga wrote:
> The ficlose opcode is now added, it has the following syntax:
> 
>   ficlose  Sname
>   ficlose  ihandle
> 
> The opcode runs at init time. If the file is in use when you try
> to close it, it will be closed later when no longer used by the
> other opcodes.

Date2006-06-01 10:59
FromIstvan Varga
SubjectRe: feature request: ficlose
AttachmentsNone