当前位置: 首页>>代码示例>>C++>>正文


C++ Metadata::GetAlbumTitle方法代码示例

本文整理汇总了C++中Metadata::GetAlbumTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ Metadata::GetAlbumTitle方法的具体用法?C++ Metadata::GetAlbumTitle怎么用?C++ Metadata::GetAlbumTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Metadata的用法示例。


在下文中一共展示了Metadata::GetAlbumTitle方法的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());
	}
}
开发者ID:JanX2,项目名称:SFBAudioEngine,代码行数:47,代码来源:AudioMetadata.cpp

示例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);
//.........这里部分代码省略.........
开发者ID:xdpsee,项目名称:SFBAudioEngine,代码行数:101,代码来源:SetID3v2TagFromMetadata.cpp


注:本文中的Metadata::GetAlbumTitle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。