INTERACT FORUM

Windows => Plug-in Development => Topic started by: Tanoshimi on February 28, 2007, 10:36:45 am

Title: Sharing Data Amongst Plugins
Post by: Tanoshimi on February 28, 2007, 10:36:45 am
I may have posted this before, but I thought it worth revisiting if so.

I wrote a Media Library once, and decided I wanted a way for Plugins to communicate information to and from each other (things like status, what was available, which plugins were running, etc).  Ultimately, what I did, was create an OCX that contained all the library information, and a variable called Message.  When a plugin is designed/created, it did not create a new instance of the OCX, it created a reference to it.  That allowed all the information to remain up to date across platforms. 

Ultimately, I had a plugin that would change the order of a playlist, one that imported new songs at pre-programmed intervals, and one that went looking for tags.  They each monitored the Message Variable, and performed actions based upon the current value.

For example, if the Message contained "ADDED: Song name" then the Plugin that went looking for tags would set Message = "LOOKING_UP_TAG: Song name" and then look for the Tag.  Everytime it updated a field, it notified all the other plugins so they could take appropriate action.

Ultimately, I ended up with an Event being raised to track changes in the Message variable, and a formatted Scriptlike language that basically went PluginName|Function|Arglist (using a seperation character).  Right before I abandoned the project to focus on MC12 plugins (why reinvent the wheel?) I also set it up so that you could call function from other plugins, as long as you knew what the function was, to prevent recoding things.

Anyway, I just figured I'd throw that out there to see if there was interest, or even the ability, to implement something like this in MC12.  I think I'd like to be able to call other Plugins, or to know when an event has taken place (like adding, removing, renaming, etc)

Comments and criticisms welcome.
-Tano
P.S. I realize a lot of this is VB specific language so bear with me.