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
23 #include "edlsession.h"
24 #include "localsession.h"
25 #include "mainclock.h"
26 #include "meterpanel.h"
28 #include "vplayback.h"
30 #include "vtracking.h"
32 #include "vwindowgui.h"
35 VTracking::VTracking(MWindow *mwindow, VWindow *vwindow)
38 this->vwindow = vwindow;
41 VTracking::~VTracking()
45 PlaybackEngine* VTracking::get_playback_engine()
47 return vwindow->playback_engine;
50 void VTracking::update_tracker(double position)
52 //printf("VTracking::update_tracker %ld\n", position);
53 vwindow->gui->lock_window("VTracking::update_tracker");
54 vwindow->get_edl()->local_session->set_selectionstart(position);
55 vwindow->get_edl()->local_session->set_selectionend(position);
57 vwindow->gui->clock->update(position);
59 // This is going to boost the latency but we need to update the timebar
60 vwindow->gui->timebar->update(1);
62 vwindow->gui->unlock_window();
64 update_meters((int64_t)(position * mwindow->edl->session->sample_rate));
67 void VTracking::update_meters(int64_t position)
69 double output_levels[MAXCHANNELS];
71 int do_audio = get_playback_engine()->get_output_levels(output_levels,
75 vwindow->gui->lock_window("VTracking::update_meters");
76 vwindow->gui->meters->update(output_levels);
77 vwindow->gui->unlock_window();
81 void VTracking::stop_meters()
83 vwindow->gui->lock_window("VTracking::stop_meters");
84 vwindow->gui->meters->stop_meters();
85 vwindow->gui->unlock_window();
88 void VTracking::draw()