Csound Csound-dev Csound-tekno Search About

[CSOUND-DEV:3592] RE: Opcode deinitialization

Date2003-11-30 16:37
From"gogins@pipeline.com"
Subject[CSOUND-DEV:3592] RE: Opcode deinitialization
I never tried instrument 0, so I don't know about that.

The function is called during cleanup if the function pointer in opds is
not null.

Original Message:
-----------------
From: stevenyi stevenyi@csounds.com
Date: Sun, 30 Nov 2003 00:11:14 -0800
To: csound-dev@eartha.mills.edu
Subject: [CSOUND-DEV:3589] Opcode deinitialization


Hi all,

Could someone explain when opcode deinitialization functions are
called?  I tried building an opcode lib with an opcode that had thread
of 1 (i-rate) and the deinitialization function was not called.  This
opcode was also in instrument 0, so I'm having a hard time figuring out
if deinitialization functions only work for k/a-rate opcodes or only for
opcodes not in instrument 0 or what.

Any help on this greatly appreciated!!!

Thanks,
steven


--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .

Date2003-12-01 01:30
Fromstevenyi
Subject[CSOUND-DEV:3600] RE: Opcode deinitialization
On Sun, 2003-11-30 at 08:37, gogins@pipeline.com wrote:
> I never tried instrument 0, so I don't know about that.
> 
> The function is called during cleanup if the function pointer in opds is
> not null.

It seems that insert.c::orcompact only walks the nxtp chain of
performance opcodes and not the nxti chain of init-time opcodes.  I
added a walk of the nxti chain and it correctly called the
deinitialization functions for my i-time opcodes.  The code is as
follows:

            off = ip->nxti;
            while (off != NULL) {
            	if(off->dopadr) (*off->dopadr)(off);
            	off = off->nxti;	
            }

and is added after the nxtp walk in orcompact.  I'll be checking this
code into csound5 cvs in a moment as I think it's a bug-fix.  If it
seems good to everyone else, I'll add it to csound4 cvs as well.  

Thanks,
steven

(who's happy to have his opcode plugin happily cleaning up after
itself!  btw: I've learned from this opcode I've built how to redo the
deinitialization for sfont correctly for csound5 (which was in a
function added to mainRESET but is no longer accessible as sfont stuff
is in an opcode lib), so will be reworking that code too).


Date2003-12-01 05:12
Fromstevenyi
Subject[CSOUND-DEV:3598] RE: Opcode deinitialization
Hi All,

I mixed up when committing and ended up also committing my change in
insert.c::orcompact in csound4 CVS.  I will leave it in as I think it's
a bug fix as mentioned in my previous email; if anyone wants it out I'll
take it out promptly.

Thanks,
steven

Date2003-12-01 05:27
Fromstevenyi
Subject[CSOUND-DEV:3599] RE: Opcode deinitialization
Hmm... I'm not sure my first email got through, which would make my
second one not make any sense.  I've attached the first email I sent
below.

steven




On Sun, 2003-11-30 at 08:37, gogins@pipeline.com wrote:
> I never tried instrument 0, so I don't know about that.
> 
> The function is called during cleanup if the function pointer in opds
is
> not null.

It seems that insert.c::orcompact only walks the nxtp chain of
performance opcodes and not the nxti chain of init-time opcodes.  I
added a walk of the nxti chain and it correctly called the
deinitialization functions for my i-time opcodes.  The code is as
follows:

            off = ip->nxti;
            while (off != NULL) {
                if(off->dopadr) (*off->dopadr)(off);
                off = off->nxti;        
            }

and is added after the nxtp walk in orcompact.  I'll be checking this
code into csound5 cvs in a moment as I think it's a bug-fix.  If it
seems good to everyone else, I'll add it to csound4 cvs as well.  

Thanks,
steven

(who's happy to have his opcode plugin happily cleaning up after
itself!  btw: I've learned from this opcode I've built how to redo the
deinitialization for sfont correctly for csound5 (which was in a
function added to mainRESET but is no longer accessible as sfont stuff
is in an opcode lib), so will be reworking that code too).