12 Replies Latest reply: Aug 6, 2010 9:44 PM by dheeraj_c RSS

    Is there a way to access effect sequence data from AEGP?

    dheeraj_c Community Member

      Hi All,

                I'm storing some sequence data in my custom effect. I known that sequence data can be accessed through AEGP_EffectCallGeneric(). But is there a direct way of accessing sequence data from AEGP without calling custom effect like AEGP_GetStreamValue()?

       

      Thanks,

      Dheeraj

        • 1. Re: Is there a way to access effect sequence data from AEGP?
          shachar carmi Community Member

          nope.

          it can't be done. (at least to my knowledge)

          if you absolutely HAVE to avoid effectCallGeneric() you could store your effect data in an arbitrary_aparam instead of sequence_data.

          arb params can be accessed via GetNewStreamValue().

          • 2. Re: Is there a way to access effect sequence data from AEGP?
            dheeraj_c Community Member

            Thanks Shachar.

             

            It can be saved in arbitrary data. But when SEQUENCE_RESETUP/SEQUENCE_SETUP is called PF_ParamDef *params[] is NULL, so I cannot access or modify arbitrary data there right? Or is there a way to access arbitrary data even if PF_ParamDef *params[]is NULL when SEQUENCE_RESETUP/SEQUENCE_SETUP is called?

            • 3. Re: Is there a way to access effect sequence data from AEGP?
              shachar carmi Community Member

              an effect can read it's own arb_param via GetNewStreamValue().

              i believe it can be done during SEQUENCE_SETUP/RESETUP as well.

              • 4. Re: Is there a way to access effect sequence data from AEGP?
                dheeraj_c Community Member

                Hi Shachar,

                 

                When SEQUENCE_SETUP/RESETUP is called, I need to modify the arbitrary data.

                 

                Arbitrary data can be accessed in 2 ways (as per my knowledge)

                 

                1. GetNewStreamValue() & SetStreamValue() (for this I need AEGP_EffectRef which will be NULL for the new effect when it comes to SEQUENCE_SETUP/RESETUP).

                 

                2. If PF_ParamDef* params is not NULL then,

                     PF_Handle                arbH        = params[PARAM_ID]->u.arb_d.value;
                    CG_ArbData                *arbP;
                    arbP    = reinterpret_cast<CG_ArbData*>(PF_LOCK_HANDLE(arbH));

                 

                 

                In the first way, when SEQUENCE_SETUP/RESETUP is called AEGP_EffectRef is NULL, so I cannot use it.

                In the second way, when SEQUENCE_SETUP/RESETUP is called  PF_ParamDef* params is NULL, so I cannot use it.

                 

                Any ideas?

                • 5. Re: Is there a way to access effect sequence data from AEGP?
                  shachar carmi Community Member

                  it's going to be tricky.

                  you should set a flag either with the effect or the AEGP telling it that this effect needs to be processed.

                  on idle hook you check the flagged effects.

                  when your AEGP receives an idle_hook call, the effect was already created and will now have it's own AEGP_EffectRef.

                   

                  sadly that's the only way i know of for handling duplicated or newly created effects.

                  some of the calls such as SEQUENCE_SETUP/RESETUP are called before the new effect is in place, and therefore will not give you an effect ref.

                  yes, it's crude. but i see no other solution.

                  i do something similar with my plug-ins and that's how i got it to work.

                  • 6. Re: Is there a way to access effect sequence data from AEGP?
                    dheeraj_c Community Member

                    Thanks Shachar. But for some reason which I don't know AE crashes when I go through all the effects in IdleHook() and communicate with the effect. So I'm trying to avoid doing any operation in IdleHook().

                    • 7. Re: Is there a way to access effect sequence data from AEGP?
                      shachar carmi Community Member

                      ah.

                      now i recall you asking that question before.

                      well, i see no choice but to try and solve that idle process problem.

                       

                      a few questions about the crash:

                      1. could it be you're accidentally communicating with an effect that's not yours?

                      2. could you be communicating with an effect twice while it's still didn't return from the first call?

                      3. how many effects in parallel are you communicating? perhaps you have to wait for the first to return before calling the next?

                      • 8. Re: Is there a way to access effect sequence data from AEGP?
                        dheeraj_c Community Member

                        1. No Shachar, I'm not communicating with other effects as I add only my custom effect for testing purpose.

                        2. No, I'm communicating only once.

                        3. I do it in a for loop, so it should be one communication one at a time.(Correct me if I'm wrong)

                         

                        This is how I do:

                         

                        for (all comps)

                        {

                             for (all layers)

                             {

                                    for(all effects)

                                    {

                                           if (effectName == myCustomEffectName)

                                           {

                                                 //i do a effect generic call here

                                            }

                                     }

                             }

                        }

                         

                        It's crashing on MAC and not on windows.

                         

                        question:

                        Can you please tell me whether you perform same operation in idleHook()?

                        • 9. Re: Is there a way to access effect sequence data from AEGP?
                          shachar carmi Community Member

                          i took a look at my implementation, and i see i check all effects on a layer, but only communicate with one,

                          so i never had the multiple effectCallGeneric() usage you have.

                          i do a hell of a lot of SetStreamValue, but only one generic call per idle hook.

                           

                          i know the idle_hook behavior on the mac and pc are different.

                          on pc you don't get idle hook calls as long as the mouse is moving. on mac you do.

                          that sparked an idea.

                          i searched the documentation and header files and couldn't find evidence of the effectCallGeneric being asynchronous,but i suspect it's something of the sort.

                          either that or your AEGP is multi threaded and is being called twice, so even though your loop does everything once, it's happening again in parallel.

                          you should check these two direction.

                          • 10. Re: Is there a way to access effect sequence data from AEGP?
                            dheeraj_c Community Member

                            Thanks a lot Shachar for sharing your ideas. I found the problem. The

                            crash was because of some kind of heap corruption in idleHook. thanks

                            for your inputs shachar. I could not have fixed this issue without

                            your ideas.

                            • 11. Re: Is there a way to access effect sequence data from AEGP?
                              shachar carmi Community Member

                              sooo... how did you fix it? (please contribute to the common knowledge)

                              • 12. Re: Is there a way to access effect sequence data from AEGP?
                                dheeraj_c Community Member

                                Hi Shachar,

                                It's nothing related to AE. There was a memory corruption happening in

                                idleHook because of our implementation. I was accessing more bytes

                                than the allocated number of bytes. Suicidal.