home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / arts / artsbuilder.idl < prev    next >
Encoding:
Text File  |  2005-09-10  |  6.5 KB  |  229 lines

  1. /*
  2.  * DISCLAIMER: The interfaces in artsbuilder.idl (and the derived .cc/.h files)
  3.  *             DO NOT GUARANTEE BINARY COMPATIBILITY YET.
  4.  *
  5.  * They are intended for developers. You shouldn't expect that applications in
  6.  * binary form will be fully compatibile with further releases of these
  7.  * interfaces.
  8.  */
  9.  
  10. #include <core.idl>
  11. #include <artsflow.idl>
  12. module Arts {
  13.     /*
  14.      * incoming or outgoing port?
  15.      */
  16.     enum PortDirection {input, output};
  17.  
  18.     /**
  19.      * ConnType (maybe obsolete)
  20.      *
  21.      * ConnType: (connection type) this is wether this value is used
  22.      *
  23.      * - once (such as a filename of a waveplugin)  -> property
  24.      *   this implies that the allowed connection is only value
  25.      *
  26.      * - event based (such as midi events)          -> event
  27.      *   when events arrive, they are processed, when no events arrive,
  28.      *     don't care
  29.      *
  30.      * - stream based (such as audio streams)       -> stream
  31.      *   every calculation of the module consumes/creates a sample
  32.      *   that means: no data = no calculation possible
  33.      *
  34.      * WARNING: This is part of the artsbuilder dynamic programming interface 
  35.      * as the MCOP port isn't there yet, this stuff may change
  36.      */ 
  37.     enum PortConnType { conn_stream, conn_event, conn_property};
  38.  
  39.     /**
  40.      * PortType (maybe obsolete)
  41.      *
  42.      * isMultiPort specifies if the port can take multiple incoming
  43.      * connections or not. This is only relevant/allowed for input ports,
  44.      * the output of all output ports may be connected to any amount of
  45.      * receivers.
  46.      *
  47.      * Ports which can take multiple connections are handled differently
  48.      * internally. (Also, artsbuilder needs to know whether to allow multi-
  49.      * connections or not).
  50.      *
  51.      * WARNING: This is part of the artsbuilder dynamic programming interface 
  52.      * as the MCOP port isn't there yet, this stuff may change
  53.      */
  54.     struct PortType {
  55.         PortDirection direction;
  56.         string dataType;
  57.         PortConnType connType;
  58.         boolean isMultiPort;
  59.     };
  60.  
  61.     struct ModuleInfo {
  62.         string name;
  63.  
  64.         //--- internal information:
  65.         // ports, first the input ports, then the output ports
  66.         sequence<PortType> ports;
  67.         sequence<string>   portnames;
  68.         boolean isInterface;
  69.         boolean isStructure;
  70.     };
  71.  
  72.     interface PortDesc;
  73.     interface ModuleDesc;
  74.     interface StructureDesc;
  75.     interface StructurePortDesc;
  76.  
  77.     interface PortDesc {
  78.         // internal:
  79.         void constructor(ModuleDesc parent, string name, PortType type);
  80.  
  81.         // ID is guaranteed to be unique in the structure the port belongs to
  82.         readonly attribute long ID;
  83.         readonly attribute ModuleDesc parent;
  84.  
  85.         // Name is guaranteed to be unique for each module (no two in/out-
  86.         // ports with the same name allowed)
  87.         readonly attribute string name;
  88.         readonly attribute PortType type;
  89.  
  90.         /*
  91.          * - for input channels, one of those must be true (only event
  92.          *   channels may remain unconnected),
  93.          * - for output channels, only isConnected may be set
  94.          *
  95.          * only one of them may be set, not both
  96.          */
  97.         readonly attribute boolean isConnected;
  98.         attribute boolean hasValue;    // set to false is only allowed writing
  99.  
  100.         // connections, used when isConnected is true
  101.         readonly attribute sequence<PortDesc> connections;
  102.  
  103.         // to be used as const value when hasValue is true
  104.         attribute float  floatValue;
  105.         attribute string stringValue;
  106.  
  107.         // the value as "any"
  108.         attribute Any     value;
  109.  
  110.         boolean connectTo(PortDesc port);
  111.         void disconnectFrom(PortDesc port);
  112.         void disconnectAll();
  113.  
  114.         sequence<string> saveToList();
  115.         void loadFromList(sequence<string> list);
  116.  
  117.         // never call this by hand, it will only be used by the module:
  118.         void internalConnectInput(PortDesc port);
  119.         void internalReConnect(sequence<PortDesc> allports);
  120.  
  121.         readonly attribute long internalOldID;
  122.     };
  123.  
  124.     interface ModuleDesc {
  125.         // internal
  126.         void constructor(StructureDesc parent, ModuleInfo info);
  127.  
  128.         // ID is guaranteed to be unique in the structure the module belongs to
  129.         readonly attribute long ID;
  130.         readonly attribute StructureDesc parent;
  131.  
  132.         readonly attribute string name;
  133.         readonly attribute sequence<PortDesc> ports;
  134.         readonly attribute long x, y, width, height;
  135.         readonly attribute boolean isInterface, isStructure;
  136.  
  137.         boolean moveTo(long x, long y);    // returns true when successful
  138.  
  139.         PortDesc findPort(string name);
  140.         sequence<string> saveToList();
  141.         void loadFromList(sequence<string> list);
  142.     };
  143.  
  144.     interface StructureDesc {
  145.         // internal:
  146.         long obtainID();    // only to be used as module or port
  147.  
  148.         // public:
  149.         readonly attribute boolean valid;
  150.         attribute string name;
  151.         readonly attribute sequence<ModuleDesc> modules;
  152.         readonly attribute sequence<StructurePortDesc> ports;
  153.         readonly attribute sequence<string> inheritedInterfaces;
  154.  
  155.         sequence<string> saveToList();
  156.         void loadFromList(sequence<string> list);
  157.  
  158.         /**
  159.          * deletes all components in the structure
  160.          */
  161.         void clear();
  162.  
  163.         ModuleDesc createModuleDesc(ModuleInfo info);
  164.         void freeModuleDesc(ModuleDesc moduledesc);
  165.  
  166.         /**
  167.          * publishing (HMM)
  168.          */
  169.         readonly attribute ModuleInfo externalInterface;
  170.  
  171.         // External Interface Ports:
  172.         StructurePortDesc createStructurePortDesc(PortType type,
  173.                                                         string name);
  174.         void freeStructurePortDesc(StructurePortDesc portdesc);
  175.         void moveStructurePortDesc(StructurePortDesc portdesc,
  176.                                                 long newposition);
  177.  
  178.         // you will need to add the structure ports yourself
  179.         void addInheritedInterface(string iface);
  180.  
  181.         // this will remove the associated structure ports
  182.         void removeInheritedInterface(string iface);
  183.     };
  184.  
  185.     interface StructurePortDesc : PortDesc {
  186.         // internal
  187.         void constructor(StructureDesc parent, string name, PortType type);
  188.  
  189.         // Position: how the port is positioned when the structure is used
  190.         // as module - 0 is leftmost, higher numbers are more right
  191.         readonly attribute long x, y, position;
  192.         readonly attribute StructureDesc parentStructure;
  193.  
  194.         // if the port is associated with an inherited interface of the
  195.         // parent structure, then it should be setup here
  196.         attribute string inheritedInterface;
  197.     
  198.         boolean moveTo(long x, long y);    // returns true when successful
  199.  
  200.         void lowerPosition();            // will move the port more left
  201.         void raisePosition();            // will move the port more right
  202.         void rename(string newname);
  203.  
  204.         // only used by the structure to reorder the ports
  205.         void internalSetPosition(long position);
  206.     };
  207.  
  208.     interface ObjectFactory {
  209.         object createObject(string name);
  210.     };
  211.  
  212.     interface LocalFactory : ObjectFactory {
  213.     };
  214.  
  215.     interface StructureBuilder {
  216.         void addFactory(ObjectFactory factory);
  217.         object createObject(StructureDesc structure);
  218.         ModuleDef createTypeInfo(StructureDesc structure);
  219.     };
  220.  
  221.     interface ArtsBuilderLoader : Loader {
  222.     };
  223.  
  224.     interface Structure : SynthModule {
  225.         void run();
  226.         void halt();
  227.     };
  228. };
  229.