本文整理汇总了C++中TrackId类的典型用法代码示例。如果您正苦于以下问题:C++ TrackId类的具体用法?C++ TrackId怎么用?C++ TrackId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TrackId类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: isDisabledOrLoadStoredSuccess
bool AnalyzerWaveform::isDisabledOrLoadStoredSuccess(TrackPointer tio) const {
ConstWaveformPointer pTrackWaveform = tio->getWaveform();
ConstWaveformPointer pTrackWaveformSummary = tio->getWaveformSummary();
ConstWaveformPointer pLoadedTrackWaveform;
ConstWaveformPointer pLoadedTrackWaveformSummary;
TrackId trackId = tio->getId();
bool missingWaveform = pTrackWaveform.isNull();
bool missingWavesummary = pTrackWaveformSummary.isNull();
if (trackId.isValid() && (missingWaveform || missingWavesummary)) {
QList<AnalysisDao::AnalysisInfo> analyses =
m_pAnalysisDao->getAnalysesForTrack(trackId);
QListIterator<AnalysisDao::AnalysisInfo> it(analyses);
while (it.hasNext()) {
const AnalysisDao::AnalysisInfo& analysis = it.next();
WaveformFactory::VersionClass vc;
if (analysis.type == AnalysisDao::TYPE_WAVEFORM) {
vc = WaveformFactory::waveformVersionToVersionClass(analysis.version);
if (missingWaveform && vc == WaveformFactory::VC_USE) {
pLoadedTrackWaveform = ConstWaveformPointer(
WaveformFactory::loadWaveformFromAnalysis(analysis));
missingWaveform = false;
} else if (vc != WaveformFactory::VC_KEEP) {
// remove all other Analysis except that one we should keep
m_pAnalysisDao->deleteAnalysis(analysis.analysisId);
}
} if (analysis.type == AnalysisDao::TYPE_WAVESUMMARY) {
vc = WaveformFactory::waveformSummaryVersionToVersionClass(analysis.version);
if (missingWavesummary && vc == WaveformFactory::VC_USE) {
pLoadedTrackWaveformSummary = ConstWaveformPointer(
WaveformFactory::loadWaveformFromAnalysis(analysis));
missingWavesummary = false;
} else if (vc != WaveformFactory::VC_KEEP) {
// remove all other Analysis except that one we should keep
m_pAnalysisDao->deleteAnalysis(analysis.analysisId);
}
}
}
}
// If we don't need to calculate the waveform/wavesummary, skip.
if (!missingWaveform && !missingWavesummary) {
kLogger.debug() << "loadStored - Stored waveform loaded";
if (pLoadedTrackWaveform) {
tio->setWaveform(pLoadedTrackWaveform);
}
if (pLoadedTrackWaveformSummary) {
tio->setWaveformSummary(pLoadedTrackWaveformSummary);
}
return true;
}
return false;
}
开发者ID:DJMaxergy,项目名称:mixxx,代码行数:56,代码来源:analyzerwaveform.cpp
示例2: TEST_F
TEST_F(AutoDJProcessorTest, EnabledSuccess_PlayingDeck2_TrackLoadFailed) {
TrackId testId = addTrackToCollection(kTrackLocationTest);
ASSERT_TRUE(testId.isValid());
// Pretend a track is playing on deck 2.
TrackPointer pTrack(newTestTrack(nextTrackId(testId)));
// Load track and mark it playing.
deck2.slotLoadTrack(pTrack, true);
// Indicate the track loaded successfully.
deck2.fakeTrackLoadedEvent(pTrack);
// Arbitrary to check that it was unchanged.
master.crossfader.set(0.2447);
PlaylistTableModel* pAutoDJTableModel = pProcessor->getTableModel();
// The first track will fail to load and the second will succeed.
pAutoDJTableModel->appendTrack(testId);
pAutoDJTableModel->appendTrack(testId);
EXPECT_CALL(*pProcessor, emitAutoDJStateChanged(AutoDJProcessor::ADJ_IDLE));
EXPECT_CALL(*pProcessor, emitLoadTrackToPlayer(_, QString("[Channel1]"), false));
AutoDJProcessor::AutoDJError err = pProcessor->toggleAutoDJ(true);
EXPECT_EQ(AutoDJProcessor::ADJ_OK, err);
EXPECT_EQ(AutoDJProcessor::ADJ_IDLE, pProcessor->getState());
// No change to the crossfader or play states.
EXPECT_DOUBLE_EQ(1, master.crossfader.get());
EXPECT_DOUBLE_EQ(0.0, deck1.play.get());
EXPECT_DOUBLE_EQ(1.0, deck2.play.get());
// After the load failed signal we will receive another track load signal
// for deck 1.
EXPECT_CALL(*pProcessor, emitLoadTrackToPlayer(_, QString("[Channel1]"), false));
// Pretend the track load fails.
deck1.slotLoadTrack(pTrack, false);
deck1.fakeTrackLoadFailedEvent(pTrack);
// No change to the mode, crossfader, or play states.
EXPECT_EQ(AutoDJProcessor::ADJ_IDLE, pProcessor->getState());
EXPECT_DOUBLE_EQ(1, master.crossfader.get());
EXPECT_DOUBLE_EQ(0.0, deck1.play.get());
EXPECT_DOUBLE_EQ(1.0, deck2.play.get());
// Pretend the track load succeeds.
deck1.slotLoadTrack(pTrack, false);
deck1.fakeTrackLoadedEvent(pTrack);
// No change to the mode, crossfader, or play states.
EXPECT_EQ(AutoDJProcessor::ADJ_IDLE, pProcessor->getState());
EXPECT_DOUBLE_EQ(1.0, master.crossfader.get());
EXPECT_DOUBLE_EQ(0.0, deck1.play.get());
EXPECT_DOUBLE_EQ(1.0, deck2.play.get());
}
开发者ID:aalex,项目名称:mixxx,代码行数:55,代码来源:autodjprocessor_test.cpp
示例3: query
QList<AnalysisDao::AnalysisInfo> AnalysisDao::getAnalysesForTrack(TrackId trackId) {
if (!m_db.isOpen() || !trackId.isValid()) {
return QList<AnalysisInfo>();
}
QSqlQuery query(m_db);
query.prepare(QString(
"SELECT id, type, description, version, data_checksum FROM %1 "
"WHERE track_id=:trackId").arg(s_analysisTableName));
query.bindValue(":trackId", trackId.toVariant());
return loadAnalysesFromQuery(trackId, &query);
}
开发者ID:Alppasa,项目名称:mixxx,代码行数:13,代码来源:analysisdao.cpp
示例4: initTrackId
TrackRef GlobalTrackCache::initTrackId(
const TrackPointer& strongPtr,
TrackRef trackRef,
TrackId trackId) {
DEBUG_ASSERT(strongPtr);
DEBUG_ASSERT(!trackRef.getId().isValid());
DEBUG_ASSERT(trackId.isValid());
TrackRef trackRefWithId(trackRef, trackId);
EvictAndSaveFunctor* pDel = std::get_deleter<EvictAndSaveFunctor>(strongPtr);
DEBUG_ASSERT(pDel);
// Insert item by id
DEBUG_ASSERT(m_tracksById.find(trackId) == m_tracksById.end());
m_tracksById.insert(std::make_pair(
trackId,
pDel->getCacheEntryPointer()));
strongPtr->initId(trackId);
DEBUG_ASSERT(createTrackRef(*strongPtr) == trackRefWithId);
DEBUG_ASSERT(m_tracksById.find(trackId) != m_tracksById.end());
return trackRefWithId;
}
开发者ID:midzer,项目名称:mixxx,代码行数:25,代码来源:globaltrackcache.cpp
示例5: deleteAnalysesForTrack
bool AnalysisDao::deleteAnalysesForTrack(TrackId trackId) {
if (!trackId.isValid()) {
return false;
}
QSqlQuery query(m_db);
query.prepare(QString(
"SELECT id FROM %1 where track_id = :track_id").arg(s_analysisTableName));
query.bindValue(":track_id", trackId.toVariant());
if (!query.exec()) {
LOG_FAILED_QUERY(query) << "couldn't delete analyses for track" << trackId;
return false;
}
QList<int> analysesToDelete;
const int idColumn = query.record().indexOf("id");
while (query.next()) {
analysesToDelete.append(
query.value(idColumn).toInt());
}
foreach (int analysisId, analysesToDelete) {
deleteAnalysis(analysisId);
}
开发者ID:Alppasa,项目名称:mixxx,代码行数:23,代码来源:analysisdao.cpp
示例6: DEBUG_ASSERT
void GlobalTrackCacheResolver::initTrackIdAndUnlockCache(TrackId trackId) {
DEBUG_ASSERT(m_pInstance);
DEBUG_ASSERT(GlobalTrackCacheLookupResult::NONE != m_lookupResult);
DEBUG_ASSERT(m_strongPtr);
DEBUG_ASSERT(trackId.isValid());
if (m_trackRef.getId().isValid()) {
// Ignore initializing the same id twice
DEBUG_ASSERT(m_trackRef.getId() == trackId);
} else {
m_trackRef = m_pInstance->initTrackId(
m_strongPtr,
m_trackRef,
trackId);
DEBUG_ASSERT(m_trackRef.getId() == trackId);
}
unlockCache();
DEBUG_ASSERT(m_trackRef == createTrackRef(*m_strongPtr));
}
开发者ID:midzer,项目名称:mixxx,代码行数:18,代码来源:globaltrackcache.cpp
示例7: resolve
void GlobalTrackCache::resolve(
GlobalTrackCacheResolver* /*in/out*/ pCacheResolver,
QFileInfo /*in*/ fileInfo,
TrackId trackId,
SecurityTokenPointer pSecurityToken) {
DEBUG_ASSERT(pCacheResolver);
// Primary lookup by id (if available)
if (trackId.isValid()) {
if (debugLogEnabled()) {
kLogger.debug()
<< "Resolving track by id"
<< trackId;
}
auto strongPtr = lookupById(trackId);
if (strongPtr) {
if (debugLogEnabled()) {
kLogger.debug()
<< "Cache hit - found track by id"
<< trackId
<< strongPtr.get();
}
TrackRef trackRef = createTrackRef(*strongPtr);
pCacheResolver->initLookupResult(
GlobalTrackCacheLookupResult::HIT,
std::move(strongPtr),
std::move(trackRef));
return;
}
}
// Secondary lookup by canonical location
// The TrackRef is constructed now after the lookup by ID failed to
// avoid calculating the canonical file path if it is not needed.
TrackRef trackRef = TrackRef::fromFileInfo(fileInfo, trackId);
if (trackRef.hasCanonicalLocation()) {
if (debugLogEnabled()) {
kLogger.debug()
<< "Resolving track by canonical location"
<< trackRef.getCanonicalLocation();
}
auto strongPtr = lookupByRef(trackRef);
if (strongPtr) {
// Cache hit
if (debugLogEnabled()) {
kLogger.debug()
<< "Cache hit - found track by canonical location"
<< trackRef.getCanonicalLocation()
<< strongPtr.get();
}
pCacheResolver->initLookupResult(
GlobalTrackCacheLookupResult::HIT,
std::move(strongPtr),
std::move(trackRef));
return;
}
}
if (!m_pSaver) {
// Do not allocate any new tracks once the cache
// has been deactivated
DEBUG_ASSERT(isEmpty());
kLogger.warning()
<< "Cache miss - caching has already been deactivated"
<< trackRef;
return;
}
if (debugLogEnabled()) {
kLogger.debug()
<< "Cache miss - allocating track"
<< trackRef;
}
auto deletingPtr = std::unique_ptr<Track, void (&)(Track*)>(
new Track(
std::move(fileInfo),
std::move(pSecurityToken),
std::move(trackId)),
deleteTrack);
// Track objects live together with the cache on the main thread
// and will be deleted later within the event loop. But this
// function might be called from any thread, even from worker
// threads without an event loop. We need to move the newly
// created object to the target thread.
deletingPtr->moveToThread(QApplication::instance()->thread());
auto cacheEntryPtr = std::make_shared<GlobalTrackCacheEntry>(
std::move(deletingPtr));
auto savingPtr = TrackPointer(
cacheEntryPtr->getPlainPtr(),
EvictAndSaveFunctor(cacheEntryPtr));
cacheEntryPtr->setSavingWeakPtr(savingPtr);
if (debugLogEnabled()) {
kLogger.debug()
<< "Cache miss - inserting new track into cache"
<< trackRef
<< deletingPtr.get();
}
if (trackRef.hasId()) {
// Insert item by id
DEBUG_ASSERT(m_tracksById.find(
trackRef.getId()) == m_tracksById.end());
//.........这里部分代码省略.........
开发者ID:midzer,项目名称:mixxx,代码行数:101,代码来源:globaltrackcache.cpp
示例8: nextTrackId
static TrackId nextTrackId(TrackId trackId) {
return TrackId(trackId.toInt() + 1);
}
开发者ID:aalex,项目名称:mixxx,代码行数:3,代码来源:autodjprocessor_test.cpp
注:本文中的TrackId类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论