r956: README.BUILD - add more library recommendations
[cinelerra_cv/ct.git] / cinelerra / vtracking.C
blob22bcad0c2d422530bab1871950dd47eb32d55f21
1 #include "asset.h"
2 #include "assets.h"
3 #include "edl.h"
4 #include "edlsession.h"
5 #include "localsession.h"
6 #include "mainclock.h"
7 #include "meterpanel.h"
8 #include "mwindow.h"
9 #include "renderengine.h"
10 #include "mainclock.h"
11 #include "vplayback.h"
12 #include "vrender.h"
13 #include "vtimebar.h"
14 #include "vtracking.h"
15 #include "vwindow.h"
16 #include "vwindowgui.h"
19 VTracking::VTracking(MWindow *mwindow, VWindow *vwindow)
20  : Tracking(mwindow)
22         this->vwindow = vwindow;
25 VTracking::~VTracking()
29 PlaybackEngine* VTracking::get_playback_engine()
31         return vwindow->playback_engine;
34 void VTracking::update_tracker(double position)
36         Asset *asset = vwindow->get_edl()->assets->first;
37 //printf("VTracking::update_tracker %ld\n", position);
38         vwindow->gui->lock_window("VTracking::update_tracker");
39         vwindow->get_edl()->local_session->set_selectionstart(position);
40         vwindow->get_edl()->local_session->set_selectionend(position);
41         vwindow->gui->slider->update(position);
43         vwindow->gui->clock->update(position + 
44                 asset->tcstart / (asset->video_data ?
45                                                         asset->frame_rate :
46                                                         asset->sample_rate));
48 // This is going to boost the latency but we need to update the timebar
49         vwindow->gui->timebar->draw_range();
50         vwindow->gui->timebar->flash();
52         vwindow->gui->unlock_window();
54         update_meters((int64_t)(position * mwindow->edl->session->sample_rate));
57 void VTracking::update_meters(int64_t position)
59         double output_levels[MAXCHANNELS];
61         int do_audio = get_playback_engine()->get_output_levels(output_levels, 
62                 position);
63         if(do_audio)
64         {
65                 vwindow->gui->lock_window("VTracking::update_meters");
66                 vwindow->gui->meters->update(output_levels);
67                 vwindow->gui->unlock_window();
68         }
71 void VTracking::stop_meters()
73         vwindow->gui->lock_window("VTracking::stop_meters");
74         vwindow->gui->meters->stop_meters();
75         vwindow->gui->unlock_window();
78 void VTracking::draw()