rework android-rmt display, add a few buttons
[goodguy/history.git] / cinelerra-5.0 / cinelerra / vtracking.C
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  * 
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.
10  * 
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.
15  * 
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
19  * 
20  */
21
22 #include "edl.h"
23 #include "edlsession.h"
24 #include "localsession.h"
25 #include "mainclock.h"
26 #include "meterpanel.h"
27 #include "mwindow.h"
28 #include "vplayback.h"
29 #include "vtimebar.h"
30 #include "vtracking.h"
31 #include "vwindow.h"
32 #include "vwindowgui.h"
33
34
35 VTracking::VTracking(MWindow *mwindow, VWindow *vwindow)
36  : Tracking(mwindow)
37 {
38         this->vwindow = vwindow;
39 }
40
41 VTracking::~VTracking()
42 {
43 }
44
45 PlaybackEngine* VTracking::get_playback_engine()
46 {
47         return vwindow->playback_engine;
48 }
49
50 void VTracking::update_tracker(double position)
51 {
52         vwindow->gui->lock_window("VTracking::update_tracker");
53         vwindow->get_edl()->local_session->set_selectionstart(position);
54         vwindow->get_edl()->local_session->set_selectionend(position);
55
56         vwindow->gui->clock->update(position);
57
58 // This is going to boost the latency but we need to update the timebar
59         vwindow->gui->timebar->update(1);
60
61         vwindow->gui->unlock_window();
62
63         update_meters((int64_t)(position * mwindow->edl->session->sample_rate));
64 }
65
66 void VTracking::update_meters(int64_t position)
67 {
68         double output_levels[MAXCHANNELS];
69
70         int do_audio = get_playback_engine()->get_output_levels(output_levels, 
71                 position);
72         if(do_audio)
73         {
74                 vwindow->gui->lock_window("VTracking::update_meters");
75                 vwindow->gui->meters->update(output_levels);
76                 vwindow->gui->unlock_window();
77         }
78 }
79
80 void VTracking::stop_meters()
81 {
82         vwindow->gui->lock_window("VTracking::stop_meters");
83         vwindow->gui->meters->stop_meters();
84         vwindow->gui->unlock_window();
85 }
86
87 void VTracking::draw()
88 {
89 }