Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Merge remote-tracking branch 'origin/master' into numpad_for_palette_shortcut

shun_iwasawa70b01d15170a
diff --cc toonz/sources/toonz/viewerpane.cpp
index ef676e7f9,deae824e7..6fc4ef75f
--- a/toonz/sources/toonz/viewerpane.cpp
+++ b/toonz/sources/toonz/viewerpane.cpp
@@@ -635,16 -658,49 +654,63 @@@ void SceneViewerPanel::onFrameTypeChang
updateFrameMarkers();
}
+//-----------------------------------------------------------------------------
+
+void SceneViewerPanel::onPreferenceChanged(const QString &prefName) {
+ // if no name specified (on StyleShortcutSelectivePanel::showEvent),
+ // then process all updates
+ if (prefName == "BlankCount" || prefName == "BlankColor" ||
+ prefName.isEmpty())
+ m_flipConsole->onPreferenceChanged();
+
+ StyleShortcutSwitchablePanel::onPreferenceChanged(prefName);
+}
+
+//-----------------------------------------------------------------------------
++
+ void SceneViewerPanel::playAudioFrame(int frame) {
+ if (m_first) {
+ m_first = false;
+ m_fps = TApp::instance()
+ ->getCurrentScene()
+ ->getScene()
+ ->getProperties()
+ ->getOutputProperties()
+ ->getFrameRate();
+ m_samplesPerFrame = m_sound->getSampleRate() / abs(m_fps);
+ }
+ if (!m_sound) return;
+ m_viewerFps = m_flipConsole->getCurrentFps();
+ double s0 = frame * m_samplesPerFrame, s1 = s0 + m_samplesPerFrame;
+
+ // make the sound stop if the viewerfps is higher so the next sound can play
+ // on time.
+ if (m_fps < m_viewerFps)
+ TApp::instance()->getCurrentXsheet()->getXsheet()->stopScrub();
+ TApp::instance()->getCurrentXsheet()->getXsheet()->play(m_sound, s0, s1,
+ false);
+ }
+
+ bool SceneViewerPanel::hasSoundtrack() {
+ if (m_sound != NULL) {
+ m_sound = NULL;
+ m_hasSoundtrack = false;
+ m_first = true;
+ }
+ TXsheetHandle *xsheetHandle = TApp::instance()->getCurrentXsheet();
+ TXsheet::SoundProperties *prop = new TXsheet::SoundProperties();
+ m_sound = xsheetHandle->getXsheet()->makeSound(prop);
+ if (m_sound == NULL) {
+ m_hasSoundtrack = false;
+ return false;
+ } else {
+ m_hasSoundtrack = true;
+ return true;
+ }
+ }
+
+ void SceneViewerPanel::onButtonPressed(FlipConsole::EGadget button) {
+ if (button == FlipConsole::eSound) {
+ m_playSound = !m_playSound;
+ }
-}
++}