csoundRegisterDeinitCallback

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

csoundRegisterDeinitCallback

Steven Yi
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=offad-ysdn-ostg-q22005
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: csoundRegisterDeinitCallback

Michael Gogins
You are correct in that all API functions should definitely be in the
ENVIRON struct.

Regards,
Mike
----- Original Message -----
From: "Steven Yi" <[hidden email]>
To: <[hidden email]>
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
[hidden email]
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: csoundRegisterDeinitCallback

Steven Yi
Ah, okay, it's already there but as RegisterDeinitCallback, not as
csoundRegisterDeinitCallback.  Okay, that makes sense.  Going to see
if that works out now, and if so I'll commit that change to
fluidOpcodes.

steven

On 5/27/05, Michael Gogins <[hidden email]> wrote:

> You are correct in that all API functions should definitely be in the
> ENVIRON struct.
>
> Regards,
> Mike
> ----- Original Message -----
> From: "Steven Yi" <[hidden email]>
> To: <[hidden email]>
> 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
> [hidden email]
> 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
> [hidden email]
> 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel
Loading...