comparison sv/main/MainWindow.cpp @ 129:587ad94d6ac2

(none)
author ivand_qmul
date Thu, 08 Nov 2007 13:29:48 +0000
parents 541b3e357979
children b3df8b8185db
comparison
equal deleted inserted replaced
128:247ea6460ec2 129:587ad94d6ac2
112 using std::endl; 112 using std::endl;
113 113
114 using std::vector; 114 using std::vector;
115 using std::map; 115 using std::map;
116 using std::set; 116 using std::set;
117
118 extern float hopfactor;
119 extern long long countFreq;
117 120
118 MainWindow * MainWindow::m_instance = 0; 121 MainWindow * MainWindow::m_instance = 0;
119 122
120 MainWindow * MainWindow::instance() 123 MainWindow * MainWindow::instance()
121 { 124 {
2296 } else { 2299 } else {
2297 QMessageBox::critical(this, tr("Failed to write file"), error); 2300 QMessageBox::critical(this, tr("Failed to write file"), error);
2298 } 2301 }
2299 } 2302 }
2300 2303
2301 void
2302 // Ivan Damnjanovic 09-10/2007 added video file import 2304 // Ivan Damnjanovic 09-10/2007 added video file import
2305 void
2303 MainWindow::importVideo() 2306 MainWindow::importVideo()
2304 { 2307 {
2305 QString path = getOpenFileName(FileFinder::VideoFile); 2308 QString path = getOpenFileName(FileFinder::VideoFile);
2306 2309
2307 if (path != "") { 2310 if (path != "") {
3529 stop(); 3532 stop();
3530 } else { 3533 } else {
3531 playbackFrameChanged(m_viewManager->getPlaybackFrame()); 3534 playbackFrameChanged(m_viewManager->getPlaybackFrame());
3532 m_playSource->play(m_viewManager->getPlaybackFrame()); 3535 m_playSource->play(m_viewManager->getPlaybackFrame());
3533 } 3536 }
3537 m_playSource->hardwareBufferedTime=0;
3538 m_playSource->lastAudioTime=0;
3534 } 3539 }
3535 // Ivan Damnjanovic 16/10/2007 functions to access data needed for video player 3540 // Ivan Damnjanovic 16/10/2007 functions to access data needed for video player
3536 unsigned long 3541 unsigned long
3537 MainWindow::Get_CurAudioTime() 3542 MainWindow::Get_CurAudioTime()
3538 { 3543 {
3539 return (m_viewManager->getPlaybackFrame()/(getMainModel()->getSampleRate()/1000)); 3544 unsigned long pos;
3545 unsigned long newAudioTime=m_viewManager->getPlaybackFrame()/(getMainModel()->getSampleRate()/1000);
3546 if(!(m_playSource->lastAudioTime==newAudioTime))
3547 {
3548 m_playSource->lastAudioTime=newAudioTime;
3549 long long cntClick;
3550 QueryPerformanceCounter((LARGE_INTEGER *)(&cntClick));
3551 m_playSource->hardwareBufferedTime=cntClick;
3552 pos=0;
3553 }
3554 else
3555 {
3556 long long timeTemp;
3557 QueryPerformanceCounter((LARGE_INTEGER *)(&timeTemp));
3558
3559 pos=(timeTemp-m_playSource->hardwareBufferedTime)/(countFreq);
3560 pos*=hopfactor;
3561 }
3562 return (newAudioTime+pos);
3563 }
3564 unsigned long long
3565 MainWindow::Get_HardwareBufferTime()
3566 {
3567 return (m_playSource->hardwareBufferedTime);
3540 } 3568 }
3541 bool MainWindow::isAudioPlaying() 3569 bool MainWindow::isAudioPlaying()
3542 { 3570 {
3543 return (m_playSource->isPlaying()); 3571 return (m_playSource->isPlaying());
3544 } 3572 }