1 #ifndef PLAYBACKENGINE_H
2 #define PLAYBACKENGINE_H
5 #include "audiodevice.inc"
8 #include "channeldb.inc"
9 #include "condition.inc"
10 #include "defaults.inc"
12 #include "mwindow.inc"
13 #include "maxchannels.h"
15 #include "tracking.inc"
16 #include "preferences.inc"
17 #include "renderengine.inc"
20 #include "transportque.inc"
21 #include "videodevice.inc"
23 class PlaybackEngine
: public Thread
26 PlaybackEngine(MWindow
*mwindow
, Canvas
*output
);
27 virtual ~PlaybackEngine();
30 virtual int create_render_engine();
31 void delete_render_engine();
32 void arm_render_engine();
33 void start_render_engine();
34 void wait_render_engine();
36 void perform_change();
37 void sync_parameters(EDL
*edl
);
38 // Set wait_tracking for events that change the cursor location but
39 // be sure to unlock the windows
40 void interrupt_playback(int wait_tracking
= 0);
41 // Get levels for tracking. Return 0 if no audio.
42 int get_output_levels(double *levels
, long position
);
43 int get_module_levels(ArrayList
<double> *module_levels
, long position
);
44 // The MWindow starts the playback cursor loop
45 // The other windows start a slider loop
46 // For pausing only the cursor is run
47 virtual void init_cursor();
48 virtual void stop_cursor();
49 virtual int brender_available(long position
);
50 // For normal playback tracking and the cursor are started
51 virtual void init_tracking();
52 virtual void stop_tracking();
53 // The playback cursor calls this to calculate the current tracking position
54 virtual double get_tracking_position();
55 // Reset the transport after completion
56 virtual void update_transport(int command
, int paused
);
57 // The render engines call this to update tracking variables in the playback engine.
58 void update_tracking(double position
);
59 // Get the output channel table for the current device or 0 if none exists.
60 ChannelDB
* get_channeldb();
64 // Maintain caches through console changes
65 CICache
*audio_cache
, *video_cache
;
66 // Maintain playback cursor on GUI
68 // Tracking variables updated by render engines
69 double tracking_position
;
70 // Not accurate until the first update_tracking, at which time
71 // tracking_active is incremented to 2.
73 // Lock access to tracking data
75 // Block returns until tracking loop is finished
76 Condition
*tracking_done
;
77 // Pause the main loop for the PAUSE command
78 Condition
*pause_lock
;
79 // Wait until thread has started
80 Condition
*start_lock
;
84 // Copy of main preferences
85 Preferences
*preferences
;
88 // Currently executing command
89 TransportCommand
*command
;
90 // Last command which affected transport
95 RenderEngine
*render_engine
;
97 // Used by label commands to get current position
100 // General purpose debugging register