00001 #include "automation.h"
00002 #include "edl.h"
00003 #include "edlsession.h"
00004 #include "mwindow.h"
00005 #include "patchbay.h"
00006 #include "playabletracks.h"
00007 #include "plugin.h"
00008 #include "preferences.h"
00009 #include "renderengine.h"
00010 #include "intauto.h"
00011 #include "intautos.h"
00012 #include "tracks.h"
00013 #include "transportque.h"
00014
00015
00016 PlayableTracks::PlayableTracks(RenderEngine *renderengine,
00017 long current_position,
00018 int data_type,
00019 int use_nudge)
00020 : ArrayList<Track*>()
00021 {
00022 this->renderengine = renderengine;
00023 this->data_type = data_type;
00024
00025
00026 for(Track *current_track = renderengine->edl->tracks->first;
00027 current_track;
00028 current_track = current_track->next)
00029 {
00030 if(is_playable(current_track, current_position, use_nudge))
00031 {
00032
00033 append(current_track);
00034 }
00035 }
00036
00037 }
00038
00039 PlayableTracks::~PlayableTracks()
00040 {
00041 }
00042
00043
00044 int PlayableTracks::is_playable(Track *current_track,
00045 long position,
00046 int use_nudge)
00047 {
00048 int result = 1;
00049 int direction = renderengine->command->get_direction();
00050 if(use_nudge) position += current_track->nudge;
00051
00052 Auto *current = 0;
00053 int *do_channel;
00054 switch(data_type)
00055 {
00056 case TRACK_AUDIO:
00057 do_channel = renderengine->config->aconfig->do_channel;
00058 break;
00059 case TRACK_VIDEO:
00060 do_channel = renderengine->config->vconfig->do_channel;
00061 break;
00062 }
00063
00064 if(current_track->data_type != data_type) result = 0;
00065
00066
00067
00068
00069
00070 if(result)
00071 {
00072 if(!current_track->plugin_used(position, direction) &&
00073 !current_track->channel_is_playable(position, direction, do_channel))
00074 result = 0;
00075 }
00076
00077
00078 if(!current_track->play)
00079 {
00080 result = 0;
00081 }
00082
00083 if(result)
00084 {
00085
00086 if(!current_track->playable_edit(position, direction))
00087 {
00088
00089 if(!current_track->is_synthesis(renderengine,
00090 position,
00091 direction))
00092 {
00093 result = 0;
00094 }
00095 }
00096 }
00097
00098 return result;
00099 }
00100
00101
00102 int PlayableTracks::is_listed(Track *track)
00103 {
00104 for(int i = 0; i < total; i++)
00105 {
00106 if(values[i] == track) return 1;
00107 }
00108 return 0;
00109 }