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


C++ OutStream::OutputLine方法代码示例

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


在下文中一共展示了OutStream::OutputLine方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OutStream

Bool BonkEnc::CueSheet::Save(const String &fileName)
{
	if (fileNames.Length() == 0) return False;

	OutStream	*file	= new OutStream(STREAM_FILE, fileName, OS_OVERWRITE);

	/* Write UTF-8 BOM and set output format.
	 */
	file->OutputNumber(0xEF, 1);
	file->OutputNumber(0xBB, 1);
	file->OutputNumber(0xBF, 1);

	String		 format = String::SetOutputFormat("UTF-8");

	/* Check if all tracks belong to the same album and
	 * if we need to create a single or multi file cue sheet.
	 */
	Bool		 album	= True;
	Bool		 oneFile= True;

	for (Int c = 0; c < fileNames.Length() - 1; c++)
	{
		if (trackArtists.GetNth(c) != trackArtists.GetNth(c + 1) || trackAlbums.GetNth(c) != trackAlbums.GetNth(c + 1))
		{
			album = False;
		}

		if (fileNames.GetNth(c) != fileNames.GetNth(c + 1))
		{
			oneFile = False;
		}
	}

	/* Metadata.
	 */
	if (album)
	{
		file->OutputLine(String("PERFORMER \"").Append(trackArtists.GetFirst()).Append("\""));
		file->OutputLine(String("TITLE \"").Append(trackAlbums.GetFirst()).Append("\""));
	}

	/* Write actual track data.
	 */
	if (oneFile)
	{
		file->OutputLine(String("FILE \"").Append(fileNames.GetNth(0)).Append("\" WAVE"));
	}

	for (Int i = 0; i < fileNames.Length(); i++)
	{
		Int	 minutes =  trackOffsets.GetNth(i)					   / (75 * 60);
		Int	 seconds = (trackOffsets.GetNth(i)		    - (minutes * 60 * 75)) /  75      ;
		Int	 frames  =  trackOffsets.GetNth(i) - (seconds * 75) - (minutes * 60 * 75)	      ;

		if (!oneFile) file->OutputLine(String("FILE \"").Append(fileNames.GetNth(i)).Append("\" WAVE"));

		file->OutputLine(String("  TRACK ").Append(i < 9 ? "0" : "").Append(String::FromInt(i + 1)).Append(" AUDIO"));
		file->OutputLine(String("    TITLE \"").Append(trackTitles.GetNth(i)).Append("\""));
		file->OutputLine(String("    PERFORMER \"").Append(trackArtists.GetNth(i)).Append("\""));
		file->OutputLine(String("    INDEX 01 ").Append(minutes < 10 ? "0" : "").Append(String::FromInt(minutes)).Append(":")
							.Append(seconds < 10 ? "0" : "").Append(String::FromInt(seconds)).Append(":")
							.Append(frames  < 10 ? "0" : "").Append(String::FromInt(frames )));
	}

	file->Close();

	delete file;

	/* Restore previous output format.
	 */
	String::SetOutputFormat(format);

	return True;
}
开发者ID:michaelaw320,项目名称:YoutubeAudioSplitter,代码行数:74,代码来源:cuesheet.cpp


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