transportdialog.cpp
来自「LINUX下的混音软件」· C++ 代码 · 共 1,086 行 · 第 1/3 页
CPP
1,086 行
TransportDialog::getSMPTEResolution(int &framesPerSecond, int &bitsPerFrame){ framesPerSecond = m_framesPerSecond; bitsPerFrame = m_bitsPerFrame;}voidTransportDialog::slotChangeTimeDisplay(){ if (m_sampleRate == 0) { QCString replyType; QByteArray replyData; m_sampleRate = 0; if (rgapp->sequencerCall("getSampleRate()", replyType, replyData)) { QDataStream streamIn(replyData, IO_ReadOnly); unsigned int result; streamIn >> result; m_sampleRate = result; } else { m_sampleRate = -1; } } switch (m_currentMode) { case RealMode: if (m_sampleRate > 0) m_currentMode = FrameMode; else m_currentMode = BarMode; break; case FrameMode: m_currentMode = BarMode; break; case SMPTEMode: m_currentMode = BarMode; break; case BarMode: m_currentMode = BarMetronomeMode; break; case BarMetronomeMode: m_currentMode = RealMode; break; } switch (m_currentMode) { case RealMode: m_clearMetronomeTimer->stop(); m_transport->TimeDisplayLabel->hide(); break; case SMPTEMode: m_clearMetronomeTimer->stop(); m_transport->TimeDisplayLabel->setText("SMPTE"); // DO NOT i18n m_transport->TimeDisplayLabel->show(); break; case BarMode: m_clearMetronomeTimer->stop(); m_transport->TimeDisplayLabel->setText("BAR"); // DO NOT i18n m_transport->TimeDisplayLabel->show(); break; case BarMetronomeMode: m_clearMetronomeTimer->start(1700, FALSE); m_transport->TimeDisplayLabel->setText("MET"); // DO NOT i18n m_transport->TimeDisplayLabel->show(); break; case FrameMode: m_clearMetronomeTimer->stop(); m_transport->TimeDisplayLabel->setText(QString("%1").arg(m_sampleRate)); m_transport->TimeDisplayLabel->show(); break; }}voidTransportDialog::slotChangeToEnd(){ if (m_transport->ToEndButton->isOn()) { m_transport->ToEndLabel->show(); } else { m_transport->ToEndLabel->hide(); }}boolTransportDialog::isShowingTimeToEnd(){ return m_transport->ToEndButton->isOn();}voidTransportDialog::displayRealTime(const RealTime &rt){ RealTime st = rt; slotResetBackground(); if (m_lastMode != RealMode) { m_transport->HourColonPixmap->show(); m_transport->MinuteColonPixmap->show(); m_transport->SecondColonPixmap->hide(); m_transport->HundredthColonPixmap->hide(); m_lastMode = RealMode; } // If time is negative then reverse the time and set the minus flag // if (st < RealTime::zeroTime) { st = RealTime::zeroTime - st; if (!m_lastNegative) { m_transport->NegativePixmap->setPixmap(m_lcdNegative); m_lastNegative = true; } } else // don't show the flag { if (m_lastNegative) { m_transport->NegativePixmap->clear(); m_lastNegative = false; } } m_tenThousandths = ( st.usec() / 100 ) % 10; m_thousandths = ( st.usec() / 1000 ) % 10; m_hundreths = ( st.usec() / 10000 ) % 10; m_tenths = ( st.usec() / 100000 ) % 10; m_unitSeconds = ( st.sec ) % 10; m_tenSeconds = ( st.sec / 10 ) % 6; m_unitMinutes = ( st.sec / 60 ) % 10; m_tenMinutes = ( st.sec / 600 ) % 6; m_unitHours = ( st.sec / 3600 ) % 10; m_tenHours = (st.sec / 36000 ) % 10; updateTimeDisplay();}voidTransportDialog::displayFrameTime(const RealTime &rt){ RealTime st = rt; slotResetBackground(); if (m_lastMode != FrameMode) { m_transport->HourColonPixmap->hide(); m_transport->MinuteColonPixmap->hide(); m_transport->SecondColonPixmap->hide(); m_transport->HundredthColonPixmap->hide(); m_lastMode = FrameMode; } // If time is negative then reverse the time and set the minus flag // if (st < RealTime::zeroTime) { st = RealTime::zeroTime - st; if (!m_lastNegative) { m_transport->NegativePixmap->setPixmap(m_lcdNegative); m_lastNegative = true; } } else // don't show the flag { if (m_lastNegative) { m_transport->NegativePixmap->clear(); m_lastNegative = false; } } long frame = RealTime::realTime2Frame(st, m_sampleRate); m_tenThousandths = frame % 10; frame /= 10; m_thousandths = frame % 10; frame /= 10; m_hundreths = frame % 10; frame /= 10; m_tenths = frame % 10; frame /= 10; m_unitSeconds = frame % 10; frame /= 10; m_tenSeconds = frame % 10; frame /= 10; m_unitMinutes = frame % 10; frame /= 10; m_tenMinutes = frame % 10; frame /= 10; m_unitHours = frame % 10; frame /= 10; m_tenHours = frame % 10; frame /= 10; updateTimeDisplay();}voidTransportDialog::displaySMPTETime(const RealTime &rt){ RealTime st = rt; slotResetBackground(); if (m_lastMode != SMPTEMode) { m_transport->HourColonPixmap->show(); m_transport->MinuteColonPixmap->show(); m_transport->SecondColonPixmap->show(); m_transport->HundredthColonPixmap->show(); m_lastMode = SMPTEMode; } // If time is negative then reverse the time and set the minus flag // if (st < RealTime::zeroTime) { st = RealTime::zeroTime - st; if (!m_lastNegative) { m_transport->NegativePixmap->setPixmap(m_lcdNegative); m_lastNegative = true; } } else // don't show the flag { if (m_lastNegative) { m_transport->NegativePixmap->clear(); m_lastNegative = false; } } m_tenThousandths = (( st.usec() * m_framesPerSecond * m_bitsPerFrame) / 1000000 ) % 10; m_thousandths = (( st.usec() * m_framesPerSecond * m_bitsPerFrame) / 10000000 ) % (m_bitsPerFrame / 10); m_hundreths = (( st.usec() * m_framesPerSecond) / 1000000 ) % 10; m_tenths = (( st.usec() * m_framesPerSecond) / 10000000 ) % 10; m_unitSeconds = ( st.sec ) % 10; m_tenSeconds = ( st.sec / 10 ) % 6; m_unitMinutes = ( st.sec / 60 ) % 10; m_tenMinutes = ( st.sec / 600 ) % 6; m_unitHours = ( st.sec / 3600 ) % 10; m_tenHours = ( st.sec / 36000 ) % 10; updateTimeDisplay();}voidTransportDialog::displayBarTime(int bar, int beat, int unit){ if (m_lastMode != BarMode) { m_transport->HourColonPixmap->hide(); m_transport->MinuteColonPixmap->show(); m_transport->SecondColonPixmap->hide(); m_transport->HundredthColonPixmap->hide(); m_lastMode = BarMode; } // If time is negative then reverse the time and set the minus flag // if (bar < 0) { bar = -bar; if (!m_lastNegative) { m_transport->NegativePixmap->setPixmap(m_lcdNegative); m_lastNegative = true; } } else // don't show the flag { if (m_lastNegative) { m_transport->NegativePixmap->clear(); m_lastNegative = false; } } if (m_currentMode == BarMetronomeMode && unit < 2) { if (beat == 1) { slotSetBackground(Qt::red); } else { slotSetBackground(Qt::cyan); } } else { slotResetBackground(); } m_tenThousandths = ( unit ) % 10; m_thousandths = ( unit / 10 ) % 10; m_hundreths = ( unit / 100 ) % 10; m_tenths = ( unit / 1000 ) % 10; if (m_tenths == 0) { m_tenths = -1; if (m_hundreths == 0) { m_hundreths = -1; if (m_thousandths == 0) { m_thousandths = -1; } } } m_unitSeconds = ( beat ) % 10; m_tenSeconds = ( beat / 10 ) % 6; if (m_tenSeconds == 0) { m_tenSeconds = -1; } m_unitMinutes = ( bar ) % 10; m_tenMinutes = ( bar / 10 ) % 10; m_unitHours = ( bar / 100 ) % 10; m_tenHours = ( bar / 1000 ) % 10; if (m_tenHours == 0) { m_tenHours = -1; if (m_unitHours == 0) { m_unitHours = -1; if (m_tenMinutes == 0) { m_tenMinutes = -1; } } } updateTimeDisplay();}voidTransportDialog::updateTimeDisplay(){ if (m_tenThousandths != m_lastTenThousandths) { if (m_tenThousandths < 0) m_transport->TenThousandthsPixmap->clear(); else m_transport->TenThousandthsPixmap->setPixmap(m_lcdList[m_tenThousandths]); m_lastTenThousandths = m_tenThousandths; } if (m_thousandths != m_lastThousandths) { if (m_thousandths < 0) m_transport->ThousandthsPixmap->clear(); else m_transport->ThousandthsPixmap->setPixmap(m_lcdList[m_thousandths]); m_lastThousandths = m_thousandths; } if (m_hundreths != m_lastHundreths) { if (m_hundreths < 0) m_transport->HundredthsPixmap->clear(); else m_transport->HundredthsPixmap->setPixmap(m_lcdList[m_hundreths]); m_lastHundreths = m_hundreths;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?