本文整理汇总了C++中TrackPointer::getSampleRate方法的典型用法代码示例。如果您正苦于以下问题:C++ TrackPointer::getSampleRate方法的具体用法?C++ TrackPointer::getSampleRate怎么用?C++ TrackPointer::getSampleRate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TrackPointer
的用法示例。
在下文中一共展示了TrackPointer::getSampleRate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createTestTrack
TEST_F(CueControlTest, LoadAutodetectedCues_QuantizeEnabled) {
m_pQuantizeEnabled->set(1);
TrackPointer pTrack = createTestTrack();
pTrack->setSampleRate(44100);
pTrack->setBpm(120.0);
const int frameSize = 2;
const int sampleRate = pTrack->getSampleRate();
const double bpm = pTrack->getBpm();
const double beatLength = (60.0 * sampleRate / bpm) * frameSize;
pTrack->setCuePoint(CuePosition(1.9 * beatLength, Cue::AUTOMATIC));
auto pIntro = pTrack->createAndAddCue();
pIntro->setType(Cue::INTRO);
pIntro->setSource(Cue::AUTOMATIC);
pIntro->setPosition(2.1 * beatLength);
pIntro->setLength(1.2 * beatLength);
auto pOutro = pTrack->createAndAddCue();
pOutro->setType(Cue::OUTRO);
pOutro->setSource(Cue::AUTOMATIC);
pOutro->setPosition(11.1 * beatLength);
pOutro->setLength(4.4 * beatLength);
loadTrack(pTrack);
EXPECT_DOUBLE_EQ(2.0 * beatLength, m_pCuePoint->get());
EXPECT_DOUBLE_EQ(2.0 * beatLength, m_pIntroStartPosition->get());
EXPECT_DOUBLE_EQ(4.0 * beatLength, m_pIntroEndPosition->get());
EXPECT_DOUBLE_EQ(11.0 * beatLength, m_pOutroStartPosition->get());
EXPECT_DOUBLE_EQ(16.0 * beatLength, m_pOutroEndPosition->get());
}
示例2: initialize
void BeatMap::initialize(TrackPointer pTrack, int iSampleRate) {
m_iSampleRate = iSampleRate > 0 ? iSampleRate : pTrack->getSampleRate();
m_dCachedBpm = 0;
m_dLastFrame = 0;
if (!pTrack.isNull()) {
// BeatMap should live in the same thread as the track it is associated
// with.
moveToThread(pTrack->thread());
}
}
示例3: initialize
void BeatMap::initialize(TrackPointer pTrack, int iSampleRate) {
m_iSampleRate = iSampleRate > 0 ? iSampleRate : pTrack->getSampleRate();
m_dCachedBpm = 0;
m_dLastFrame = 0;
}
示例4: populateCues
void DlgTrackInfo::populateCues(TrackPointer pTrack) {
int sampleRate = pTrack->getSampleRate();
QList<Cue*> listPoints;
const QList<Cue*>& cuePoints = pTrack->getCuePoints();
QListIterator<Cue*> it(cuePoints);
while (it.hasNext()) {
Cue* pCue = it.next();
if (pCue->getType() == Cue::CUE || pCue->getType() == Cue::LOAD) {
listPoints.push_back(pCue);
}
}
it = QListIterator<Cue*>(listPoints);
cueTable->setSortingEnabled(false);
int row = 0;
while (it.hasNext()) {
Cue* pCue = it.next();
QString rowStr = QString("%1").arg(row);
// All hotcues are stored in Cue's as 0-indexed, but the GUI presents
// them to the user as 1-indexex. Add 1 here. rryan 9/2010
int iHotcue = pCue->getHotCue() + 1;
QString hotcue = "";
if (iHotcue != -1) {
hotcue = QString("%1").arg(iHotcue);
}
int position = pCue->getPosition();
double totalSeconds;
if (position == -1)
continue;
else {
totalSeconds = float(position) / float(sampleRate) / 2.0;
}
int fraction = 100*(totalSeconds - floor(totalSeconds));
int seconds = int(totalSeconds) % 60;
int mins = int(totalSeconds) / 60;
//int hours = mins / 60; //Not going to worry about this for now. :)
//Construct a nicely formatted duration string now.
QString duration = QString("%1:%2.%3").arg(
QString::number(mins),
QString("%1").arg(seconds, 2, 10, QChar('0')),
QString("%1").arg(fraction, 2, 10, QChar('0')));
QTableWidgetItem* durationItem = new QTableWidgetItem(duration);
// Make the duration read only
durationItem->setFlags(Qt::NoItemFlags);
m_cueMap[row] = pCue;
cueTable->insertRow(row);
cueTable->setItem(row, 0, new QTableWidgetItem(rowStr));
cueTable->setItem(row, 1, durationItem);
cueTable->setItem(row, 2, new QTableWidgetItem(hotcue));
cueTable->setItem(row, 3, new QTableWidgetItem(pCue->getLabel()));
row += 1;
}
cueTable->setSortingEnabled(true);
}