4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "tracklist.h"
26 TrackList::TrackList(MWindow *mwindow, long position, int reverse)
29 this->mwindow = mwindow;
32 TrackList::get_playable_audio(long position, int reverse)
34 get_playable_type(position, reverse, TRACK_AUDIO);
37 TrackList::get_playable_video(long position, int reverse)
39 get_playable_type(position, reverse, TRACK_VIDEO);
44 TrackList::get_recordable_audio()
46 get_recordable_type(TRACK_AUDIO);
49 TrackList::get_recordable_video()
51 get_recordable_type(TRACK_VIDEO);
54 TrackList::get_playable_type(long position, int reverse, int data_type)
60 for(current_track = mwindow->tracks->first,
61 current_patch = mwindow->patches->first;
62 current_track && current_patch;
63 current_track = current_track->next,
64 current_patch = current_patch->next)
66 if(current_patch->play && current_track->data_type == data_type)
68 current_auto = current_track->play_autos->autoof(position);
70 // get auto right before position
73 if(current_auto && current_auto->position < position)
74 current_auto = current_auto->next;
78 if(current_auto && current_auto->position > position)
79 current_auto = current_auto->previous;
82 if(!current_auto || current_auto->value == 1)
83 append((ATrack*)current_track);
88 TrackList::get_recordable_type(int data_type)
93 for(current_track = tracks->first, current_patch = patches->first;
94 current_track && current_patch;
95 current_track = current_track->next, current_patch = current_patch->next)
97 if(current_patch->is_armed() && current_track->data_type == TRACK_AUDIO)
98 append((ATrack*)current_track);