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"
16 #define RING_BUFFERS 2
19 APluginArray::APluginArray()
20 : PluginArray(TRACK_AUDIO)
25 APluginArray::~APluginArray()
27 file->stop_audio_thread();
28 for(int i = 0; i < total_tracks(); i++)
35 void APluginArray::create_buffers()
37 file->start_audio_thread(buffer_size, RING_BUFFERS);
38 // if(!plugin_server->realtime) realtime_buffers = file->get_audio_buffer();
41 void APluginArray::get_buffers()
43 if(!realtime_buffers) realtime_buffers = file->get_audio_buffer();
46 void APluginArray::create_modules()
48 modules = new Module*[total_tracks()];
49 for(int i = 0; i < total_tracks(); i++)
51 modules[i] = new AModule(0, 0, this, tracks->values[i]);
52 modules[i]->cache = cache;
53 modules[i]->edl = edl;
54 modules[i]->create_objects();
55 modules[i]->render_init();
59 void APluginArray::process_realtime(int module, int64_t input_position, int64_t len)
61 values[module]->process_buffer(realtime_buffers + module,
64 edl->session->sample_rate,
69 int APluginArray::process_loop(int module, int64_t &write_length)
71 if(!realtime_buffers) realtime_buffers = file->get_audio_buffer();
72 int result = values[module]->process_loop(&realtime_buffers[module],
78 int APluginArray::write_buffers(int64_t len)
80 //printf("APluginArray::write_buffers 1\n");
81 int result = file->write_audio_buffer(len);
84 // if(!plugin_server->realtime && !done && !result)
85 // realtime_buffers = file->get_audio_buffer();
89 int64_t APluginArray::get_bufsize()
91 return edl->session->sample_rate;
95 void APluginArray::get_recordable_tracks()
97 tracks = new RecordableATracks(edl->tracks);
100 int APluginArray::total_tracks()
102 return tracks->total;
105 Track* APluginArray::track_number(int number)
107 return (Track*)tracks->values[number];
112 // c-file-style: "linux"