本文整理汇总了C++中TrackPointer::getLocation方法的典型用法代码示例。如果您正苦于以下问题:C++ TrackPointer::getLocation方法的具体用法?C++ TrackPointer::getLocation怎么用?C++ TrackPointer::getLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TrackPointer
的用法示例。
在下文中一共展示了TrackPointer::getLocation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: openSecurityToken
//Other constructor
SoundSourceProxy::SoundSourceProxy(TrackPointer pTrack)
: m_pTrack(pTrack)
, m_pSecurityToken(
openSecurityToken(pTrack->getLocation(),
pTrack->getSecurityToken()))
, m_pSoundSource(initialize(pTrack->getLocation())) {
}
示例2: SoundSource
//Other constructor
SoundSourceProxy::SoundSourceProxy(TrackPointer pTrack)
: SoundSource(pTrack->getLocation()),
m_pSoundSource(NULL) {
m_pSoundSource = initialize(pTrack->getLocation());
m_pTrack = pTrack;
}
示例3: slotAddRandomTrack
void AutoDJFeature::slotAddRandomTrack(bool) {
int failedRetrieveAttempts = 0;
// Get access to the auto-DJ playlist
PlaylistDAO& playlistDao = m_pTrackCollection->getPlaylistDAO();
if (m_iAutoDJPlaylistId >= 0) {
while (failedRetrieveAttempts < kMaxRetrieveAttempts) {
// Get the ID of a randomly-selected track.
TrackId trackId(m_autoDjCratesDao.getRandomTrackId());
if (trackId.isValid()) {
// Get Track Information
TrackPointer addedTrack = (m_pTrackCollection->getTrackDAO()).getTrack(trackId);
if(addedTrack->exists()) {
playlistDao.appendTrackToPlaylist(trackId, m_iAutoDJPlaylistId);
m_pAutoDJView->onShow();
return;
} else {
qDebug() << "Track does not exist:"
<< addedTrack->getInfo()
<< addedTrack->getLocation();
}
}
failedRetrieveAttempts += 1;
}
// If we couldn't get a track from the crates , get one from the library
qDebug () << "Could not load tracks from crates, attempting to load from library.";
failedRetrieveAttempts = 0;
while ( failedRetrieveAttempts < kMaxRetrieveAttempts ) {
TrackId trackId(m_autoDjCratesDao.getRandomTrackIdFromLibrary(m_iAutoDJPlaylistId));
if (trackId.isValid()) {
TrackPointer addedTrack = m_pTrackCollection->getTrackDAO().getTrack(trackId);
if(addedTrack->exists()) {
if(!addedTrack->getPlayCounter().isPlayed()) {
playlistDao.appendTrackToPlaylist(trackId, m_iAutoDJPlaylistId);
m_pAutoDJView->onShow();
return;
}
} else {
qDebug() << "Track does not exist:"
<< addedTrack->getInfo()
<< addedTrack->getLocation();
}
}
failedRetrieveAttempts += 1;
}
}
// If control reaches here it implies that we couldn't load track
qDebug() << "Could not load random track.";
}
示例4: trackLoaded
void BaseExternalTrackModel::trackLoaded(QString group, TrackPointer pTrack) {
if (group == m_previewDeckGroup) {
// If there was a previously loaded track, refresh its rows so the
// preview state will update.
if (m_previewDeckTrackId.isValid()) {
const int numColumns = columnCount();
QLinkedList<int> rows = getTrackRows(m_previewDeckTrackId);
m_previewDeckTrackId = TrackId(); // invalidate
foreach (int row, rows) {
QModelIndex left = index(row, 0);
QModelIndex right = index(row, numColumns);
emit(dataChanged(left, right));
}
}
if (pTrack) {
// The external table has foreign Track IDs, so we need to compare
// by location
for (int row = 0; row < rowCount(); ++row) {
QString location = index(row, fieldIndex("location")).data().toString();
if (location == pTrack->getLocation()) {
m_previewDeckTrackId = TrackId(index(row, 0).data());
//qDebug() << "foreign track id" << m_previewDeckTrackId;
break;
}
}
}
}
示例5: guessCover
void CoverArtCache::guessCover(TrackPointer pTrack) {
if (pTrack) {
kLogger.debug() << "Guessing cover art for" << pTrack->getLocation();
CoverInfo cover = CoverArtUtils::guessCoverInfo(*pTrack);
pTrack->setCoverInfo(cover);
}
}
示例6: populateFields
void DlgTrackInfo::populateFields(TrackPointer pTrack) {
setWindowTitle(pTrack->getTitle());
// Editable fields
txtTrackName->setText(pTrack->getTitle());
txtArtist->setText(pTrack->getArtist());
txtAlbum->setText(pTrack->getAlbum());
txtAlbumArtist->setText(pTrack->getAlbumArtist());
txtGenre->setText(pTrack->getGenre());
txtComposer->setText(pTrack->getComposer());
txtGrouping->setText(pTrack->getGrouping());
txtYear->setText(pTrack->getYear());
txtTrackNumber->setText(pTrack->getTrackNumber());
txtComment->setText(pTrack->getComment());
spinBpm->setValue(pTrack->getBpm());
// Non-editable fields
txtDuration->setText(pTrack->getDurationStr());
txtFilepath->setText(pTrack->getFilename());
txtLocation->setText(pTrack->getLocation());
txtType->setText(pTrack->getType());
txtBitrate->setText(QString(pTrack->getBitrateStr()) + (" ") + tr("kbps"));
txtBpm->setText(pTrack->getBpmStr());
txtKey->setText(pTrack->getKeyText());
BeatsPointer pBeats = pTrack->getBeats();
bool beatsSupportsSet = !pBeats || (pBeats->getCapabilities() & Beats::BEATSCAP_SET);
bool enableBpmEditing = !pTrack->hasBpmLock() && beatsSupportsSet;
spinBpm->setEnabled(enableBpmEditing);
bpmTap->setEnabled(enableBpmEditing);
bpmDouble->setEnabled(enableBpmEditing);
bpmHalve->setEnabled(enableBpmEditing);
bpmTwoThirds->setEnabled(enableBpmEditing);
bpmThreeFourth->setEnabled(enableBpmEditing);
}
示例7: loadTrack
void CachingReaderWorker::loadTrack(const TrackPointer& pTrack) {
//qDebug() << m_group << "CachingReaderWorker::loadTrack() lock acquired for load.";
// Emit that a new track is loading, stops the current track
emit(trackLoading());
ReaderStatusUpdate status;
status.status = TRACK_NOT_LOADED;
QString filename = pTrack->getLocation();
if (filename.isEmpty() || !pTrack->exists()) {
// Must unlock before emitting to avoid deadlock
qDebug() << m_group << "CachingReaderWorker::loadTrack() load failed for\""
<< filename << "\", unlocked reader lock";
m_pReaderStatusFIFO->writeBlocking(&status, 1);
emit(trackLoadFailed(
pTrack, QString("The file '%1' could not be found.").arg(filename)));
return;
}
Mixxx::AudioSourceConfig audioSrcCfg;
audioSrcCfg.setChannelCount(CachingReaderChunk::kChannels);
m_pAudioSource = openAudioSourceForReading(pTrack, audioSrcCfg);
if (m_pAudioSource.isNull()) {
m_maxReadableFrameIndex = Mixxx::AudioSource::getMinFrameIndex();
// Must unlock before emitting to avoid deadlock
qDebug() << m_group << "CachingReaderWorker::loadTrack() load failed for\""
<< filename << "\", file invalid, unlocked reader lock";
m_pReaderStatusFIFO->writeBlocking(&status, 1);
emit(trackLoadFailed(
pTrack, QString("The file '%1' could not be loaded.").arg(filename)));
return;
}
// Initially assume that the complete content offered by audio source
// is available for reading. Later if read errors occur this value will
// be decreased to avoid repeated reading of corrupt audio data.
m_maxReadableFrameIndex = m_pAudioSource->getMaxFrameIndex();
status.maxReadableFrameIndex = m_maxReadableFrameIndex;
status.status = TRACK_LOADED;
m_pReaderStatusFIFO->writeBlocking(&status, 1);
// Clear the chunks to read list.
CachingReaderChunkReadRequest request;
while (m_pChunkReadRequestFIFO->read(&request, 1) == 1) {
qDebug() << "Skipping read request for " << request.chunk->getIndex();
status.status = CHUNK_READ_INVALID;
status.chunk = request.chunk;
m_pReaderStatusFIFO->writeBlocking(&status, 1);
}
// Emit that the track is loaded.
const SINT sampleCount =
CachingReaderChunk::frames2samples(
m_pAudioSource->getFrameCount());
emit(trackLoaded(pTrack, m_pAudioSource->getSamplingRate(), sampleCount));
}
示例8: exportTrack
void TrackExportWorker::exportTrack(TrackPointer track) {
QString sourceFilename = track->getLocation();
auto source_fileinfo = track->getFileInfo();
const QString dest_filename = QDir(m_destDir).filePath(
source_fileinfo.fileName());
QFileInfo dest_fileinfo(dest_filename);
if (dest_fileinfo.exists()) {
switch (m_overwriteMode) {
// Give the user the option to overwrite existing files in the destination.
case OverwriteMode::ASK:
switch (makeOverwriteRequest(dest_filename)) {
case OverwriteAnswer::SKIP:
case OverwriteAnswer::SKIP_ALL:
qDebug() << "skipping" << sourceFilename;
return;
case OverwriteAnswer::OVERWRITE:
case OverwriteAnswer::OVERWRITE_ALL:
break;
case OverwriteAnswer::CANCEL:
m_errorMessage = tr("Export process was canceled");
stop();
return;
}
break;
case OverwriteMode::SKIP_ALL:
qDebug() << "skipping" << sourceFilename;
return;
case OverwriteMode::OVERWRITE_ALL:;
}
// Remove the existing file in preparation for overwriting.
QFile dest_file(dest_filename);
qDebug() << "Removing existing file" << dest_filename;
if (!dest_file.remove()) {
const QString error_message = tr(
"Error removing file %1: %2. Stopping.").arg(
dest_filename, dest_file.errorString());
qWarning() << error_message;
m_errorMessage = error_message;
stop();
return;
}
}
qDebug() << "Copying" << sourceFilename << "to" << dest_filename;
QFile source_file(sourceFilename);
if (!source_file.copy(dest_filename)) {
const QString error_message = tr(
"Error exporting track %1 to %2: %3. Stopping.").arg(
sourceFilename, dest_filename, source_file.errorString());
qWarning() << error_message;
m_errorMessage = error_message;
stop();
return;
}
}
示例9: slotLoadFailed
void BaseTrackPlayer::slotLoadFailed(TrackPointer track, QString reason) {
if (track != NULL) {
qDebug() << "Failed to load track" << track->getLocation() << reason;
emit(loadTrackFailed(track));
} else {
qDebug() << "Failed to load track (NULL track object)" << reason;
}
// Alert user.
QMessageBox::warning(NULL, tr("Couldn't load track."), reason);
}
示例10: loadTrack
void CachingReaderWorker::loadTrack(const TrackPointer& pTrack) {
//qDebug() << m_group << "CachingReaderWorker::loadTrack() lock acquired for load.";
// Emit that a new track is loading, stops the current track
emit(trackLoading());
ReaderStatusUpdate status;
status.status = TRACK_NOT_LOADED;
status.chunk = NULL;
status.trackFrameCount = 0;
QString filename = pTrack->getLocation();
if (filename.isEmpty() || !pTrack->exists()) {
// Must unlock before emitting to avoid deadlock
qDebug() << m_group << "CachingReaderWorker::loadTrack() load failed for\""
<< filename << "\", unlocked reader lock";
m_pReaderStatusFIFO->writeBlocking(&status, 1);
emit(trackLoadFailed(
pTrack, QString("The file '%1' could not be found.").arg(filename)));
return;
}
Mixxx::AudioSourceConfig audioSrcCfg;
audioSrcCfg.channelCountHint = kChunkChannels;
m_pAudioSource = openAudioSourceForReading(pTrack, audioSrcCfg);
if (m_pAudioSource.isNull()) {
// Must unlock before emitting to avoid deadlock
qDebug() << m_group << "CachingReaderWorker::loadTrack() load failed for\""
<< filename << "\", file invalid, unlocked reader lock";
m_pReaderStatusFIFO->writeBlocking(&status, 1);
emit(trackLoadFailed(
pTrack, QString("The file '%1' could not be loaded.").arg(filename)));
return;
}
status.trackFrameCount = m_pAudioSource->getFrameCount();
status.status = TRACK_LOADED;
m_pReaderStatusFIFO->writeBlocking(&status, 1);
// Clear the chunks to read list.
ChunkReadRequest request;
while (m_pChunkReadRequestFIFO->read(&request, 1) == 1) {
qDebug() << "Skipping read request for " << request.chunk->chunk_number;
status.status = CHUNK_READ_INVALID;
status.chunk = request.chunk;
m_pReaderStatusFIFO->writeBlocking(&status, 1);
}
// Emit that the track is loaded.
const SINT sampleCount =
m_pAudioSource->getFrameCount() * kChunkChannels;
emit(trackLoaded(pTrack, m_pAudioSource->getFrameRate(), sampleCount));
}
示例11: slotLoadFailed
void BaseTrackPlayerImpl::slotLoadFailed(TrackPointer track, QString reason) {
// TODO(rryan): Currently load failed doesn't clear the deck as an unload
// would. Should we?
if (track != NULL) {
qDebug() << "Failed to load track" << track->getLocation() << reason;
emit(loadTrackFailed(track));
} else {
qDebug() << "Failed to load track (NULL track object)" << reason;
}
// Alert user.
QMessageBox::warning(NULL, tr("Couldn't load track."), reason);
}
示例12: fetchTagFinished
void DlgTagFetcher::fetchTagFinished(const TrackPointer track,
const QList<TrackPointer>& tracks) {
// check if the answer is for this track
if (m_track->getLocation() != track->getLocation()) {
return;
}
m_data.m_pending = false;
m_data.m_results = tracks;
// qDebug() << "number of results = " << tracks.size();
updateStack();
}
示例13: isFileLoaded
bool PlayerInfo::isFileLoaded(const QString& track_location) const {
QMutexLocker locker(&m_mutex);
QMapIterator<QString, TrackPointer> it(m_loadedTrackMap);
while (it.hasNext()) {
it.next();
TrackPointer pTrack = it.value();
if (pTrack) {
if (pTrack->getLocation() == track_location) {
return true;
}
}
}
return false;
}
示例14: dequeueNextBlocking
// This is called from the AnalyserQueue thread
TrackPointer AnalyserQueue::dequeueNextBlocking() {
m_qm.lock();
if (m_tioq.isEmpty()) {
Event::end("AnalyserQueue process");
m_qwait.wait(&m_qm);
Event::start("AnalyserQueue process");
if (m_exit) {
m_qm.unlock();
return TrackPointer();
}
}
const PlayerInfo& info = PlayerInfo::instance();
TrackPointer pLoadTrack;
QMutableListIterator<TrackPointer> it(m_tioq);
while (it.hasNext()) {
TrackPointer& pTrack = it.next();
if (!pTrack) {
it.remove();
continue;
}
// Prioritize tracks that are loaded.
if (info.isTrackLoaded(pTrack)) {
qDebug() << "Prioritizing" << pTrack->getTitle() << pTrack->getLocation();
pLoadTrack = pTrack;
it.remove();
break;
}
}
if (!pLoadTrack && !m_tioq.isEmpty()) {
pLoadTrack = m_tioq.dequeue();
}
m_qm.unlock();
if (pLoadTrack) {
qDebug() << "Analyzing" << pLoadTrack->getTitle() << pLoadTrack->getLocation();
}
// pTrack might be NULL, up to the caller to check.
return pLoadTrack;
}
示例15: trackLoaded
void BrowseTableModel::trackLoaded(QString group, TrackPointer pTrack) {
if (group == m_previewDeckGroup) {
for (int row = 0; row < rowCount(); ++row) {
QModelIndex i = index(row, COLUMN_PREVIEW);
if (i.data().toBool()) {
QStandardItem* item = itemFromIndex(i);
item->setText("0");
}
}
if (pTrack) {
for (int row = 0; row < rowCount(); ++row) {
QModelIndex i = index(row, COLUMN_PREVIEW);
QString location = index(row, COLUMN_LOCATION).data().toString();
if (location == pTrack->getLocation()) {
QStandardItem* item = itemFromIndex(i);
item->setText("1");
break;
}
}
}
}
}