r553: Modern gccs require __attribute__((used)) for variables used only in assembly.
[cinelerra_cv/mob.git] / cinelerra / playabletracks.C
blob00bfee89d643f5a021b230b037883952cfd67b30
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;
53         int *do_channel;
54         switch(data_type)
55         {
56                 case TRACK_AUDIO:
57                         do_channel = renderengine->config->aconfig->do_channel;
58                         break;
59                 case TRACK_VIDEO:
60                         do_channel = renderengine->config->vconfig->do_channel;
61                         break;
62         }
64         if(current_track->data_type != data_type) result = 0;
65         
67 // Track is off screen and not bounced to other modules
70         if(result)
71         {
72                 if(!current_track->plugin_used(position, direction) &&
73                         !current_track->channel_is_playable(position, direction, do_channel))
74                         result = 0;
75         }
77 // Test play patch
78         if(!current_track->play)
79         {
80                 result = 0;
81         }
83         if(result)
84         {
85 // Test for playable edit
86                 if(!current_track->playable_edit(position, direction))
87                 {
88 // Test for playable effect
89                         if(!current_track->is_synthesis(renderengine,
90                                                 position,
91                                                 direction))
92                         {
93                                 result = 0;
94                         }
95                 }
96         }
98         return result;
102 int PlayableTracks::is_listed(Track *track)
104         for(int i = 0; i < total; i++)
105         {
106                 if(values[i] == track) return 1;
107         }
108         return 0;