Archived

This topic is now archived and is closed to further replies.

JOL

design problem and audioplugins

Recommended Posts

JOL    160
I have this design problem.... I''m working on a app that is supposed to deal alot with plugins, (windows dll - audio plugins), but the thing is, these plugins need to be ACTIVE in the way that, once activated they may send events and stuff to the main program. I have no problem figuring out how to deal with nonactive plugs, that doesn''t do anything until told to, but I need the plugins to be as versatile and generalpurpose as possible, to be standalone modules(objects) but still interacting with the main program. How should I implement that, with a shared object or with messages, and will messages always work in all situations, I want to create a general design that allows me to extend the application. also - do you have any tips in designing an audio application....

Share this post


Link to post
Share on other sites
Shannon Barber    1681
You can use an Observer pattern

Your plug-in object needs an AttachObserver(), and when they''re loaded you attach the main object


class CPlugInObserver
{
virtual ChangeNotification(CPlugIn*,...)=0;
}

class CPlugIn
{
AttachObserver(CPlugInObserver*)
void Notify();
}
CPlugIn::Notify()
{
for each Observer
pObserver->ChangeNotification(this, ...);
}

class CMyAmp : CPlugInObserver
{
virtual ChangeNotification(CPlugIn*,...);
}

CMyAmp::LoadPlugIn(...)
{
pPlugIn = CreateNewPlugIn(...);
pPlugIn->AttachObserver(this);
}

CMyAmp::ChangeNotification(CPlugIn*,...)
{
//Need to do something here...
}

Share this post


Link to post
Share on other sites