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; };
79 int check_circular(Track *track);
81 // Called by read_data to get the previous plugin in a parent node's subnode
83 VirtualNode* get_previous_plugin(VirtualNode *current_plugin);
85 // subnodes this node owns
87 ArrayList<VirtualNode*> subnodes;
88 // Attachment point in Module if this is a virtual plugin
89 AttachmentPoint *attachment;
91 VirtualConsole *vconsole;
92 // node which created this node.
93 VirtualNode *parent_node;
94 // use these to determine if this node is a plugin or module
95 // Top level virtual node of module
97 // When this node is a plugin. Redirected to the shared plugin in expansion.
102 RenderEngine *renderengine;
104 // for rendering need to know if the buffer is a master or copy
105 // These are set in expand()
107 int output_is_master;
108 int ring_buffers; // number of buffers for master buffers
109 int64_t buffer_size; // number of units in a master segment
110 int64_t fragment_size; // number of units in a node segment
111 int plugin_type; // type of plugin in case user changes it
112 int render_count; // times this plugin has been added to the render list
113 int waiting_real_plugin; // real plugin tests this to see if virtual plugin is waiting on it when sorting
114 // attachment point needs to know what buffer to put data into from
115 // a multichannel plugin
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,
128 // convenience routines for fade automation
130 * void get_fade_automation(double &slope,
132 * int64_t input_position,
133 * int64_t &slope_len,
136 * int init_automation(int &automate,
138 * int64_t input_position,
139 * int64_t buffer_len,
144 * int init_slope(Autos *autos, Auto **before, Auto **after);
145 * int get_slope(Autos *autos, int64_t buffer_len, int64_t buffer_position);
146 * int advance_slope(Autos *autos);
151 // ======================= plugin automation
152 FloatAutos *plugin_autos;
153 FloatAuto *plugin_auto_before, *plugin_auto_after;
155 // temporary variables for automation
160 double slope_position;
166 int sort_as_module(ArrayList<VirtualNode*>*render_list, int &result, int &total_result);
167 int sort_as_plugin(ArrayList<VirtualNode*>*render_list, int &result, int &total_result);
168 int expand_as_module(int duplicate, int64_t current_position);
169 int expand_as_plugin(int duplicate);