Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] csoundRegisterDeinitCallback

Date2005-05-27 23:35
From"Michael Gogins"
SubjectRe: [Cs-dev] csoundRegisterDeinitCallback
You are correct in that all API functions should definitely be in the 
ENVIRON struct.

Regards,
Mike
----- Original Message ----- 
From: "Steven Yi" 
To: 
Sent: Friday, May 27, 2005 6:14 PM
Subject: [Cs-dev] csoundRegisterDeinitCallback


Hi Istvan and all,

I saw that this was added today and was working on modifying
fluidOpcodes to take use this facility instead of the offtime check in
the k-rate func.  I can compile an obj file if I #include csound.h but
can't link.  I was curious though, shouldn't this function be added to
the ENVIRON struct in csoundCore.h and then called by dereferencing
the passed-in ENVIRON struct?  (My C coding isn't the strongest, so
please bear with me here. =) )

The code I was using is as follows:


  int fluidNoteTurnoff(void *csound_, void *data) {

  ENVIRON *csound = (ENVIRON *)csound_;

  FLUID_NOTE *fluid = (FLUID_NOTE *)data;

int engineNum   = (int)(*fluid->iEngineNumber);
  int channelNum  = (int)(*fluid->iChannelNumber);
      int key         = (int)(*fluid->iMidiKeyNumber);

csound->Message(csound, "Fluid Note Off: key %i\n", key);

  fluid_synth_noteoff(fluid_engines[engineNum],
                          channelNum,
                          key);

return OK;
  }

  int fluidNoteIopadr(ENVIRON *csound, void *data)
  {
    FLUID_NOTE *fluid = (FLUID_NOTE *)data;
    int engineNum   = (int)(*fluid->iEngineNumber);
    int channelNum  = (int)(*fluid->iChannelNumber);
    int key         = (int)(*fluid->iMidiKeyNumber);
    int velocity    = (int)(*fluid->iVelocity);
    fluid->released = false;
    // fluid->h.insdshead->csound->Message(fluid->h.insdshead->csound,
"%i : %i : %i : %i\n", engineNum, instrNum, key, velocity);
    fluid_synth_noteon(fluid_engines[engineNum], channelNum, key, velocity);
    //MYFLT offTime = fluid->h.insdshead->p3;
    //unsigned int dur = (int)(offTime *
    //fluid->evt                = new_fluid_event();
    //fluid_event_note(fluid->evt, channelNum, key, vel,

csoundRegisterDeinitCallback((void *)&csound, (void *)&fluid->h,
                                          &fluidNoteTurnoff);

    return OK;
  }

So, shoud I add the func to the ENVIRON struct and call this instead:

csound->csoundRegisterDeinitCallback((void *)&csound, (void *)&fluid->h,
                                          &fluidNoteTurnoff);


Also, seems the VST4CS opcodes were not fixed up to use
csoundModuleDestroy so they do not compile now.

steven


-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=fad-ysdn-ostg-q22005
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel




-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-05-27 23:50
FromSteven Yi
SubjectRe: [Cs-dev] csoundRegisterDeinitCallback
AttachmentsNone