[gmpi] Re: low level API

  • From: Tim Hockin <thockin@xxxxxxxxxx>
  • To: gmpi@xxxxxxxxxxxxx
  • Date: Thu, 3 Feb 2005 23:09:15 -0800

On Fri, Feb 04, 2005 at 08:13:08AM +1300, Jeff McClintock wrote:
> 1 - An abstract factory.  Once the host has loaded a plugin's file 
> (Windows:dll, Mach-O:bundle, what do you call these on Linux?).. then we 
> need to instantiate a plugin object.  A file could contain several 
> plugins, how should this work?

Call me a C bigot, but here's how I have always imagined it.  There is
one entry required of a GMPI dll:  "gmpi_descriptor" (or whatever the
name works out to be).  You pass that function an index, and it returns
to you a GMPI_Descriptor.

A GMPI_Descriptor contains metadata (plug name, ID, capabilities, etc -
things that are STATIC and never change) and a creator method.  The
creator method is how you instantiate new instances of a plugin.  The
creator would have some arguments, but they are not important now.

host_enum_plugins() {
        for each dll in GMPI_PATH (recursively){
                host_enum_dll(dll)
        }
}

host_enum_dll(dll) {
        function = find_symbol(dll, "gmpi_descriptor")
        i = 0
        do {
                GMPI_Descriptor *d = function(i)
                if (d == NULL)
                        break

                host_add_desc(d)
                i++
        }
}

GMPI_Descriptor {
        metadata - name, ID, flags, etc
        GMPI_Plugin *create()
}

The GMPI_Descriptor->create() method returns a GMPI_Plugin.  I don't
mind the COM style ideas, though the naming make me gag.  This is where
I am not sure what the best approach is.  I dislike dispatchers in
general, but I see how they are nice for binary compatibility.

The GMPI_Plugin has a way to query the existence of interfaces, to grab
and release references, and the likes.

> 2 - The plugin base class.  Most plugin SDKs provide a C++ base class on 
> which to base your plugin.  VST has AudioEffectX.  What is GMPI's called?

GMPI_Plugin ?

----------------------------------------------------------------------
Generalized Music Plugin Interface (GMPI) public discussion list
Participation in this list is contingent upon your abiding by the
following rules:  Please stay on topic.  You are responsible for your own
words.  Please respect your fellow subscribers.  Please do not
redistribute anyone else's words without their permission.

Archive: //www.freelists.org/archives/gmpi
Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe

Other related posts: