本文整理汇总了C++中MusicMetadata::Track方法的典型用法代码示例。如果您正苦于以下问题:C++ MusicMetadata::Track方法的具体用法?C++ MusicMetadata::Track怎么用?C++ MusicMetadata::Track使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MusicMetadata
的用法示例。
在下文中一共展示了MusicMetadata::Track方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateTrackList
void Ripper::updateTrackList(void)
{
if (m_tracks->isEmpty())
return;
if (m_trackList)
{
m_trackList->Reset();
int i;
for (i = 0; i < (int)m_tracks->size(); i++)
{
if (i >= m_tracks->size())
break;
RipTrack *track = m_tracks->at(i);
MusicMetadata *metadata = track->metadata;
MythUIButtonListItem *item = new MythUIButtonListItem(m_trackList,"");
item->setCheckable(true);
item->SetData(qVariantFromValue(track));
if (track->isNew)
item->DisplayState("new", "yes");
else
item->DisplayState("new", "no");
if (track->active)
item->setChecked(MythUIButtonListItem::FullChecked);
else
item->setChecked(MythUIButtonListItem::NotChecked);
item->SetText(QString::number(metadata->Track()), "track");
item->SetText(metadata->Title(), "title");
item->SetText(metadata->Artist(), "artist");
int length = track->length / 1000;
if (length > 0)
{
int min, sec;
min = length / 60;
sec = length % 60;
QString s;
s.sprintf("%02d:%02d", min, sec);
item->SetText(s, "length");
}
else
item->SetText("", "length");
// if (i == m_currentTrack)
// m_trackList->SetItemCurrent(i);
}
}
}
示例2: fillWidgets
void ImportMusicDialog::fillWidgets()
{
if (!m_tracks->empty())
{
// update current
//: %1 is the current track,
//: %2 is the number of tracks
m_currentText->SetText(tr("%1 of %2", "Current track position")
.arg(m_currentTrack + 1).arg(m_tracks->size()));
MusicMetadata *meta = m_tracks->at(m_currentTrack)->metadata;
m_filenameText->SetText(meta->Filename());
m_compilationCheck->SetCheckState(meta->Compilation());
m_compartistText->SetText(meta->CompilationArtist());
m_artistText->SetText(meta->Artist());
m_albumText->SetText(meta->Album());
m_titleText->SetText(meta->Title());
m_genreText->SetText(meta->Genre());
m_yearText->SetText(QString::number(meta->Year()));
m_trackText->SetText(QString::number(meta->Track()));
if (m_tracks->at(m_currentTrack)->isNewTune)
{
m_coverartButton->SetVisible(false);
m_statusText->SetText(tr("New File"));
}
else
{
m_coverartButton->SetVisible(true);
m_statusText->SetText(tr("Already in Database"));
}
}
else
{
// update current
m_currentText->SetText(tr("Not found"));
m_filenameText->Reset();
m_compilationCheck->SetCheckState(false);
m_compartistText->Reset();
m_artistText->Reset();
m_albumText->Reset();
m_titleText->Reset();
m_genreText->Reset();
m_yearText->Reset();
m_trackText->Reset();
m_statusText->Reset();
m_coverartButton->SetVisible(false);
}
}
示例3: shuffleTracks
void Playlist::shuffleTracks(MusicPlayer::ShuffleMode shuffleMode)
{
m_shuffledSongs.clear();
switch (shuffleMode)
{
case MusicPlayer::SHUFFLE_RANDOM:
{
QMultiMap<int, MusicMetadata*> songMap;
SongList::const_iterator it = m_songs.begin();
for (; it != m_songs.end(); ++it)
{
songMap.insert(rand(), *it);
}
QMultiMap<int, MusicMetadata*>::const_iterator i = songMap.constBegin();
while (i != songMap.constEnd())
{
m_shuffledSongs.append(i.value());
++i;
}
break;
}
case MusicPlayer::SHUFFLE_INTELLIGENT:
{
int RatingWeight = 2;
int PlayCountWeight = 2;
int LastPlayWeight = 2;
int RandomWeight = 2;
m_parent->FillIntelliWeights(RatingWeight, PlayCountWeight,
LastPlayWeight, RandomWeight);
// compute max/min playcount,lastplay for this playlist
int playcountMin = 0;
int playcountMax = 0;
double lastplayMin = 0.0;
double lastplayMax = 0.0;
uint idx = 0;
SongList::const_iterator it = m_songs.begin();
for (; it != m_songs.end(); ++it, ++idx)
{
if (!(*it)->isCDTrack())
{
MusicMetadata *mdata = (*it);
if (0 == idx)
{
// first song
playcountMin = playcountMax = mdata->PlayCount();
lastplayMin = lastplayMax = mdata->LastPlay().toTime_t();
}
else
{
if (mdata->PlayCount() < playcountMin)
playcountMin = mdata->PlayCount();
else if (mdata->PlayCount() > playcountMax)
playcountMax = mdata->PlayCount();
if (mdata->LastPlay().toTime_t() < lastplayMin)
lastplayMin = mdata->LastPlay().toTime_t();
else if (mdata->LastPlay().toTime_t() > lastplayMax)
lastplayMax = mdata->LastPlay().toTime_t();
}
}
}
// next we compute all the weights
std::map<int,double> weights;
std::map<int,int> ratings;
std::map<int,int> ratingCounts;
int TotalWeight = RatingWeight + PlayCountWeight + LastPlayWeight;
for (int trackItI = 0; trackItI < m_songs.size(); ++trackItI)
{
MusicMetadata *mdata = m_songs[trackItI];
if (!mdata->isCDTrack())
{
int rating = mdata->Rating();
int playcount = mdata->PlayCount();
double lastplaydbl = mdata->LastPlay().toTime_t();
double ratingValue = (double)(rating) / 10;
double playcountValue, lastplayValue;
if (playcountMax == playcountMin)
playcountValue = 0;
else
playcountValue = ((playcountMin - (double)playcount) / (playcountMax - playcountMin) + 1);
if (lastplayMax == lastplayMin)
lastplayValue = 0;
else
lastplayValue = ((lastplayMin - lastplaydbl) / (lastplayMax - lastplayMin) + 1);
double weight = (RatingWeight * ratingValue +
PlayCountWeight * playcountValue +
LastPlayWeight * lastplayValue) / TotalWeight;
weights[mdata->ID()] = weight;
//.........这里部分代码省略.........