[RTcmix-discuss] C/C++ question, potential problem

Brad Garton brad at music.columbia.edu
Sun Jan 2 18:29:09 EST 2005


Duh...

thanks doug!  I actually tried a really stupid variant, and thought "oh 
that doesn't work":

RTcmixMain app;

void bgglue()
{
	app.run();
}

yeah... brad rides again.


On Sun, 2 Jan 2005, Douglas Scott wrote:

> Just make the functions like this:
> 
> #include <RTcmixMain.h>
> 
>     
>     RTcmixMain *globalApp;
> 
>     void bgstart()
>     {
>     globalApp = new RTcmixMain;
>     }
> 
>     void bgglue()
>     {
>         globalApp->runMainLoop();
>     }
> 
> 
> 
> brad at music.columbia.edu wrote:
> 
> >Gang --
> >
> >Ok, I managed to get a static bundle built (don't ask...), but it wasn't 
> >loading properly and I think I figured out why.  The inTraverse() function
> >is now a member-function of the RTcmix class; RTcmixMain subclasses this 
> >to run it via:
> >
> >   RTcmixMain app(argc, argv);
> >   app.run();
> >
> >which ultimately calls inTraverse() in main.cpp.
> >
> >I need to somehow gain extern "C" access to inTraverse() (or 
> >runMainLoop()) because max/msp is going to call it from a C environment.  
> >As I understand it, you can create 'wrapper' C++ functions that can call 
> >member functions, but these can't access the state of instantiated 
> >objects, right?  Here's what I mean (and sorry for the length of this):
> >
> >I have an extern "C" function called rtcmixmain() that needs to call 
> >runMainLoop() from the RTcmixMain object, so I create a C++ function 
> >called "bgglue()" that looks like this:
> >
> >    #include <RTcmixMain.h>
> >
> >    void bgglue()
> >    {
> >        RTcmixMain app;
> >        app.runMainLoop();
> >    }
> >
> >and I can call bgglue() from within rtcmixmain() and it is happy.  
> >However, suppose I change runMainLoop() in such a manner that it only 
> >computes 1 buffer of samples each time it is called (this is how max/msp 
> >woudl do it).  If I do this, aren't I creating a new RTcmixMain object 
> >each time, and the state from the previous incarnation -- which is 
> >necessary -- will get reinitialized?
> >
> >Would this be a problem if we try to use "C" audio libs (like Portaudio) 
> >if our lower-level functions are also protected member functions, or am I 
> >way off-base again?
> >
> >brad
> >
> >PS:  And is there a solution to my dilemma above?
> >
> >_______________________________________________
> >RTcmix-discuss mailing list
> >RTcmix-discuss at music.columbia.edu
> >http://music.columbia.edu/mailman/listinfo/rtcmix-discuss
> >  
> >
> _______________________________________________
> RTcmix-discuss mailing list
> RTcmix-discuss at music.columbia.edu
> http://music.columbia.edu/mailman/listinfo/rtcmix-discuss
> 



More information about the RTcmix-discuss mailing list