Hi Istvan, Thanks for the information. I didn't see that hfgens was already in the ENVIRON struct. I committed a version of the ftfree opcode an hour or so ago that was in fgens.c and entry1.c. I'll work on pushing it and ftgens and whatever opcodes that use structs in ftgen.h out to an opcode plugin. I ended up making ftfree take both the number of the table to free as well as freeTime parameter that if equal to 0 to free at opcode init, and if not zero to free at deinit time. Originally, I thought the instrument I am translating had a temp array that was being generated and free()'d in the code and then later realized it wasn't being used. Maybe it's better to simplify and just delete at deinit anyways? (Maybe I'll take that option out then.) Do you think it's better to have an ftgentemp opcode where the table is always deleted at deinit, or better to explicitly call ftfree? Is there a use case where say, one instrument will generate a wavetable and other instruments will use it for a while, then that instrument is called again to generate a new ftable and free the old one? Hmm... maybe not, as you could always just overwrite a table assigned to a global var. Okay, sounds like an ftgentemp would be a good solution to all of this. I'll remove the ftfree opcode I put in and redo it all as an opcode plugin. Thanks! steven On 8/3/05, Istvan Varga wrote: > For freeing a table with a known number, you can just use csound->hfgens() > with a negative table number which will request deleting the table, and > this should work from plugins. Alternatively, it may make sense to write > a version of the ftgen opcode that automatically deletes the table at > note deinit. It should be possible to implement that opcode as a plugin > (actually, ftgen may be moved out of fgens.c as well). > > Steven Yi wrote: > > > I'm working on ftree now and am putting it in fgens.c and adding a > > struct to ftgen.h, and plan to add it to entry1.c. or entry2.c, > > wherever ftgen is at. The reason I'm doing this within csound and not > > as a plugin is that I haven't found any API functions which can do > > this. I'm using the code from hfgens: > > > > if (ff->fno > csound->maxfnum || > > (ftp = csound->flist[ff->fno]) == NULL) { > > fterror(csound, ff, Str("ftable does not exist")); > > return -1; > > } > > csound->flist[ff->fno] = NULL; > > mfree(csound, (void*) ftp); > > > > (with the ff->fno coming from *p instead) to free the table. Does > > this all sound alright or is there an API way to do this? (And if not, > > should there be?) > > > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies > from IBM. Find simple to follow Roadmaps, straightforward articles, > informative Webcasts and more! Get everything you need to get up to > speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click > _______________________________________________ > Csound-devel mailing list > Csound-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/csound-devel > ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net