r870: Merge 2.1:
[cinelerra_cv.git] / cinelerra / virtualnode.h
blobca59b78819be32bc7d564614b267f5bccbdb6960
1 #ifndef VIRTUALNODE_H
2 #define VIRTUALNODE_H
4 #include "arraylist.h"
5 #include "auto.inc"
6 #include "autos.inc"
7 #include "floatauto.inc"
8 #include "floatautos.inc"
9 #include "mwindow.inc"
10 #include "maxbuffers.h"
11 #include "patch.h"
12 #include "plugin.inc"
13 #include "pluginserver.inc"
14 #include "track.inc"
15 #include "transition.inc"
16 #include "virtualconsole.inc"
18 // The virtual node makes up the virtual console.
19 // It can be either a virtual module or a virtual plugin.
22 class VirtualNode
24 public:
25 VirtualNode(RenderEngine *renderengine,
26 VirtualConsole *vconsole,
27 Module *real_module,
28 Plugin *real_plugin,
29 Track *track,
30 VirtualNode *parent_node);
32 friend class VirtualConsole;
34 virtual ~VirtualNode();
35 void dump(int indent);
38 // expand plugins
39 int expand(int persistent_plugins, int64_t current_position);
40 // create convenience pointers to shared memory depending on the data type
41 virtual int create_buffer_ptrs() {};
42 // create a node for a module and expand it
43 int attach_virtual_module(Plugin *plugin,
44 int plugin_number,
45 int duplicate,
46 int64_t current_position);
47 // create a node for a plugin and expand it
48 int attach_virtual_plugin(Plugin *plugin,
49 int plugin_number,
50 int duplicate,
51 int64_t current_position);
52 virtual VirtualNode* create_module(Plugin *real_plugin,
53 Module *real_module,
54 Track *track) { return 0; };
55 virtual VirtualNode* create_plugin(Plugin *real_plugin) { return 0; };
58 // Called by read_data to get the previous plugin in a parent node's subnode
59 // table.
60 VirtualNode* get_previous_plugin(VirtualNode *current_plugin);
62 // subnodes this node owns
63 // was vplugins
64 ArrayList<VirtualNode*> subnodes;
65 // Attachment point in Module if this is a virtual plugin
66 AttachmentPoint *attachment;
68 VirtualConsole *vconsole;
69 // node which created this node.
70 VirtualNode *parent_node;
71 // use these to determine if this node is a plugin or module
72 // Top level virtual node of module
73 Module *real_module;
74 // When this node is a plugin. Redirected to the shared plugin in expansion.
75 Plugin *real_plugin;
78 Track *track;
79 RenderEngine *renderengine;
81 // for rendering need to know if the buffer is a master or copy
82 // These are set in expand()
83 int input_is_master;
84 int output_is_master;
85 int ring_buffers; // number of buffers for master buffers
86 int64_t buffer_size; // number of units in a master segment
87 int64_t fragment_size; // number of units in a node segment
88 int plugin_type; // type of plugin in case user changes it
89 int render_count; // times this plugin has been added to the render list
90 int waiting_real_plugin; // real plugin tests this to see if virtual plugin is waiting on it when sorting
91 // attachment point needs to know what buffer to put data into from
92 // a multichannel plugin
93 int plugin_buffer_number;
95 // Mute automation.
96 // Return whether the next samples are muted and store the duration
97 // of the next status in fragment_len
98 void get_mute_fragment(int64_t input_position,
99 int &mute_constant,
100 int &fragment_len,
101 Autos *autos,
102 int direction,
103 int use_nudge);
105 // convenience routines for fade automation
107 * void get_fade_automation(double &slope,
108 * double &intercept,
109 * int64_t input_position,
110 * int64_t &slope_len,
111 * Autos *autos);
113 * int init_automation(int &automate,
114 * double &constant,
115 * int64_t input_position,
116 * int64_t buffer_len,
117 * Autos *autos,
118 * Auto **before,
119 * Auto **after);
121 * int init_slope(Autos *autos, Auto **before, Auto **after);
122 * int get_slope(Autos *autos, int64_t buffer_len, int64_t buffer_position);
123 * int advance_slope(Autos *autos);
126 protected:
128 // ======================= plugin automation
129 FloatAutos *plugin_autos;
130 FloatAuto *plugin_auto_before, *plugin_auto_after;
132 // temporary variables for automation
133 Auto *current_auto;
134 double slope_value;
135 double slope_start;
136 double slope_end;
137 double slope_position;
138 double slope;
139 double value;
142 private:
143 int sort_as_module(ArrayList<VirtualNode*>*render_list, int &result, int &total_result);
144 int sort_as_plugin(ArrayList<VirtualNode*>*render_list, int &result, int &total_result);
145 int expand_as_module(int duplicate, int64_t current_position);
146 int expand_as_plugin(int duplicate);
147 int is_exit;
152 #endif