4 * Copyright (C) 2009 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
23 #include "edlsession.h"
24 #include "pluginaclient.h"
25 #include "pluginserver.h"
31 PluginAClient::PluginAClient(PluginServer *server)
32 : PluginClient(server)
39 project_sample_rate = server->edl->session->sample_rate;
40 sample_rate = project_sample_rate;
44 project_sample_rate = 1;
49 PluginAClient::~PluginAClient()
53 int PluginAClient::is_audio()
59 int PluginAClient::get_render_ptrs()
61 int i, double_buffer, fragment_position;
63 for(i = 0; i < total_in_buffers; i++)
65 double_buffer = double_buffer_in_render.values[i];
66 fragment_position = offset_in_render.values[i];
67 input_ptr_render[i] = &input_ptr_master.values[i][double_buffer][fragment_position];
68 //printf("PluginAClient::get_render_ptrs %x\n", input_ptr_master.values[i][double_buffer]);
71 for(i = 0; i < total_out_buffers; i++)
73 double_buffer = double_buffer_out_render.values[i];
74 fragment_position = offset_out_render.values[i];
75 output_ptr_render[i] = &output_ptr_master.values[i][double_buffer][fragment_position];
77 //printf("PluginAClient::get_render_ptrs %x %x\n", input_ptr_render[0], output_ptr_render[0]);
81 int PluginAClient::init_realtime_parameters()
83 project_sample_rate = server->edl->session->sample_rate;
87 int PluginAClient::process_realtime(int64_t size,
94 int PluginAClient::process_realtime(int64_t size,
101 int PluginAClient::process_buffer(int64_t size,
103 int64_t start_position,
106 for(int i = 0; i < PluginClient::total_in_buffers; i++)
107 read_samples(buffer[i],
112 process_realtime(size, buffer, buffer);
116 int PluginAClient::process_buffer(int64_t size,
118 int64_t start_position,
126 process_realtime(size, buffer, buffer);
133 int PluginAClient::plugin_start_loop(int64_t start,
138 sample_rate = get_project_samplerate();
139 return PluginClient::plugin_start_loop(start,
145 int PluginAClient::plugin_get_parameters()
147 sample_rate = get_project_samplerate();
148 return PluginClient::plugin_get_parameters();
152 int64_t PluginAClient::local_to_edl(int64_t position)
154 if(position < 0) return position;
155 return (int64_t)(position *
156 get_project_samplerate() /
161 int64_t PluginAClient::edl_to_local(int64_t position)
163 if(position < 0) return position;
164 return (int64_t)(position *
166 get_project_samplerate());
170 int PluginAClient::plugin_process_loop(Samples **buffers, int64_t &write_length)
174 if(is_multichannel())
175 return process_loop(buffers, write_length);
177 return process_loop(buffers[0], write_length);
180 int PluginAClient::read_samples(Samples *buffer,
182 int64_t start_position,
183 int64_t total_samples)
185 return server->read_samples(buffer,
191 int PluginAClient::read_samples(Samples *buffer,
192 int64_t start_position,
193 int64_t total_samples)
195 return server->read_samples(buffer,
201 int PluginAClient::read_samples(Samples *buffer,
204 int64_t start_position,
207 return server->read_samples(buffer,
217 int PluginAClient::get_project_samplerate()
219 return project_sample_rate;
222 int PluginAClient::get_samplerate()