1 #ifndef RESOURCETHREAD_H
2 #define RESOURCETHREAD_H
4 // This thread tries to draw picons into the timeline, asynchronous
7 // TrackCanvas draws the picons which are in the cache and makes a table of
8 // picons and locations which need to be decompressed. Then ResourceThread
9 // decompresses the picons and draws them one by one, refreshing the
10 // entire trackcanvas in the process.
13 #include "arraylist.h"
14 #include "bctimer.inc"
15 #include "condition.inc"
16 #include "mwindow.inc"
17 #include "resourcepixmap.inc"
22 class ResourceThreadItem
25 ResourceThreadItem(ResourcePixmap
*pixmap
,
29 virtual ~ResourceThreadItem();
31 ResourcePixmap
*pixmap
;
39 class AResourceThreadItem
: public ResourceThreadItem
42 AResourceThreadItem(ResourcePixmap
*pixmap
,
49 ~AResourceThreadItem();
56 class VResourceThreadItem
: public ResourceThreadItem
59 VResourceThreadItem(ResourcePixmap
*pixmap
,
69 ~VResourceThreadItem();
83 class ResourceThread
: public Thread
86 ResourceThread(MWindow
*mwindow
);
90 void create_objects();
91 // reset - delete all picons. Used for index building.
92 void stop_draw(int reset
);
95 // Be sure to stop_draw before changing the asset table,
97 void add_picon(ResourcePixmap
*pixmap
,
107 void add_wave(ResourcePixmap
*pixmap
,
111 // samples relative to asset rate
112 int64_t source_start
,
117 void do_video(VResourceThreadItem
*item
);
118 void do_audio(AResourceThreadItem
*item
);
121 Condition
*draw_lock
;
122 // Condition *interrupted_lock;
124 ArrayList
<ResourceThreadItem
*> items
;
129 // Current audio buffer for spanning multiple pixels
130 double *audio_buffer
;
135 // Timer for waveform refreshes
141 // Incremented after every start_draw to prevent overlapping operations