7 #include "floatauto.inc"
8 #include "floatautos.inc"
10 #include "maxbuffers.h"
13 #include "pluginserver.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.
25 VirtualNode(RenderEngine
*renderengine
,
26 VirtualConsole
*vconsole
,
30 VirtualNode
*parent_module
,
36 virtual ~VirtualNode();
37 void dump(int indent
);
39 // derived node creates buffers here
40 virtual void new_output_buffer() { };
41 virtual void new_input_buffer() { };
45 int expand(int persistant_plugins
, int64_t current_position
);
46 // create buffers and convenience pointers
48 // create convenience pointers to shared memory depending on the data type
49 virtual int create_buffer_ptrs() {};
50 // create a node for a module
51 int attach_virtual_module(Plugin
*plugin
,
54 int64_t current_position
);
55 // create a node for a plugin
56 int attach_virtual_plugin(Plugin
*plugin
,
59 int64_t current_position
);
60 virtual VirtualNode
* create_module(Plugin
*real_plugin
,
62 Track
*track
) { return 0; };
63 virtual VirtualNode
* create_plugin(Plugin
*real_plugin
) { return 0; };
65 int render_as_plugin(int64_t source_len
,
66 int64_t source_position
,
68 int64_t fragment_position
,
69 int64_t fragment_len
);
71 int get_plugin_input(int &double_buffer_in
, int64_t &fragment_position_in
,
72 int &double_buffer_out
, int64_t &fragment_position_out
,
73 int double_buffer
, int64_t fragment_position
);
75 // Get the order to render modules and plugins attached to this.
76 // Return 1 if not completed after this pass.
77 int sort(ArrayList
<VirtualNode
*>*render_list
);
79 // virtual plugins this module owns
80 ArrayList
<VirtualNode
*> vplugins
;
81 // Attachment point in Module if this is a virtual plugin
82 AttachmentPoint
*attachment
;
84 VirtualConsole
*vconsole
;
85 // module which created this node.
86 VirtualNode
*parent_module
;
87 // use these to determine if this node is a plugin or module
88 // Top level virtual node of module
90 // When this node is a plugin. Redirected to the shared plugin in expansion.
95 RenderEngine
*renderengine
;
97 // for rendering need to know if the buffer is a master or copy
98 // These are set in expand()
100 int output_is_master
;
101 int ring_buffers
; // number of buffers for master buffers
102 int64_t buffer_size
; // number of units in a master segment
103 int64_t fragment_size
; // number of units in a node segment
104 int plugin_type
; // type of plugin in case user changes it
105 int render_count
; // times this plugin has been added to the render list
106 int waiting_real_plugin
; // real plugin tests this to see if virtual plugin is waiting on it when sorting
107 // for deleting need to know if buffers are owned by someone else
110 // where this node should get its input and output from
113 // module needs to know where the input data for the next process is
115 // plugin needs to know what buffer number each fragment position corresponds to
116 int plugin_buffer_number
;
119 // Return whether the next samples are muted and store the duration
120 // of the next status in fragment_len
121 void get_mute_fragment(int64_t input_position
,
123 int64_t &fragment_len
,
126 // convenience routines for fade automation
127 void get_fade_automation(double &slope
,
129 int64_t input_position
,
132 void get_pan_automation(double &slope
,
134 int64_t input_position
,
139 int init_automation(int &automate
,
141 int64_t input_position
,
147 int init_slope(Autos
*autos
, Auto
**before
, Auto
**after
);
148 int get_slope(Autos
*autos
, int64_t buffer_len
, int64_t buffer_position
);
149 int advance_slope(Autos
*autos
);
153 // ======================= plugin automation
154 FloatAutos
*plugin_autos
;
155 FloatAuto
*plugin_auto_before
, *plugin_auto_after
;
157 // temporary variables for automation
162 double slope_position
;
166 int reverse
; // Temporary set for each render
167 int64_t input_start
, input_end
;
168 int64_t buffer_position
; // position in both input and output buffer
171 int sort_as_module(ArrayList
<VirtualNode
*>*render_list
, int &result
, int &total_result
);
172 int sort_as_plugin(ArrayList
<VirtualNode
*>*render_list
, int &result
, int &total_result
);
173 int expand_as_module(int duplicate
, int64_t current_position
);
174 int expand_as_plugin(int duplicate
);