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