4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include "arraylist.h"
28 #include "floatauto.inc"
29 #include "floatautos.inc"
30 #include "mwindow.inc"
31 #include "maxbuffers.h"
34 #include "pluginserver.inc"
35 #include "renderengine.inc"
37 #include "transition.inc"
38 #include "virtualconsole.inc"
40 // The virtual node makes up the virtual console.
41 // It can be either a virtual module or a virtual plugin.
47 VirtualNode(RenderEngine *renderengine,
48 VirtualConsole *vconsole,
52 VirtualNode *parent_node);
54 friend class VirtualConsole;
56 virtual ~VirtualNode();
57 void dump(int indent);
61 int expand(int persistent_plugins, int64_t current_position);
62 // create convenience pointers to shared memory depending on the data type
63 virtual int create_buffer_ptrs() { return 0; }
64 // create a node for a module and expand it
65 int attach_virtual_module(Plugin *plugin,
68 int64_t current_position);
69 // create a node for a plugin and expand it
70 int attach_virtual_plugin(Plugin *plugin,
73 int64_t current_position);
74 virtual VirtualNode* create_module(Plugin *real_plugin,
76 Track *track) { return 0; };
77 virtual VirtualNode* create_plugin(Plugin *real_plugin) { return 0; };
80 // Called by read_data to get the previous plugin in a parent node's subnode
82 VirtualNode* get_previous_plugin(VirtualNode *current_plugin);
84 // subnodes this node owns
86 ArrayList<VirtualNode*> subnodes;
87 // Attachment point in Module if this is a virtual plugin
88 AttachmentPoint *attachment;
90 VirtualConsole *vconsole;
91 // node which created this node.
92 VirtualNode *parent_node;
93 // use these to determine if this node is a plugin or module
94 // Top level virtual node of module
96 // When this node is a plugin. Redirected to the shared plugin in expansion.
101 RenderEngine *renderengine;
103 // for rendering need to know if the buffer is a master or copy
104 // These are set in expand()
106 int output_is_master;
107 int ring_buffers; // number of buffers for master buffers
108 int64_t buffer_size; // number of units in a master segment
109 int64_t fragment_size; // number of units in a node segment
110 int plugin_type; // type of plugin in case user changes it
111 int render_count; // times this plugin has been added to the render list
112 int waiting_real_plugin; // real plugin tests this to see if virtual plugin is waiting on it when sorting
113 // attachment point needs to know what buffer to put data into from
114 // a multichannel plugin
115 int plugin_buffer_number;
118 // Return whether the next samples are muted and store the duration
119 // of the next status in fragment_len
120 void get_mute_fragment(int64_t input_position,
127 // convenience routines for fade automation
129 * void get_fade_automation(double &slope,
131 * int64_t input_position,
132 * int64_t &slope_len,
135 * int init_automation(int &automate,
137 * int64_t input_position,
138 * int64_t buffer_len,
143 * int init_slope(Autos *autos, Auto **before, Auto **after);
144 * int get_slope(Autos *autos, int64_t buffer_len, int64_t buffer_position);
145 * int advance_slope(Autos *autos);
150 // ======================= plugin automation
151 FloatAutos *plugin_autos;
152 FloatAuto *plugin_auto_before, *plugin_auto_after;
154 // temporary variables for automation
159 double slope_position;
165 int sort_as_module(ArrayList<VirtualNode*>*render_list, int &result, int &total_result);
166 int sort_as_plugin(ArrayList<VirtualNode*>*render_list, int &result, int &total_result);
167 int expand_as_module(int duplicate, int64_t current_position);
168 int expand_as_plugin(int duplicate);