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
25 #include "edlsession.h"
26 #include "localsession.h"
27 #include "mainclock.h"
28 #include "meterpanel.h"
30 #include "renderengine.h"
31 #include "mainclock.h"
32 #include "vplayback.h"
35 #include "vtracking.h"
37 #include "vwindowgui.h"
40 VTracking::VTracking(MWindow *mwindow, VWindow *vwindow)
43 this->vwindow = vwindow;
46 VTracking::~VTracking()
50 PlaybackEngine* VTracking::get_playback_engine()
52 return vwindow->playback_engine;
55 void VTracking::update_tracker(double position)
57 if( !vwindow->get_edl() ) return;
58 vwindow->gui->lock_window("VTracking::update_tracker");
59 vwindow->get_edl()->local_session->set_selectionstart(position);
60 vwindow->get_edl()->local_session->set_selectionend(position);
61 vwindow->gui->clock->update(position);
62 // This is going to boost the latency but we need to update the timebar
63 vwindow->gui->timebar->update(1);
64 vwindow->gui->unlock_window();
65 update_meters((int64_t)(position * mwindow->edl->session->sample_rate));
68 int VTracking::start_playback(double new_position)
71 return Tracking::start_playback(new_position);
74 void VTracking::update_meters(int64_t position)
76 double output_levels[MAXCHANNELS];
78 int do_audio = get_playback_engine()->get_output_levels(output_levels,
82 vwindow->gui->lock_window("VTracking::update_meters");
83 vwindow->gui->meters->update(output_levels);
84 vwindow->gui->unlock_window();
88 void VTracking::stop_meters()
90 vwindow->gui->lock_window("VTracking::stop_meters");
91 vwindow->gui->meters->stop_meters();
92 vwindow->gui->unlock_window();
95 void VTracking::draw()