r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / pluginaclient.C
blob6a7738928b4bdd100529d503d8f9be911d11cded
1 #include "edl.h"
2 #include "edlsession.h"
3 #include "pluginaclient.h"
4 #include "pluginserver.h"
6 #include <string.h>
9 PluginAClient::PluginAClient(PluginServer *server)
10  : PluginClient(server)
12         if(server &&
13                 server->edl &&
14                 server->edl->session) 
15                 project_sample_rate = server->edl->session->sample_rate;
16         else
17                 project_sample_rate = 1;
20 PluginAClient::~PluginAClient()
24 int PluginAClient::is_audio()
26         return 1;
30 int PluginAClient::get_render_ptrs()
32         int i, j, double_buffer, fragment_position;
34         for(i = 0; i < total_in_buffers; i++)
35         {
36                 double_buffer = double_buffer_in_render.values[i];
37                 fragment_position = offset_in_render.values[i];
38                 input_ptr_render[i] = &input_ptr_master.values[i][double_buffer][fragment_position];
39 //printf("PluginAClient::get_render_ptrs %x\n", input_ptr_master.values[i][double_buffer]);
40         }
42         for(i = 0; i < total_out_buffers; i++)
43         {
44                 double_buffer = double_buffer_out_render.values[i];
45                 fragment_position = offset_out_render.values[i];
46                 output_ptr_render[i] = &output_ptr_master.values[i][double_buffer][fragment_position];
47         }
48 //printf("PluginAClient::get_render_ptrs %x %x\n", input_ptr_render[0], output_ptr_render[0]);
49         return 0;
52 int PluginAClient::init_realtime_parameters()
54         project_sample_rate = server->edl->session->sample_rate;
55         return 0;
58 void PluginAClient::plugin_process_realtime(double **input, 
59                 double **output, 
60                 int64_t current_position, 
61                 int64_t fragment_size,
62                 int64_t total_len)
64 //printf("PluginAClient::plugin_process_realtime 1\n");
65         this->source_position = current_position;
66         this->total_len = total_len;
68         if(is_multichannel())
69                 process_realtime(fragment_size, input, output);
70         else
71                 process_realtime(fragment_size, input[0], output[0]);
76 int PluginAClient::plugin_process_loop(double **buffers, int64_t &write_length)
78         write_length = 0;
80         if(is_multichannel())
81                 return process_loop(buffers, write_length);
82         else
83                 return process_loop(buffers[0], write_length);
86 int PluginAClient::read_samples(double *buffer, int channel, int64_t start_position, int64_t total_samples)
88 //printf("PluginAClient::read_samples 1\n");
89         return server->read_samples(buffer, channel, start_position, total_samples);
92 int PluginAClient::read_samples(double *buffer, int64_t start_position, int64_t total_samples)
94 //printf("PluginAClient::read_samples 1\n");
95         return server->read_samples(buffer, start_position, total_samples);
99 void PluginAClient::send_render_gui(void *data, int size)
101 //printf("PluginVClient::send_render_gui 1\n");
102         server->send_render_gui(data, size);
105 void PluginAClient::plugin_render_gui(void *data, int size)
107         render_gui(data, size);