Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

pluginaclient.C

Go to the documentation of this file.
00001 #include "edl.h"
00002 #include "edlsession.h"
00003 #include "pluginaclient.h"
00004 #include "pluginserver.h"
00005 
00006 #include <string.h>
00007 
00008 
00009 PluginAClient::PluginAClient(PluginServer *server)
00010  : PluginClient(server)
00011 {
00012         sample_rate = 0;
00013         if(server &&
00014                 server->edl &&
00015                 server->edl->session) 
00016         {
00017                 project_sample_rate = server->edl->session->sample_rate;
00018                 sample_rate = project_sample_rate;
00019         }
00020         else
00021         {
00022                 project_sample_rate = 1;
00023                 sample_rate = 1;
00024         }
00025 }
00026 
00027 PluginAClient::~PluginAClient()
00028 {
00029 }
00030 
00031 int PluginAClient::is_audio()
00032 {
00033         return 1;
00034 }
00035 
00036 
00037 int PluginAClient::get_render_ptrs()
00038 {
00039         int i, j, double_buffer, fragment_position;
00040 
00041         for(i = 0; i < total_in_buffers; i++)
00042         {
00043                 double_buffer = double_buffer_in_render.values[i];
00044                 fragment_position = offset_in_render.values[i];
00045                 input_ptr_render[i] = &input_ptr_master.values[i][double_buffer][fragment_position];
00046 //printf("PluginAClient::get_render_ptrs %x\n", input_ptr_master.values[i][double_buffer]);
00047         }
00048 
00049         for(i = 0; i < total_out_buffers; i++)
00050         {
00051                 double_buffer = double_buffer_out_render.values[i];
00052                 fragment_position = offset_out_render.values[i];
00053                 output_ptr_render[i] = &output_ptr_master.values[i][double_buffer][fragment_position];
00054         }
00055 //printf("PluginAClient::get_render_ptrs %x %x\n", input_ptr_render[0], output_ptr_render[0]);
00056         return 0;
00057 }
00058 
00059 int PluginAClient::init_realtime_parameters()
00060 {
00061         project_sample_rate = server->edl->session->sample_rate;
00062         return 0;
00063 }
00064 
00065 int PluginAClient::process_realtime(int64_t size, 
00066         double **input_ptr, 
00067         double **output_ptr)
00068 {
00069         return 0;
00070 }
00071 
00072 int PluginAClient::process_realtime(int64_t size, 
00073         double *input_ptr, 
00074         double *output_ptr)
00075 {
00076         return 0;
00077 }
00078 
00079 int PluginAClient::process_buffer(int64_t size, 
00080         double **buffer,
00081         int64_t start_position,
00082         int sample_rate)
00083 {
00084         for(int i = 0; i < PluginClient::total_in_buffers; i++)
00085                 read_samples(buffer[i], 
00086                         i, 
00087                         sample_rate, 
00088                         source_position, 
00089                         size);
00090         process_realtime(size, buffer, buffer);
00091         return 0;
00092 }
00093 
00094 int PluginAClient::process_buffer(int64_t size, 
00095         double *buffer,
00096         int64_t start_position,
00097         int sample_rate)
00098 {
00099         read_samples(buffer, 
00100                 0, 
00101                 sample_rate, 
00102                 source_position, 
00103                 size);
00104         process_realtime(size, buffer, buffer);
00105         return 0;
00106 }
00107 
00108 
00109 
00110 
00111 int PluginAClient::plugin_start_loop(int64_t start, 
00112         int64_t end, 
00113         int64_t buffer_size, 
00114         int total_buffers)
00115 {
00116         sample_rate = get_project_samplerate();
00117         return PluginClient::plugin_start_loop(start, 
00118                 end, 
00119                 buffer_size, 
00120                 total_buffers);
00121 }
00122 
00123 int PluginAClient::plugin_get_parameters()
00124 {
00125         sample_rate = get_project_samplerate();
00126         return PluginClient::plugin_get_parameters();
00127 }
00128 
00129 
00130 int64_t PluginAClient::local_to_edl(int64_t position)
00131 {
00132         if(position < 0) return position;
00133         return (int64_t)(position *
00134                 get_project_samplerate() /
00135                 sample_rate);
00136         return 0;
00137 }
00138 
00139 int64_t PluginAClient::edl_to_local(int64_t position)
00140 {
00141         if(position < 0) return position;
00142         return (int64_t)(position *
00143                 sample_rate /
00144                 get_project_samplerate());
00145 }
00146 
00147 
00148 int PluginAClient::plugin_process_loop(double **buffers, int64_t &write_length)
00149 {
00150         write_length = 0;
00151 
00152         if(is_multichannel())
00153                 return process_loop(buffers, write_length);
00154         else
00155                 return process_loop(buffers[0], write_length);
00156 }
00157 
00158 int PluginAClient::read_samples(double *buffer, 
00159         int channel, 
00160         int64_t start_position, 
00161         int64_t total_samples)
00162 {
00163         return server->read_samples(buffer, 
00164                 channel, 
00165                 start_position, 
00166                 total_samples);
00167 }
00168 
00169 int PluginAClient::read_samples(double *buffer, 
00170         int64_t start_position, 
00171         int64_t total_samples)
00172 {
00173         return server->read_samples(buffer, 
00174                 0, 
00175                 start_position, 
00176                 total_samples);
00177 }
00178 
00179 int PluginAClient::read_samples(double *buffer,
00180                 int channel,
00181                 int sample_rate,
00182                 int64_t start_position,
00183                 int64_t len)
00184 {
00185         return server->read_samples(buffer,
00186                 channel,
00187                 sample_rate,
00188                 start_position,
00189                 len);
00190 }
00191 
00192 
00193 void PluginAClient::send_render_gui(void *data, int size)
00194 {
00195         server->send_render_gui(data, size);
00196 }
00197 
00198 void PluginAClient::plugin_render_gui(void *data, int size)
00199 {
00200         render_gui(data, size);
00201 }
00202 
00203 int PluginAClient::get_project_samplerate()
00204 {
00205         return project_sample_rate;
00206 }
00207 
00208 int PluginAClient::get_samplerate()
00209 {
00210         return sample_rate;
00211 }
00212 
00213 
00214 
00215 
00216 
00217 

Generated on Sun Jan 8 13:38:58 2006 for Cinelerra-svn by  doxygen 1.4.4