diff main/MainWindow.cpp @ 384:be237d380f5f macness

importITunesAudio() now sets the SV playback position too
author Dan Stowell <dan.stowell@eecs.qmul.ac.uk>
date Mon, 18 Oct 2010 15:23:21 +0100
parents abb9c3dedec2
children
line wrap: on
line diff
--- a/main/MainWindow.cpp	Mon Oct 18 14:44:28 2010 +0100
+++ b/main/MainWindow.cpp	Mon Oct 18 15:23:21 2010 +0100
@@ -2163,6 +2163,7 @@
 void
 MainWindow::importITunesAudio()
 {
+    m_iTunes->resetPlayerState();
     QStringList nowPlaying = m_iTunes->getNowPlaying();
     QString path = nowPlaying.at(0);
     QString genre = (nowPlaying.size() > 1) ? nowPlaying.at(1) : "";
@@ -2175,6 +2176,10 @@
                   tr("<b>File open failed</b><p>Audio file \"%1\" could not be opened").arg(path));
     }else{
         m_iTunes->updatePlayerState();
+        RealTime playerPos = RealTime::fromSeconds(m_iTunes->playerPos());
+        unsigned long positionFrames = RealTime::realTime2Frame(playerPos, getMainModel()->getSampleRate());
+        m_viewManager->setGlobalCentreFrame(positionFrames);
+        m_viewManager->setPlaybackFrame(positionFrames);
     }
     }
 }