2 #include "apluginarray.h"
6 #include "edlsession.h"
9 #include "playbackengine.h"
10 #include "pluginserver.h"
11 #include "preferences.h"
12 #include "recordableatracks.h"
13 #include "mainsession.h"
15 APluginArray::APluginArray()
21 APluginArray::~APluginArray()
23 file->stop_audio_thread();
24 for(int i = 0; i < total_tracks(); i++)
31 void APluginArray::create_buffers()
33 file->start_audio_thread(buffer_size, RING_BUFFERS);
34 // if(!plugin_server->realtime) realtime_buffers = file->get_audio_buffer();
37 void APluginArray::create_modules()
39 modules = new Module*[total_tracks()];
40 for(int i = 0; i < total_tracks(); i++)
42 modules[i] = new AModule(0, 0, this, tracks->values[i]);
43 modules[i]->cache = cache;
44 modules[i]->edl = edl;
45 modules[i]->create_objects();
46 modules[i]->render_init();
50 void APluginArray::load_module(int module, int64_t input_position, int64_t len)
52 if(module == 0) realtime_buffers = file->get_audio_buffer();
53 //printf("APluginArray::load_module 1 %d %d %p %p\n", module, len, realtime_buffers, realtime_buffers[module]);
54 ((AModule*)modules[module])->render(realtime_buffers[module],
60 void APluginArray::process_realtime(int module, int64_t input_position, int64_t len)
62 //printf("APluginArray::process_realtime 1 %d %p %p\n", len, realtime_buffers, realtime_buffers[0]);
63 values[module]->process_realtime(realtime_buffers + module,
64 realtime_buffers + module,
70 int APluginArray::process_loop(int module, int64_t &write_length)
72 //printf("APluginArray::process_loop 1\n");
73 if(!realtime_buffers) realtime_buffers = file->get_audio_buffer();
74 //printf("APluginArray::process_loop 2\n");
75 int result = values[module]->process_loop(&realtime_buffers[module],
77 //printf("APluginArray::process_loop 3\n");
82 int APluginArray::write_buffers(int64_t len)
84 //printf("APluginArray::write_buffers 1\n");
85 int result = file->write_audio_buffer(len);
88 // if(!plugin_server->realtime && !done && !result)
89 // realtime_buffers = file->get_audio_buffer();
93 int64_t APluginArray::get_bufsize()
95 return mwindow->edl->session->sample_rate;
99 void APluginArray::get_recordable_tracks()
101 tracks = new RecordableATracks(mwindow->edl->tracks);
104 int APluginArray::total_tracks()
106 return tracks->total;
109 Track* APluginArray::track_number(int number)
111 return (Track*)tracks->values[number];