r999: maintainers added to README_en.
[cinelerra_cv/mob.git] / cinelerra / playabletracks.C
blob9ffefbd6c67ac7973aaa4d4543000b6f5182b149
1 #include "automation.h"
2 #include "edl.h"
3 #include "edlsession.h"
4 #include "mwindow.h"
5 #include "patchbay.h"
6 #include "playabletracks.h"
7 #include "plugin.h"
8 #include "preferences.h"
9 #include "renderengine.h"
10 #include "intauto.h"
11 #include "intautos.h"
12 #include "tracks.h"
13 #include "transportque.h"
16 PlayableTracks::PlayableTracks(RenderEngine *renderengine, 
17         long current_position, 
18         int data_type,
19         int use_nudge)
20  : ArrayList<Track*>()
22         this->renderengine = renderengine;
23         this->data_type = data_type;
25 //printf("PlayableTracks::PlayableTracks 1 %d\n", renderengine->edl->tracks->total());
26         for(Track *current_track = renderengine->edl->tracks->first; 
27                 current_track; 
28                 current_track = current_track->next)
29         {
30                 if(is_playable(current_track, current_position, use_nudge))
31                 {
32 //printf("PlayableTracks::PlayableTracks 1 %p %d %d\n", this, total, current_position);
33                         append(current_track);
34                 }
35         }
36 //printf("PlayableTracks::PlayableTracks %d %d %d\n", data_type, total, current_position);
39 PlayableTracks::~PlayableTracks()
44 int PlayableTracks::is_playable(Track *current_track, 
45         long position,
46         int use_nudge)
48         int result = 1;
49         int direction = renderengine->command->get_direction();
50         if(use_nudge) position += current_track->nudge;
52         Auto *current = 0;
54         if(current_track->data_type != data_type) result = 0;
55         
57 // Track is off screen and not bounced to other modules
60         if(result)
61         {
62                 if(!current_track->plugin_used(position, direction) &&
63                         !current_track->is_playable(position, direction))
64                         result = 0;
65         }
67 // Test play patch
68         if(!current_track->play)
69         {
70                 result = 0;
71         }
73         if(result)
74         {
75 // Test for playable edit
76                 if(!current_track->playable_edit(position, direction))
77                 {
78 // Test for playable effect
79                         if(!current_track->is_synthesis(renderengine,
80                                                 position,
81                                                 direction))
82                         {
83                                 result = 0;
84                         }
85                 }
86         }
88         return result;
92 int PlayableTracks::is_listed(Track *track)
94         for(int i = 0; i < total; i++)
95         {
96                 if(values[i] == track) return 1;
97         }
98         return 0;