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
22 #ifndef PLUGINACLIENT_H
23 #define PLUGINACLIENT_H
27 #include "maxbuffers.h"
28 #include "pluginclient.h"
29 #include "samples.inc"
31 class PluginAClient : public PluginClient
34 PluginAClient(PluginServer *server);
35 virtual ~PluginAClient();
37 int get_render_ptrs();
38 int init_realtime_parameters();
41 // These should return 1 if error or 0 if success.
42 // Multichannel buffer process for backwards compatibility
43 virtual int process_realtime(int64_t size,
45 Samples **output_ptr);
46 // Single channel buffer process for backwards compatibility and transitions
47 virtual int process_realtime(int64_t size,
51 // Process buffer using pull method. By default this loads the input into the
52 // buffer and calls process_realtime with input and output pointing to buffer.
53 // start_position - requested position relative to sample_rate. Relative
54 // to start of EDL. End of buffer if reverse.
55 // sample_rate - scale of start_position.
56 virtual int process_buffer(int64_t size,
58 int64_t start_position,
60 virtual int process_buffer(int64_t size,
62 int64_t start_position,
66 virtual int process_loop(Samples *buffer, int64_t &write_length) { return 1; };
67 virtual int process_loop(Samples **buffers, int64_t &write_length) { return 1; };
68 int plugin_process_loop(Samples **buffers, int64_t &write_length);
70 int plugin_start_loop(int64_t start,
75 int plugin_get_parameters();
77 // Called by non-realtime client to read audio for processing.
78 // buffer - output wave
79 // channel - channel of the plugin input for multichannel plugin
80 // start_position - start of samples in forward. End of samples in reverse.
81 // Relative to start of EDL. Scaled to sample_rate.
82 // len - number of samples to read
83 int read_samples(Samples *buffer,
85 int64_t start_position,
87 int read_samples(Samples *buffer,
88 int64_t start_position,
91 // Called by realtime plugin to read audio from previous entity
92 // sample_rate - scale of start_position. Provided so the client can get data
93 // at a higher fidelity than provided by the EDL.
94 int read_samples(Samples *buffer,
97 int64_t start_position,
100 // Get the sample rate of the EDL
101 int get_project_samplerate();
102 // Get the requested sample rate
103 int get_samplerate();
105 int64_t local_to_edl(int64_t position);
106 int64_t edl_to_local(int64_t position);
109 // point to the start of the buffers
110 ArrayList<float**> input_ptr_master;
111 ArrayList<float**> output_ptr_master;
112 // point to the regions for a single render
113 float **input_ptr_render;
114 float **output_ptr_render;
115 // sample rate of EDL. Used for normalizing keyframes
116 int project_sample_rate;
117 // Local parameters set by non realtime plugin about the file to be generated.
118 // Retrieved by server to set output file format.
119 // In realtime plugins, these are set before every process_buffer as the