Credit Andrew - improve in-tree documentation
[goodguy/cinelerra.git] / cinelerra / virtualanode.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
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.
10  *
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.
15  *
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
19  *
20  */
21
22 #ifndef VIRTUALANODE_H
23 #define VIRTUALANODE_H
24
25
26 #include "arender.inc"
27 #include "filethread.inc"  // RING_BUFFERS
28 #include "maxchannels.h"
29 #include "plugin.inc"
30 #include "samples.inc"
31 #include "units.h"
32 #include "virtualnode.h"
33
34 class VirtualANode : public VirtualNode
35 {
36 public:
37         VirtualANode(RenderEngine *renderengine,
38                 VirtualConsole *vconsole,
39                 Module *real_module,
40                 Plugin *real_plugin,
41                 Track *track,
42                 VirtualNode *parent_module);
43
44         ~VirtualANode();
45
46         VirtualNode* create_module(Plugin *real_plugin,
47                                                         Module *real_module,
48                                                         Track *track);
49         VirtualNode* create_plugin(Plugin *real_plugin);
50
51 // Called by VirtualAConsole::process_buffer to process exit_nodes.
52 // read_data recurses down the tree.
53         int render(Samples *output_temp,
54                 int64_t size,
55                 int64_t start_position,
56                 int64_t sample_rate);
57
58 // Read data from whatever comes before this node.
59 // Calls render in either the parent node or the module for the track.
60         int read_data(Samples *output_temp,
61                 int64_t size,
62                 int64_t start_position,
63                 int64_t sample_rate);
64
65 private:
66 // need *arender for peak updating
67         int render_as_module(Samples **audio_out,
68                 Samples *output_temp,
69                 int64_t size,
70                 int64_t start_position,
71                 int64_t sample_rate);
72         void render_as_plugin(Samples *output_temp,
73                 int64_t size,
74                 int64_t start_position,
75                 int64_t sample_rate);
76
77         int render_fade(double *buffer,
78                                         int64_t len,
79                                         int64_t input_position,
80                                         int64_t sample_rate,
81                                         Autos *autos,
82                                         int direction,
83                                         int use_nudge);
84         int render_pan(double *input,        // start of input fragment
85                                 double *output,        // start of output fragment
86                                 int64_t fragment_len,      // fragment length in input scale
87                                 int64_t input_position, // starting sample of input buffer in project
88                                 int64_t sample_rate,
89                                 Autos *autos,
90                                 int channel,
91                                 int direction,
92                                 int use_nudge);
93         void get_pan_automation(double &slope,
94                 double &intercept,
95                 int64_t input_position,
96                 int64_t &slope_len,
97                 Autos *autos,
98                 int channel,
99                 int direction);
100
101 /*
102  *      double* get_module_input(int double_buffer, int64_t fragment_position);
103  *      double* get_module_output(int double_buffer, int64_t fragment_position);
104  */
105
106         DB db;
107
108         Auto *pan_before[MAXCHANNELS], *pan_after[MAXCHANNELS];
109 };
110
111
112 #endif