1 #ifndef COMMONRENDERTHREAD_H
2 #define COMMONRENDERTHREAD_H
5 #include "commonrender.inc"
6 #include "maxbuffers.h"
9 #include "playabletracks.inc"
10 #include "renderengine.inc"
13 #include "virtualnode.inc"
15 class VirtualConsole
: public Thread
18 VirtualConsole(RenderEngine
*renderengine
, CommonRender
*commonrender
, int data_type
);
19 virtual ~VirtualConsole();
21 virtual void create_objects();
22 void start_playback();
23 virtual int total_ring_buffers();
24 virtual void get_playable_tracks() {};
25 int allocate_input_buffers();
26 virtual void new_input_buffer(int ring_buffer
) { };
27 virtual void delete_input_buffer(int ring_buffer
) { };
30 // Create ptrs to input buffers
31 virtual void create_input_ptrs() {};
33 void build_virtual_console(int persistant_plugins
);
34 virtual VirtualNode
* new_toplevel_node(Track
*track
, Module
*module
, int track_number
) { return 0; };
35 Module
* module_of(Track
*track
);
36 Module
* module_number(int track_number
);
37 // Test for reconfiguration.
38 // If reconfiguration is coming up, truncate length and reset last_playback.
39 int test_reconfigure(int64_t position
,
45 RenderEngine
*renderengine
;
46 CommonRender
*commonrender
;
47 // Total playable tracks
49 // Top level node for each playable track
50 VirtualNode
**virtual_modules
;
51 // Order to process nodes
52 ArrayList
<VirtualNode
*> render_list
;
56 // Store result of total_ring_buffers for destructor
74 virtual int init_rendering(int duplicate
) {};
75 int sort_virtual_console();
76 int delete_virtual_console();
77 int delete_input_buffers();
78 int swap_thread_buffer();
79 int swap_input_buffer();
81 // Set duplicate when this virtual console is to share the old resources.
82 int start_rendering(int duplicate
);
83 virtual int stop_rendering(int duplicate
) {};
85 // for synchronizing start and stop
86 int wait_for_completion();
87 int wait_for_startup();
89 virtual int send_last_output_buffer() {};
95 int current_input_buffer
; // input buffer being read from disk
96 PlayableTracks
*playable_tracks
;
99 Mutex
*input_lock
[MAX_BUFFERS
]; // lock before sending input buffers through console
100 Mutex
*output_lock
[MAX_BUFFERS
]; // lock before loading input buffers
101 Mutex
*startup_lock
; // Lock before returning from start
103 // information for each buffer
104 int last_playback
[MAX_BUFFERS
]; // last buffer in playback range
105 int last_reconfigure
[MAX_BUFFERS
]; // last buffer before deletion and reconfiguration
106 int64_t input_len
[MAX_BUFFERS
]; // number of samples to render from this buffer
107 int64_t input_position
[MAX_BUFFERS
]; // highest numbered sample of this buffer in project
108 // or frame of this buffer in project
109 int64_t absolute_position
[MAX_BUFFERS
]; // Absolute position at start of buffer for peaks.
110 int current_vconsole_buffer
; // input buffer being rendered by vconsole