本文整理汇总了C++中Metadata::GetArtist方法的典型用法代码示例。如果您正苦于以下问题:C++ Metadata::GetArtist方法的具体用法?C++ Metadata::GetArtist怎么用?C++ Metadata::GetArtist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Metadata
的用法示例。
在下文中一共展示了Metadata::GetArtist方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void SFB::Audio::Metadata::CopyMetadata(const Metadata& metadata, unsigned kind)
{
if(Basic & kind) {
SetValue(kTitleKey, metadata.GetTitle());
SetValue(kAlbumTitleKey, metadata.GetAlbumTitle());
SetValue(kArtistKey, metadata.GetArtist());
SetValue(kAlbumArtistKey, metadata.GetAlbumArtist());
SetValue(kGenreKey, metadata.GetGenre());
SetValue(kComposerKey, metadata.GetComposer());
SetValue(kReleaseDateKey, metadata.GetReleaseDate());
SetValue(kCompilationKey, metadata.GetCompilation());
SetValue(kTrackNumberKey, metadata.GetTrackNumber());
SetValue(kTrackTotalKey, metadata.GetTrackTotal());
SetValue(kDiscNumberKey, metadata.GetDiscNumber());
SetValue(kDiscTotalKey, metadata.GetDiscTotal());
SetValue(kLyricsKey, metadata.GetLyrics());
SetValue(kBPMKey, metadata.GetBPM());
SetValue(kRatingKey, metadata.GetRating());
SetValue(kCommentKey, metadata.GetComment());
SetValue(kISRCKey, metadata.GetISRC());
SetValue(kMCNKey, metadata.GetMCN());
SetValue(kMusicBrainzReleaseIDKey, metadata.GetMusicBrainzReleaseID());
SetValue(kMusicBrainzRecordingIDKey, metadata.GetMusicBrainzRecordingID());
}
if(Sorting & kind) {
SetValue(kTitleSortOrderKey, metadata.GetTitleSortOrder());
SetValue(kAlbumTitleSortOrderKey, metadata.GetAlbumTitleSortOrder());
SetValue(kArtistSortOrderKey, metadata.GetArtistSortOrder());
SetValue(kAlbumArtistSortOrderKey, metadata.GetAlbumArtistSortOrder());
SetValue(kComposerSortOrderKey, metadata.GetComposer());
}
if(Grouping & kind)
SetValue(kGroupingKey, metadata.GetGrouping());
if(Additional & kind)
SetValue(kAdditionalMetadataKey, metadata.GetAdditionalMetadata());
if(ReplayGain & kind) {
SetValue(kReferenceLoudnessKey, metadata.GetReplayGainReferenceLoudness());
SetValue(kTrackGainKey, metadata.GetReplayGainTrackGain());
SetValue(kTrackPeakKey, metadata.GetReplayGainTrackPeak());
SetValue(kAlbumGainKey, metadata.GetReplayGainAlbumGain());
SetValue(kAlbumPeakKey, metadata.GetReplayGainAlbumPeak());
}
}
示例2: if
bool SFB::Audio::SetID3v2TagFromMetadata(const Metadata& metadata, TagLib::ID3v2::Tag *tag, bool setAlbumArt)
{
if(nullptr == tag)
return false;
// Use UTF-8 as the default encoding
(TagLib::ID3v2::FrameFactory::instance())->setDefaultTextEncoding(TagLib::String::UTF8);
// Album title
tag->setAlbum(TagLib::StringFromCFString(metadata.GetAlbumTitle()));
// Artist
tag->setArtist(TagLib::StringFromCFString(metadata.GetArtist()));
// Composer
tag->removeFrames("TCOM");
if(metadata.GetComposer()) {
auto frame = new TagLib::ID3v2::TextIdentificationFrame("TCOM", TagLib::String::Latin1);
frame->setText(TagLib::StringFromCFString(metadata.GetComposer()));
tag->addFrame(frame);
}
// Genre
tag->setGenre(TagLib::StringFromCFString(metadata.GetGenre()));
// Date
#if 1
int year = 0;
if(metadata.GetReleaseDate())
year = CFStringGetIntValue(metadata.GetReleaseDate());
tag->setYear((TagLib::uint)year);
#else
// TODO: Parse the release date into components and set the frame appropriately
tag->removeFrames("TDRC");
if(metadata.GetReleaseDate()) {
/*
The timestamp fields are based on a subset of ISO 8601. When being as
precise as possible the format of a time string is
yyyy-MM-ddTHH:mm:ss (year, "-", month, "-", day, "T", hour (out of
24), ":", minutes, ":", seconds), but the precision may be reduced by
removing as many time indicators as wanted. Hence valid timestamps
are
yyyy, yyyy-MM, yyyy-MM-dd, yyyy-MM-ddTHH, yyyy-MM-ddTHH:mm and
yyyy-MM-ddTHH:mm:ss. All time stamps are UTC. For durations, use
the slash character as described in 8601, and for multiple non-
contiguous dates, use multiple strings, if allowed by the frame
definition.
*/
// year = CFStringGetIntValue(metadata.GetReleaseDate());
auto frame = new TagLib::ID3v2::TextIdentificationFrame("TDRC", TagLib::String::Latin1);
frame->setText("");
tag->addFrame(frame);
}
#endif
// Comment
tag->setComment(TagLib::StringFromCFString(metadata.GetComment()));
// Album artist
tag->removeFrames("TPE2");
if(metadata.GetAlbumArtist()) {
auto frame = new TagLib::ID3v2::TextIdentificationFrame("TPE2", TagLib::String::Latin1);
frame->setText(TagLib::StringFromCFString(metadata.GetAlbumArtist()));
tag->addFrame(frame);
}
// Track title
tag->setTitle(TagLib::StringFromCFString(metadata.GetTitle()));
// BPM
tag->removeFrames("TBPM");
if(metadata.GetBPM()) {
SFB::CFString str = CFStringCreateWithFormat(kCFAllocatorDefault, nullptr, CFSTR("%@"), metadata.GetBPM());
auto frame = new TagLib::ID3v2::TextIdentificationFrame("TBPM", TagLib::String::Latin1);
frame->setText(TagLib::StringFromCFString(str));
tag->addFrame(frame);
}
// Rating
tag->removeFrames("POPM");
CFNumberRef rating = metadata.GetRating();
if(rating) {
TagLib::ID3v2::PopularimeterFrame *frame = new TagLib::ID3v2::PopularimeterFrame();
int i;
if(CFNumberGetValue(rating, kCFNumberIntType, &i)) {
frame->setRating(i);
tag->addFrame(frame);
}
}
// Track number and total tracks
tag->removeFrames("TRCK");
CFNumberRef trackNumber = metadata.GetTrackNumber();
CFNumberRef trackTotal = metadata.GetTrackTotal();
if(trackNumber && trackTotal) {
SFB::CFString str = CFStringCreateWithFormat(kCFAllocatorDefault, nullptr, CFSTR("%@/%@"), trackNumber, trackTotal);
auto frame = new TagLib::ID3v2::TextIdentificationFrame("TRCK", TagLib::String::Latin1);
//.........这里部分代码省略.........