您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CFCopyLocalizedString函数代码示例

51自学网 2021-06-01 19:58:31
  C++
这篇教程C++ CFCopyLocalizedString函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中CFCopyLocalizedString函数的典型用法代码示例。如果您正苦于以下问题:C++ CFCopyLocalizedString函数的具体用法?C++ CFCopyLocalizedString怎么用?C++ CFCopyLocalizedString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

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

示例1: AppearanceAlert

void AppearanceAlert (AlertType type, int stringID1, int stringID2){	OSStatus		err;	DialogRef		dialog;	DialogItemIndex	outItemHit;	CFStringRef		key1, key2, mes1, mes2;	char			label1[32], label2[32];	sprintf(label1, "AlertMes_%02d", stringID1);	sprintf(label2, "AlertMes_%02d", stringID2);	key1 = CFStringCreateWithCString(kCFAllocatorDefault, label1, CFStringGetSystemEncoding());	key2 = CFStringCreateWithCString(kCFAllocatorDefault, label2, CFStringGetSystemEncoding());	if (key1) mes1 = CFCopyLocalizedString(key1, "mes1");	else mes1 = NULL;	if (key2) mes2 = CFCopyLocalizedString(key2, "mes2");	else mes2 = NULL;	PlayAlertSound();	err = CreateStandardAlert(type, mes1, mes2, NULL, &dialog);	err = RunStandardAlert(dialog, NULL, &outItemHit);	if (key1) CFRelease(key1);	if (key2) CFRelease(key2);	if (mes1) CFRelease(mes1);	if (mes2) CFRelease(mes2);}
开发者ID:OV2,项目名称:snes9x-libsnes,代码行数:27,


示例2: CFURLCopyScheme

SFB::Audio::Metadata::unique_ptr SFB::Audio::Metadata::CreateMetadataForURL(CFURLRef url, CFErrorRef *error){	if(nullptr == url)		return nullptr;	// If this is a file URL, use the extension-based resolvers	SFB::CFString scheme = CFURLCopyScheme(url);	// If there is no scheme the URL is invalid	if(!scheme) {		if(error)			*error = CFErrorCreate(kCFAllocatorDefault, kCFErrorDomainPOSIX, EINVAL, nullptr);		return nullptr;	}	if(kCFCompareEqualTo == CFStringCompare(CFSTR("file"), scheme, kCFCompareCaseInsensitive)) {		// Verify the file exists		SInt32 errorCode = noErr;		SFB::CFBoolean fileExists = (CFBooleanRef)CFURLCreatePropertyFromResource(kCFAllocatorDefault, url, kCFURLFileExists, &errorCode);				if(fileExists) {			if(CFBooleanGetValue(fileExists)) {				SFB::CFString pathExtension = CFURLCopyPathExtension(url);				if(pathExtension) {										// Some extensions (.oga for example) support multiple audio codecs (Vorbis, FLAC, Speex)					for(auto subclassInfo : sRegisteredSubclasses) {						if(subclassInfo.mHandlesFilesWithExtension(pathExtension)) {							unique_ptr metadata(subclassInfo.mCreateMetadata(url));							if(metadata->ReadMetadata(error))								return metadata;						}					}				}			}			else {				LOGGER_WARNING("org.sbooth.AudioEngine.Metadata", "The requested URL doesn't exist");								if(error) {					SFB::CFString description = CFCopyLocalizedString(CFSTR("The file “%@” does not exist."), "");					SFB::CFString failureReason = CFCopyLocalizedString(CFSTR("File not found"), "");					SFB::CFString recoverySuggestion = CFCopyLocalizedString(CFSTR("The file may exist on removable media or may have been deleted."), "");										*error = CreateErrorForURL(Metadata::ErrorDomain, Metadata::InputOutputError, description, url, failureReason, recoverySuggestion);				}			}		}		else			LOGGER_WARNING("org.sbooth.AudioEngine.Metadata", "CFURLCreatePropertyFromResource failed: " << errorCode);			}	return nullptr;}
开发者ID:JanX2,项目名称:SFBAudioEngine,代码行数:54,


示例3: ResumeWarningDialogProc

int ResumeWarningDialogProc(const char *string) {    SInt16	ret;        ret = showCautionAlert(	CFCopyLocalizedString(CFSTR("The Save Data file is conflicting"), "bad data"),                             CFStringCreateWithCString(NULL, string, CFStringGetSystemEncoding()),                             CFCopyLocalizedString(CFSTR("Continue"), "OK"));    if ((ret = kAlertStdAlertOKButton) != 0) {        return(IDOK);    }    return(IDCANCEL);}
开发者ID:amuramatsu,项目名称:np2-mod,代码行数:11,


示例4: CFDictionaryRemoveAllValues

bool WavPackMetadata::ReadMetadata(CFErrorRef *error){	// Start from scratch	CFDictionaryRemoveAllValues(mMetadata);	CFDictionaryRemoveAllValues(mChangedMetadata);	UInt8 buf [PATH_MAX];	if(!CFURLGetFileSystemRepresentation(mURL, FALSE, buf, PATH_MAX))		return false;	auto stream = new TagLib::FileStream(reinterpret_cast<const char *>(buf), true);	TagLib::WavPack::File file(stream);	if(!file.isValid()) {		if(nullptr != error) {			CFStringRef description = CFCopyLocalizedString(CFSTR("The file “%@” is not a valid WavPack file."), "");			CFStringRef failureReason = CFCopyLocalizedString(CFSTR("Not a WavPack file"), "");			CFStringRef recoverySuggestion = CFCopyLocalizedString(CFSTR("The file's extension may not match the file's type."), "");						*error = CreateErrorForURL(AudioMetadataErrorDomain, AudioMetadataInputOutputError, description, mURL, failureReason, recoverySuggestion);						CFRelease(description), description = nullptr;			CFRelease(failureReason), failureReason = nullptr;			CFRelease(recoverySuggestion), recoverySuggestion = nullptr;		}		return false;	}		CFDictionarySetValue(mMetadata, kPropertiesFormatNameKey, CFSTR("WavPack"));		if(file.audioProperties()) {		auto properties = file.audioProperties();		AddAudioPropertiesToDictionary(mMetadata, properties);				if(properties->bitsPerSample())			AddIntToDictionary(mMetadata, kPropertiesBitsPerChannelKey, properties->bitsPerSample());		if(properties->sampleFrames())			AddIntToDictionary(mMetadata, kPropertiesTotalFramesKey, properties->sampleFrames());	}		if(file.ID3v1Tag())		AddID3v1TagToDictionary(mMetadata, file.ID3v1Tag());	if(file.APETag()) {		std::vector<AttachedPicture *> pictures;		AddAPETagToDictionary(mMetadata, pictures, file.APETag());		for(auto picture : pictures)			AddSavedPicture(picture);	}	return true;}
开发者ID:MisterRogersHaus,项目名称:SFBAudioEngine,代码行数:53,


示例5: stream

bool SFB::Audio::MP3Metadata::_WriteMetadata(CFErrorRef *error){	UInt8 buf [PATH_MAX];	if(!CFURLGetFileSystemRepresentation(mURL, false, buf, PATH_MAX))		return false;	std::unique_ptr<TagLib::FileStream> stream(new TagLib::FileStream((const char *)buf));	if(!stream->isOpen()) {		if(error) {			SFB::CFString description(CFCopyLocalizedString(CFSTR("The file “%@” could not be opened for writing."), ""));			SFB::CFString failureReason(CFCopyLocalizedString(CFSTR("Input/output error"), ""));			SFB::CFString recoverySuggestion(CFCopyLocalizedString(CFSTR("The file may have been renamed, moved, deleted, or you may not have appropriate permissions."), ""));			*error = CreateErrorForURL(Metadata::ErrorDomain, Metadata::InputOutputError, description, mURL, failureReason, recoverySuggestion);		}		return false;	}	TagLib::MPEG::File file(stream.get(), TagLib::ID3v2::FrameFactory::instance(), false);	if(!file.isValid()) {		if(error) {			SFB::CFString description(CFCopyLocalizedString(CFSTR("The file “%@” is not a valid MPEG file."), ""));			SFB::CFString failureReason(CFCopyLocalizedString(CFSTR("Not an MPEG file"), ""));			SFB::CFString recoverySuggestion(CFCopyLocalizedString(CFSTR("The file's extension may not match the file's type."), ""));						*error = CreateErrorForURL(Metadata::ErrorDomain, Metadata::InputOutputError, description, mURL, failureReason, recoverySuggestion);		}				return false;	}	// APE and ID3v1 tags are only written if present, but ID3v2 tags are always written	auto APETag = file.APETag();	if(APETag && !APETag->isEmpty())		SetAPETagFromMetadata(*this, APETag);	auto ID3v1Tag = file.ID3v1Tag();	if(ID3v1Tag && !ID3v1Tag->isEmpty())		SetID3v1TagFromMetadata(*this, ID3v1Tag);	SetID3v2TagFromMetadata(*this, file.ID3v2Tag(true));	if(!file.save()) {		if(error) {			SFB::CFString description(CFCopyLocalizedString(CFSTR("The file “%@” is not a valid MPEG file."), ""));			SFB::CFString failureReason(CFCopyLocalizedString(CFSTR("Unable to write metadata"), ""));			SFB::CFString recoverySuggestion(CFCopyLocalizedString(CFSTR("The file's extension may not match the file's type."), ""));						*error = CreateErrorForURL(Metadata::ErrorDomain, Metadata::InputOutputError, description, mURL, failureReason, recoverySuggestion);		}				return false;	}	return true;}
开发者ID:sbooth,项目名称:SFBAudioEngine,代码行数:58,


示例6: QuitWarningDialogProc

bool QuitWarningDialogProc(void) {    SInt16	ret;        if (np2oscfg.comfirm) {        ret = showCautionAlert(	CFCopyLocalizedString(CFSTR("Quit"), "Quit title"),                                 CFCopyLocalizedString(CFSTR("Are you sure you want to quit?"), "Quit causion string"),                                 NULL);        if (ret == kAlertStdAlertCancelButton) {            return(false);        }    }    return(true);}
开发者ID:amuramatsu,项目名称:np2-mod,代码行数:13,


示例7: ResumeErrorDialogProc

void ResumeErrorDialogProc(void) {    DialogRef	ret;    AlertStdCFStringAlertParamRec	param;    DialogItemIndex	hit;        GetStandardAlertDefaultParams(&param, kStdCFStringAlertVersionOne);       param.movable = true;    CreateStandardAlert(kAlertStopAlert, CFCopyLocalizedString(CFSTR("Couldn't restart"), "Resume Error Message"),                                          CFCopyLocalizedString(CFSTR("An error occured when reading the np2.sav file. Neko Project IIx couldn't restart."), "Resume Error Description"),                                         &param, &ret);    SysBeep(0);    RunStandardAlert(ret, NULL, &hit);}
开发者ID:amuramatsu,项目名称:np2-mod,代码行数:13,


示例8: stream

bool SFB::Audio::WAVEMetadata::_WriteMetadata(CFErrorRef *error){	UInt8 buf [PATH_MAX];	if(!CFURLGetFileSystemRepresentation(mURL, false, buf, PATH_MAX))		return false;	std::unique_ptr<TagLib::FileStream> stream(new TagLib::FileStream((const char *)buf));	if(!stream->isOpen()) {		if(error) {			SFB::CFString description = CFCopyLocalizedString(CFSTR("The file “%@” could not be opened for writing."), "");			SFB::CFString failureReason = CFCopyLocalizedString(CFSTR("Input/output error"), "");			SFB::CFString recoverySuggestion = CFCopyLocalizedString(CFSTR("The file may have been renamed, moved, deleted, or you may not have appropriate permissions."), "");			*error = CreateErrorForURL(Metadata::ErrorDomain, Metadata::InputOutputError, description, mURL, failureReason, recoverySuggestion);		}		return false;	}	TagLib::RIFF::WAV::File file(stream.get(), false);	if(!file.isValid()) {		if(error) {			SFB::CFString description = CFCopyLocalizedString(CFSTR("The file “%@” is not a valid WAVE file."), "");			SFB::CFString failureReason = CFCopyLocalizedString(CFSTR("Not a WAVE file"), "");			SFB::CFString recoverySuggestion = CFCopyLocalizedString(CFSTR("The file's extension may not match the file's type."), "");						*error = CreateErrorForURL(Metadata::ErrorDomain, Metadata::InputOutputError, description, mURL, failureReason, recoverySuggestion);		}				return false;	}	// An Info tag is only written if present, but ID3v2 tags are always written	// TODO: Should other field names from the Info tag be handled?	if(file.InfoTag())		SetTagFromMetadata(*this, file.InfoTag());	SetID3v2TagFromMetadata(*this, file.ID3v2Tag());	if(!file.save()) {		if(error) {			SFB::CFString description = CFCopyLocalizedString(CFSTR("The file “%@” is not a valid WAVE file."), "");			SFB::CFString failureReason = CFCopyLocalizedString(CFSTR("Unable to write metadata"), "");			SFB::CFString recoverySuggestion = CFCopyLocalizedString(CFSTR("The file's extension may not match the file's type."), "");						*error = CreateErrorForURL(Metadata::ErrorDomain, Metadata::InputOutputError, description, mURL, failureReason, recoverySuggestion);		}				return false;	}	return true;}
开发者ID:JanX2,项目名称:SFBAudioEngine,代码行数:54,


示例9: APEIOInterface

bool SFB::Audio::MonkeysAudioDecoder::_Open(CFErrorRef *error){	auto ioInterface = 	std::unique_ptr<APEIOInterface>(new APEIOInterface(GetInputSource()));	auto decompressor = std::unique_ptr<APE::IAPEDecompress>(CreateIAPEDecompressEx(ioInterface.get(), nullptr));	if(!decompressor) {		if(error) {			SFB::CFString description = CFCopyLocalizedString(CFSTR("The file “%@” is not a valid Monkey's Audio file."), "");			SFB::CFString failureReason = CFCopyLocalizedString(CFSTR("Not a Monkey's Audio file"), "");			SFB::CFString recoverySuggestion = CFCopyLocalizedString(CFSTR("The file's extension may not match the file's type."), "");						*error = CreateErrorForURL(Decoder::ErrorDomain, Decoder::InputOutputError, description, mInputSource->GetURL(), failureReason, recoverySuggestion);		}				return false;	}	mDecompressor = std::move(decompressor);	mIOInterface = std::move(ioInterface);	// The file format	mFormat.mFormatID			= kAudioFormatLinearPCM;	mFormat.mFormatFlags		= kAudioFormatFlagIsSignedInteger | kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsPacked;		mFormat.mBitsPerChannel		= (UInt32)mDecompressor->GetInfo(APE::APE_INFO_BITS_PER_SAMPLE);	mFormat.mSampleRate			= mDecompressor->GetInfo(APE::APE_INFO_SAMPLE_RATE);	mFormat.mChannelsPerFrame	= (UInt32)mDecompressor->GetInfo(APE::APE_INFO_CHANNELS);		mFormat.mBytesPerPacket		= (mFormat.mBitsPerChannel / 8) * mFormat.mChannelsPerFrame;	mFormat.mFramesPerPacket	= 1;	mFormat.mBytesPerFrame		= mFormat.mBytesPerPacket * mFormat.mFramesPerPacket;		mFormat.mReserved			= 0;		// Set up the source format	mSourceFormat.mFormatID				= 'APE ';		mSourceFormat.mSampleRate			= mFormat.mSampleRate;	mSourceFormat.mChannelsPerFrame		= mFormat.mChannelsPerFrame;	mSourceFormat.mBitsPerChannel		= mFormat.mBitsPerChannel;	switch(mFormat.mChannelsPerFrame) {		case 1:		mChannelLayout = ChannelLayout::ChannelLayoutWithTag(kAudioChannelLayoutTag_Mono);			break;		case 2:		mChannelLayout = ChannelLayout::ChannelLayoutWithTag(kAudioChannelLayoutTag_Stereo);		break;		case 4:		mChannelLayout = ChannelLayout::ChannelLayoutWithTag(kAudioChannelLayoutTag_Quadraphonic);	break;	}	return true;}
开发者ID:JanX2,项目名称:SFBAudioEngine,代码行数:49,


示例10: DoErrorAlert

void DoErrorAlert(OSStatus status, CFStringRef errorFormatString){	    CFStringRef formatStr = NULL, printErrorMsg = NULL;    SInt16      alertItemHit = 0;    Str255      stringBuf;    if ((status != noErr) && (status != 2))               {		formatStr =  CFCopyLocalizedString (errorFormatString, NULL);			if (formatStr != NULL)		{			printErrorMsg = CFStringCreateWithFormat(													 NULL,													 NULL,													 formatStr,													 status);			if (printErrorMsg != NULL)			{				if (CFStringGetPascalString (											 printErrorMsg,											 stringBuf,											 sizeof(stringBuf),											 GetApplicationTextEncoding()))				{					StandardAlert(kAlertStopAlert, stringBuf, NULL, NULL, &alertItemHit);				}				CFRelease (printErrorMsg);                     			}			CFRelease (formatStr);                             		}	}}
开发者ID:pombredanne,项目名称:Frontier,代码行数:32,


示例11: stream

bool SFB::Audio::OggFLACMetadata::_WriteMetadata(CFErrorRef *error){	UInt8 buf [PATH_MAX];	if(!CFURLGetFileSystemRepresentation(mURL, false, buf, PATH_MAX))		return false;	std::unique_ptr<TagLib::FileStream> stream(new TagLib::FileStream((const char *)buf));	if(!stream->isOpen()) {		if(error) {			SFB::CFString description = CFCopyLocalizedString(CFSTR("The file “%@” could not be opened for writing."), "");			SFB::CFString failureReason = CFCopyLocalizedString(CFSTR("Input/output error"), "");			SFB::CFString recoverySuggestion = CFCopyLocalizedString(CFSTR("The file may have been renamed, moved, deleted, or you may not have appropriate permissions."), "");			*error = CreateErrorForURL(Metadata::ErrorDomain, Metadata::InputOutputError, description, mURL, failureReason, recoverySuggestion);		}		return false;	}	TagLib::Ogg::FLAC::File file(stream.get(), false);	if(!file.isValid()) {		if(error) {			SFB::CFString description = CFCopyLocalizedString(CFSTR("The file “%@” is not a valid Ogg file."), "");			SFB::CFString failureReason = CFCopyLocalizedString(CFSTR("Not an Ogg file"), "");			SFB::CFString recoverySuggestion = CFCopyLocalizedString(CFSTR("The file's extension may not match the file's type."), "");						*error = CreateErrorForURL(Metadata::ErrorDomain, Metadata::InputOutputError, description, mURL, failureReason, recoverySuggestion);		}		return false;	}	SetXiphCommentFromMetadata(*this, file.tag());	if(!file.save()) {		if(error) {			SFB::CFString description = CFCopyLocalizedString(CFSTR("The file “%@” is not a valid Ogg file."), "");			SFB::CFString failureReason = CFCopyLocalizedString(CFSTR("Unable to write metadata"), "");			SFB::CFString recoverySuggestion = CFCopyLocalizedString(CFSTR("The file's extension may not match the file's type."), "");						*error = CreateErrorForURL(Metadata::ErrorDomain, Metadata::InputOutputError, description, mURL, failureReason, recoverySuggestion);		}				return false;	}	return true;}
开发者ID:Read-Write,项目名称:SFBAudioEngine,代码行数:48,


示例12: NPClientBeginOpenROMImage

static bool8 NPClientBeginOpenROMImage(WindowRef window){	CFStringRef			numRef, romRef, baseRef;	CFMutableStringRef  mesRef;	SInt32				replaceAt;	bool8				r;	DeinitGameWindow();	if (cartOpen)	{		SNES9X_SaveSRAM();		S9xSaveCheatFile(S9xGetFilename(".cht", PATCH_DIR));	}		cartOpen = false;		Settings.MouseMaster = true;	Settings.SuperScopeMaster = true;	Settings.MultiPlayer5Master = true;	Settings.JustifierMaster = true;	ResetCheatFinder();		romRef  = CFStringCreateWithCString(kCFAllocatorDefault, nprominfo.fname, MAC_PATH_ENCODING);	numRef  = CFCopyLocalizedString(CFSTR("NPROMNamePos"), "1");	baseRef = CFCopyLocalizedString(CFSTR("NPROMNameMes"), "NPROM");	mesRef  = CFStringCreateMutableCopy(kCFAllocatorDefault, 0, baseRef);	replaceAt = CFStringGetIntValue(numRef);	CFStringReplace(mesRef, CFRangeMake(replaceAt - 1, 1), romRef);	r = NavBeginOpenROMImageSheet(window, mesRef);	CFRelease(mesRef);	CFRelease(baseRef);	CFRelease(numRef);	CFRelease(romRef);		return (r);}
开发者ID:alesegdia,项目名称:snes-sdk,代码行数:40,


示例13: CFDictionaryRemoveAllValues

bool OggSpeexMetadata::ReadMetadata(CFErrorRef *error){	// Start from scratch	CFDictionaryRemoveAllValues(mMetadata);	CFDictionaryRemoveAllValues(mChangedMetadata);		UInt8 buf [PATH_MAX];	if(!CFURLGetFileSystemRepresentation(mURL, false, buf, PATH_MAX))		return false;		// TODO: Use unique_ptr once the switch to C++11 STL is made	std::auto_ptr<TagLib::FileStream> stream(new TagLib::FileStream(reinterpret_cast<const char *>(buf), true));	if(!stream->isOpen()) {		if(error) {			CFStringRef description = CFCopyLocalizedString(CFSTR("The file “%@” could not be opened for reading."), "");			CFStringRef failureReason = CFCopyLocalizedString(CFSTR("Input/output error"), "");			CFStringRef recoverySuggestion = CFCopyLocalizedString(CFSTR("The file may have been renamed, moved, deleted, or you may not have appropriate permissions."), "");			*error = CreateErrorForURL(AudioMetadataErrorDomain, AudioMetadataInputOutputError, description, mURL, failureReason, recoverySuggestion);			CFRelease(description), description = nullptr;			CFRelease(failureReason), failureReason = nullptr;			CFRelease(recoverySuggestion), recoverySuggestion = nullptr;		}		return false;	}	TagLib::Ogg::Speex::File file(stream.get());	if(!file.isValid()) {		if(nullptr != error) {			CFStringRef description = CFCopyLocalizedString(CFSTR("The file “%@” is not a valid Ogg Speex file."), "");			CFStringRef failureReason = CFCopyLocalizedString(CFSTR("Not an Ogg Speex file"), "");			CFStringRef recoverySuggestion = CFCopyLocalizedString(CFSTR("The file's extension may not match the file's type."), "");						*error = CreateErrorForURL(AudioMetadataErrorDomain, AudioMetadataInputOutputError, description, mURL, failureReason, recoverySuggestion);						CFRelease(description), description = nullptr;			CFRelease(failureReason), failureReason = nullptr;			CFRelease(recoverySuggestion), recoverySuggestion = nullptr;		}				return false;	}		CFDictionarySetValue(mMetadata, kPropertiesFormatNameKey, CFSTR("Ogg Speex"));		if(file.audioProperties())		AddAudioPropertiesToDictionary(mMetadata, file.audioProperties());		if(file.tag()) {		std::vector<AttachedPicture *> pictures;		AddXiphCommentToDictionary(mMetadata, pictures, file.tag());		for(auto picture : pictures)			AddSavedPicture(picture);	}		return true;}
开发者ID:burningneutron,项目名称:SFBAudioEngine,代码行数:59,


示例14: print_fsname

/* * Write our (localized) fake filesystem name to stdout. */static voidprint_fsname(){	char cstr[256];	CFStringRef str;	str = CFCopyLocalizedString(CFSTR("Incompatible Format"), "Incompatible Format");	CFStringGetCString(str, cstr, 256, kCFStringEncodingUTF8);	(void) fprintf(stdout, "%s", cstr);	fflush(stdout);	if (str)		CFRelease(str);}
开发者ID:naota,项目名称:diskdev_cmds,代码行数:16,


示例15: file

bool MP3Metadata::WriteMetadata(CFErrorRef *error){	UInt8 buf [PATH_MAX];	if(!CFURLGetFileSystemRepresentation(mURL, false, buf, PATH_MAX))		return false;	auto stream = new TagLib::FileStream(reinterpret_cast<const char *>(buf));	TagLib::MPEG::File file(stream, TagLib::ID3v2::FrameFactory::instance(), false);		if(!file.isValid()) {		if(error) {			CFStringRef description = CFCopyLocalizedString(CFSTR("The file “%@” is not a valid MPEG file."), "");			CFStringRef failureReason = CFCopyLocalizedString(CFSTR("Not an MPEG file"), "");			CFStringRef recoverySuggestion = CFCopyLocalizedString(CFSTR("The file's extension may not match the file's type."), "");						*error = CreateErrorForURL(AudioMetadataErrorDomain, AudioMetadataInputOutputError, description, mURL, failureReason, recoverySuggestion);						CFRelease(description), description = nullptr;			CFRelease(failureReason), failureReason = nullptr;			CFRelease(recoverySuggestion), recoverySuggestion = nullptr;		}				return false;	}	// APE and ID3v1 tags are only written if present, but ID3v2 tags are always written	auto APETag = file.APETag();	if(APETag && !APETag->isEmpty())		SetAPETagFromMetadata(*this, APETag);	auto ID3v1Tag = file.ID3v1Tag();	if(ID3v1Tag && !ID3v1Tag->isEmpty())		SetID3v1TagFromMetadata(*this, ID3v1Tag);	SetID3v2TagFromMetadata(*this, file.ID3v2Tag(true));	if(!file.save()) {		if(error) {			CFStringRef description = CFCopyLocalizedString(CFSTR("The file “%@” is not a valid MPEG file."), "");			CFStringRef failureReason = CFCopyLocalizedString(CFSTR("Unable to write metadata"), "");			CFStringRef recoverySuggestion = CFCopyLocalizedString(CFSTR("The file's extension may not match the file's type."), "");						*error = CreateErrorForURL(AudioMetadataErrorDomain, AudioMetadataInputOutputError, description, mURL, failureReason, recoverySuggestion);						CFRelease(description), description = nullptr;			CFRelease(failureReason), failureReason = nullptr;			CFRelease(recoverySuggestion), recoverySuggestion = nullptr;		}				return false;	}		MergeChangedMetadataIntoMetadata();		return true;}
开发者ID:MisterRogersHaus,项目名称:SFBAudioEngine,代码行数:57,


示例16: NPClientBeginOpenROMImage

static bool8 NPClientBeginOpenROMImage (WindowRef window){	CFStringRef			numRef, romRef, baseRef;	CFMutableStringRef	mesRef;	SInt32				replaceAt;	bool8				r;	DeinitGameWindow();	if (cartOpen)	{		SNES9X_SaveSRAM();		S9xResetSaveTimer(false);		S9xSaveCheatFile(S9xGetFilename(".cht", CHEAT_DIR));	}	cartOpen = false;	ResetCheatFinder();	romRef  = CFStringCreateWithCString(kCFAllocatorDefault, nprominfo.fname, kCFStringEncodingUTF8);	numRef  = CFCopyLocalizedString(CFSTR("NPROMNamePos"), "1");	baseRef = CFCopyLocalizedString(CFSTR("NPROMNameMes"), "NPROM");	mesRef  = CFStringCreateMutableCopy(kCFAllocatorDefault, 0, baseRef);	replaceAt = CFStringGetIntValue(numRef);	CFStringReplace(mesRef, CFRangeMake(replaceAt - 1, 1), romRef);	r = NavBeginOpenROMImageSheet(window, mesRef);	CFRelease(mesRef);	CFRelease(baseRef);	CFRelease(numRef);	CFRelease(romRef);	return (r);}
开发者ID:RedGuyyyy,项目名称:snes9x,代码行数:36,


示例17: stream

bool SFB::Audio::TrueAudioMetadata::_ReadMetadata(CFErrorRef *error){    UInt8 buf [PATH_MAX];    if(!CFURLGetFileSystemRepresentation(mURL, FALSE, buf, PATH_MAX))        return false;    std::unique_ptr<TagLib::FileStream> stream(new TagLib::FileStream((const char *)buf, true));    if(!stream->isOpen()) {        if(error) {            SFB::CFString description = CFCopyLocalizedString(CFSTR("The file “%@” could not be opened for reading."), "");            SFB::CFString failureReason = CFCopyLocalizedString(CFSTR("Input/output error"), "");            SFB::CFString recoverySuggestion = CFCopyLocalizedString(CFSTR("The file may have been renamed, moved, deleted, or you may not have appropriate permissions."), "");            *error = CreateErrorForURL(Metadata::ErrorDomain, Metadata::InputOutputError, description, mURL, failureReason, recoverySuggestion);        }        return false;    }    TagLib::TrueAudio::File file(stream.get());    if(!file.isValid()) {        if(nullptr != error) {            SFB::CFString description = CFCopyLocalizedString(CFSTR("The file “%@” is not a valid True Audio file."), "");            SFB::CFString failureReason = CFCopyLocalizedString(CFSTR("Not a True Audio file"), "");            SFB::CFString recoverySuggestion = CFCopyLocalizedString(CFSTR("The file's extension may not match the file's type."), "");            *error = CreateErrorForURL(Metadata::ErrorDomain, Metadata::InputOutputError, description, mURL, failureReason, recoverySuggestion);        }        return false;    }    CFDictionarySetValue(mMetadata, kFormatNameKey, CFSTR("True Audio"));    if(file.audioProperties()) {        auto properties = file.audioProperties();        AddAudioPropertiesToDictionary(mMetadata, properties);        if(properties->bitsPerSample())            AddIntToDictionary(mMetadata, kBitsPerChannelKey, properties->bitsPerSample());        if(properties->sampleFrames())            AddIntToDictionary(mMetadata, kTotalFramesKey, (int)properties->sampleFrames());    }    // Add all tags that are present    if(file.ID3v1Tag())        AddID3v1TagToDictionary(mMetadata, file.ID3v1Tag());    if(file.ID3v2Tag())        AddID3v2TagToDictionary(mMetadata, mPictures, file.ID3v2Tag());    return true;}
开发者ID:zbleftover,项目名称:SFBAudioEngine,代码行数:53,


示例18: file

bool MonkeysAudioMetadata::WriteMetadata(CFErrorRef *error){	UInt8 buf [PATH_MAX];	if(!CFURLGetFileSystemRepresentation(mURL, false, buf, PATH_MAX))		return false;		auto stream = new TagLib::FileStream(reinterpret_cast<const char *>(buf));	TagLib::APE::File file(stream, false);		if(!file.isValid()) {		if(error) {			CFStringRef description = CFCopyLocalizedString(CFSTR("The file “%@” is not a valid Monkey's Audio file."), "");			CFStringRef failureReason = CFCopyLocalizedString(CFSTR("Not a Monkey's Audio file"), "");			CFStringRef recoverySuggestion = CFCopyLocalizedString(CFSTR("The file's extension may not match the file's type."), "");						*error = CreateErrorForURL(AudioMetadataErrorDomain, AudioMetadataInputOutputError, description, mURL, failureReason, recoverySuggestion);						CFRelease(description), description = nullptr;			CFRelease(failureReason), failureReason = nullptr;			CFRelease(recoverySuggestion), recoverySuggestion = nullptr;		}				return false;	}	// Although both ID3v1 and APE tags are read, only APE tags are written	if(file.APETag())		SetAPETagFromMetadata(*this, file.APETag());	if(!file.save()) {		if(error) {			CFStringRef description = CFCopyLocalizedString(CFSTR("The file “%@” is not a valid Monkey's Audio file."), "");			CFStringRef failureReason = CFCopyLocalizedString(CFSTR("Unable to write metadata"), "");			CFStringRef recoverySuggestion = CFCopyLocalizedString(CFSTR("The file's extension may not match the file's type."), "");						*error = CreateErrorForURL(AudioMetadataErrorDomain, AudioMetadataInputOutputError, description, mURL, failureReason, recoverySuggestion);						CFRelease(description), description = nullptr;			CFRelease(failureReason), failureReason = nullptr;			CFRelease(recoverySuggestion), recoverySuggestion = nullptr;		}				return false;	}		MergeChangedMetadataIntoMetadata();		return true;}
开发者ID:LionelWang,项目名称:SFBAudioEngine,代码行数:49,


示例19: MyActionNameMapperCallback

CFStringRefMyActionNameMapperCallback(CFStringRef actionName, UInt32 commandID, void* userData ){	static const CFStringRef errorStr = CFSTR("Error!");	static const CFStringRef kMyCustomActionString = CFSTR("MyActionGroup");	CFOptionFlags compareOptions = 0;	CFStringRef actionCFStr = NULL;	// allocate buffer for string we will return	CFMutableStringRef builtCFStr = CFStringCreateMutable( NULL /*allocator*/, 50 /*maxLen*/ );	// is the actionName key one of my custom strings?	if( CFStringCompare( actionName, kMyCustomActionString, compareOptions ) == kCFCompareEqualTo )	{		actionCFStr = CFSTR("Custom Action Group");	}	else	{		actionCFStr = CFCopyLocalizedString ( actionName, "Actions strings displayed in the edit menu" );	}		require_action( actionCFStr != NULL, FAIL, CFStringAppend( builtCFStr, errorStr) );		if( commandID == kHICommandUndo )	{		CFStringAppend( builtCFStr, CFSTR("Undo ") );		CFStringAppend( builtCFStr, actionCFStr );	}	else if( commandID = kHICommandRedo )	{		CFStringAppend( builtCFStr, CFSTR("Redo ") );		CFStringAppend( builtCFStr, actionCFStr );	}	else		CFStringAppend( builtCFStr, errorStr);			FAIL:	return builtCFStr;};
开发者ID:arnelh,项目名称:Examples,代码行数:40,


示例20: file

bool OggVorbisMetadata::WriteMetadata(CFErrorRef *error){	UInt8 buf [PATH_MAX];	if(!CFURLGetFileSystemRepresentation(mURL, false, buf, PATH_MAX))		return false;	auto stream = new TagLib::FileStream(reinterpret_cast<const char *>(buf));	TagLib::Ogg::Vorbis::File file(stream, false);		if(!file.isValid()) {		if(error) {			CFStringRef description = CFCopyLocalizedString(CFSTR("The file “%@” is not a valid Ogg Vorbis file."), "");			CFStringRef failureReason = CFCopyLocalizedString(CFSTR("Not an Ogg Vorbis file"), "");			CFStringRef recoverySuggestion = CFCopyLocalizedString(CFSTR("The file's extension may not match the file's type."), "");						*error = CreateErrorForURL(AudioMetadataErrorDomain, AudioMetadataInputOutputError, description, mURL, failureReason, recoverySuggestion);						CFRelease(description), description = nullptr;			CFRelease(failureReason), failureReason = nullptr;			CFRelease(recoverySuggestion), recoverySuggestion = nullptr;		}		return false;	}	SetXiphCommentFromMetadata(*this, file.tag());	if(!file.save()) {		if(error) {			CFStringRef description = CFCopyLocalizedString(CFSTR("The file “%@” is not a valid Ogg Vorbis file."), "");			CFStringRef failureReason = CFCopyLocalizedString(CFSTR("Unable to write metadata"), "");			CFStringRef recoverySuggestion = CFCopyLocalizedString(CFSTR("The file's extension may not match the file's type."), "");						*error = CreateErrorForURL(AudioMetadataErrorDomain, AudioMetadataInputOutputError, description, mURL, failureReason, recoverySuggestion);						CFRelease(description), description = nullptr;			CFRelease(failureReason), failureReason = nullptr;			CFRelease(recoverySuggestion), recoverySuggestion = nullptr;		}				return false;	}	MergeChangedMetadataIntoMetadata();	return true;}
开发者ID:LionelWang,项目名称:SFBAudioEngine,代码行数:47,


示例21: stream

bool SFB::Audio::OggVorbisMetadata::_ReadMetadata(CFErrorRef *error){	UInt8 buf [PATH_MAX];	if(!CFURLGetFileSystemRepresentation(mURL, false, buf, PATH_MAX))		return false;		std::unique_ptr<TagLib::FileStream> stream(new TagLib::FileStream((const char *)buf, true));	if(!stream->isOpen()) {		if(error) {			SFB::CFString description = CFCopyLocalizedString(CFSTR("The file “%@” could not be opened for reading."), "");			SFB::CFString failureReason = CFCopyLocalizedString(CFSTR("Input/output error"), "");			SFB::CFString recoverySuggestion = CFCopyLocalizedString(CFSTR("The file may have been renamed, moved, deleted, or you may not have appropriate permissions."), "");			*error = CreateErrorForURL(Metadata::ErrorDomain, Metadata::InputOutputError, description, mURL, failureReason, recoverySuggestion);		}		return false;	}	TagLib::Ogg::Vorbis::File file(stream.get());	if(!file.isValid()) {		if(nullptr != error) {			SFB::CFString description = CFCopyLocalizedString(CFSTR("The file “%@” is not a valid Ogg Vorbis file."), "");			SFB::CFString failureReason = CFCopyLocalizedString(CFSTR("Not an Ogg Vorbis file"), "");			SFB::CFString recoverySuggestion = CFCopyLocalizedString(CFSTR("The file's extension may not match the file's type."), "");						*error = CreateErrorForURL(Metadata::ErrorDomain, Metadata::InputOutputError, description, mURL, failureReason, recoverySuggestion);		}				return false;	}	CFDictionarySetValue(mMetadata, kFormatNameKey, CFSTR("Ogg Vorbis"));	if(file.audioProperties())		AddAudioPropertiesToDictionary(mMetadata, file.audioProperties());		if(file.tag())		AddXiphCommentToDictionary(mMetadata, mPictures, file.tag());	return true;}
开发者ID:Read-Write,项目名称:SFBAudioEngine,代码行数:42,


示例22: FLACDecoder

//.........这里部分代码省略.........			decoder = new CoreAudioDecoder(inputSource);			if(AutomaticallyOpenDecoders() && !decoder->Open(error)) {				decoder->mInputSource = NULL;				delete decoder, decoder = NULL;			}		}#if 0		if(releaseMIMEType)			CFRelease(mimeType), mimeType = NULL;#endif		if(decoder)			return decoder;	}	// If no MIME type was specified, use the extension-based resolvers	CFURLRef inputURL = inputSource->GetURL();	if(!inputURL)		return NULL;	CFStringRef pathExtension = CFURLCopyPathExtension(inputURL);	if(!pathExtension) {		if(error) {			CFMutableDictionaryRef errorDictionary = CFDictionaryCreateMutable(kCFAllocatorDefault, 																			   32,																			   &kCFTypeDictionaryKeyCallBacks,																			   &kCFTypeDictionaryValueCallBacks);			CFStringRef displayName = CFURLCopyLastPathComponent(inputURL);			CFStringRef errorString = CFStringCreateWithFormat(kCFAllocatorDefault, 															   NULL, 															   CFCopyLocalizedString(CFSTR("The type of the file “%@” could not be determined."), ""), 															   displayName);			CFDictionarySetValue(errorDictionary, 								 kCFErrorLocalizedDescriptionKey, 								 errorString);			CFDictionarySetValue(errorDictionary, 								 kCFErrorLocalizedFailureReasonKey, 								 CFCopyLocalizedString(CFSTR("Unknown file type"), ""));			CFDictionarySetValue(errorDictionary, 								 kCFErrorLocalizedRecoverySuggestionKey, 								 CFCopyLocalizedString(CFSTR("The file's extension may be missing or may not match the file's type."), ""));			CFRelease(errorString), errorString = NULL;			CFRelease(displayName), displayName = NULL;			*error = CFErrorCreate(kCFAllocatorDefault, 								   InputSourceErrorDomain, 								   InputSourceFileNotFoundError,								   errorDictionary);						CFRelease(errorDictionary), errorDictionary = NULL;						}		return NULL;	}	// TODO: Some extensions (.oga for example) support multiple audio codecs (Vorbis, FLAC, Speex)	// and if openDecoder is false the wrong decoder type may be returned, since the file isn't analyzed	// until Open() is called	
开发者ID:xingskycn,项目名称:SFBAudioEngine,代码行数:66,


示例23: NPServerInit

void NPServerInit (void){	npserver.listenloop = false;	npserver.phasecount = 0;	npserver.phasespan  = 0;	npserver.header     = 0;	npserver.socket     = -1;	npserver.numplayers = 0;	for (int i = 0; i < NP_MAX_PLAYERS; i++)	{		for (int j = 0; j < 64; j++)		{			npactvpad[i][j] = 0;			nprecvpad[i][j] = 0;			npsendpad[i][j] = 0;		}	}	for (int j = 0; j < 64; j++)		npcachpad[j] = 0;	for (int c = 0; c < NP_MAX_PLAYERS; c++)	{		npplayer[c].padloop = false;		npplayer[c].exitsgn = false;		npplayer[c].online  = false;		npplayer[c].ready   = false;		npplayer[c].socket  = -1;		npplayer[c].client  = 0;		npplayer[c].player  = 0;		npplayer[c].ip[0]   = 0;		npplayer[c].name[0] = 0;	}	npplayer[0].online = true;	npplayer[0].ready  = true;	char	name[256];	if (gethostname(name, 256) == 0)	{		struct hostent	*hn;		if ((hn = gethostbyname(name)) != NULL)		{			struct in_addr	addr;			memcpy(&addr, hn->h_addr_list[0], sizeof(struct in_addr));			strcpy(npplayer[0].ip, inet_ntoa(addr));		}		else			strcpy(npplayer[0].ip, "unknown");	}	else		strcpy(npplayer[0].ip, "unknown");	CFStringRef	ref;	ref = CFCopyLocalizedString(CFSTR("NPServerName"), "NPServer");	if (ref)	{		Boolean	r;		r = CFStringGetCString(ref, npplayer[0].name, 256, MAC_PATH_ENCODING);		if (!r)			strcpy(npplayer[0].name, "unknown");		CFRelease(ref);	}	else		strcpy(npplayer[0].name, "unknown");}
开发者ID:OV2,项目名称:snes9x-libsnes,代码行数:68,


示例24: NPServerDialogTimerHandler

static pascal void NPServerDialogTimerHandler (EventLoopTimerRef inTimer, void *userData){	WindowRef	window = (WindowRef) userData;	CFStringRef	ref;	HIViewRef	ctl, root;	HIViewID	cid;	int			n = 0;	root = HIViewGetRoot(window);	for (int c = 0; c < NP_MAX_PLAYERS; c++)	{		cid.id = c;		cid.signature = 'Pnum';		HIViewFindByID(root, cid, &ctl);		if (npplayer[c].ready)		{			char	num[4];			num[0] = '1' + n;			num[1] = 'P';			num[2] = 0;			SetStaticTextCStr(ctl, num, true);			n++;		}		cid.signature = 'IP__';		HIViewFindByID(root, cid, &ctl);		if (npplayer[c].online)		{			ref = CFStringCreateWithCString(kCFAllocatorDefault, npplayer[c].ip, MAC_PATH_ENCODING);			if (ref)			{				SetStaticTextCFString(ctl, ref, true);				CFRelease(ref);			}			else				SetStaticTextCFString(ctl, CFSTR("unknown"), true);		}		else			SetStaticTextCFString(ctl, CFSTR(""), true);		cid.signature = 'Name';		HIViewFindByID(root, cid, &ctl);		if (npplayer[c].online)		{			ref = CFStringCreateWithCString(kCFAllocatorDefault, npplayer[c].name, MAC_PATH_ENCODING);			if (ref)			{				SetStaticTextCFString(ctl, ref, true);				CFRelease(ref);			}			else				SetStaticTextCFString(ctl, CFSTR("unknown"), true);		}		else			SetStaticTextCFString(ctl, CFSTR(""), true);		cid.signature = 'Stat';		HIViewFindByID(root, cid, &ctl);		if (npplayer[c].online)		{			if (npplayer[c].ready)				ref = CFCopyLocalizedString(CFSTR("NPReady"), "NPReady");			else				ref = CFCopyLocalizedString(CFSTR("NPConnecting"), "NPConnecting");			if (ref)			{				SetStaticTextCFString(ctl, ref, true);				CFRelease(ref);			}			else				SetStaticTextCFString(ctl, CFSTR("error"), true);		}		else			SetStaticTextCFString(ctl, CFSTR(""), true);	}	switch (npserver.dialogprocess)	{		case kNPSDialogNone:			break;		case kNPSDialogInit:			NPNotification("  kNPSDialogInit", -1);			npserver.dialogprocess = kNPSDialogNone;			NPServerBeginListenLoop();			break;		case kNPSDialogProcess:			NPNotification("  kNPSDialogProcess", -1);			npserver.dialogprocess = kNPSDialogNone;			NPServerEndListenLoop();			cid.id = 0;			cid.signature = 'Chse';			HIViewFindByID(root, cid, &ctl);			HIViewSetVisible(ctl, true);			NPServerDetachProcessThread();//.........这里部分代码省略.........
开发者ID:OV2,项目名称:snes9x-libsnes,代码行数:101,


示例25: stream

bool TrueAudioMetadata::WriteMetadata(CFErrorRef *error){	UInt8 buf [PATH_MAX];	if(!CFURLGetFileSystemRepresentation(mURL, false, buf, PATH_MAX))		return false;	// TODO: Use unique_ptr once the switch to C++11 STL is made	std::auto_ptr<TagLib::FileStream> stream(new TagLib::FileStream(reinterpret_cast<const char *>(buf)));	if(!stream->isOpen()) {		if(error) {			CFStringRef description = CFCopyLocalizedString(CFSTR("The file “%@” could not be opened for writing."), "");			CFStringRef failureReason = CFCopyLocalizedString(CFSTR("Input/output error"), "");			CFStringRef recoverySuggestion = CFCopyLocalizedString(CFSTR("The file may have been renamed, moved, deleted, or you may not have appropriate permissions."), "");			*error = CreateErrorForURL(AudioMetadataErrorDomain, AudioMetadataInputOutputError, description, mURL, failureReason, recoverySuggestion);			CFRelease(description), description = nullptr;			CFRelease(failureReason), failureReason = nullptr;			CFRelease(recoverySuggestion), recoverySuggestion = nullptr;		}		return false;	}	TagLib::TrueAudio::File file(stream.get(), false);	if(!file.isValid()) {		if(error) {			CFStringRef description = CFCopyLocalizedString(CFSTR("The file “%@” is not a valid True Audio file."), "");			CFStringRef failureReason = CFCopyLocalizedString(CFSTR("Not a True Audio file"), "");			CFStringRef recoverySuggestion = CFCopyLocalizedString(CFSTR("The file's extension may not match the file's type."), "");						*error = CreateErrorForURL(AudioMetadataErrorDomain, AudioMetadataInputOutputError, description, mURL, failureReason, recoverySuggestion);						CFRelease(description), description = nullptr;			CFRelease(failureReason), failureReason = nullptr;			CFRelease(recoverySuggestion), recoverySuggestion = nullptr;		}		return false;	}	// ID3v1 tags are only written if present, but ID3v2 tags are always written	if(file.ID3v1Tag())		SetID3v1TagFromMetadata(*this, file.ID3v1Tag());	SetID3v2TagFromMetadata(*this, file.ID3v2Tag(true));	if(!file.save()) {		if(error) {			CFStringRef description = CFCopyLocalizedString(CFSTR("The file “%@” is not a valid True Audio file."), "");			CFStringRef failureReason = CFCopyLocalizedString(CFSTR("Unable to write metadata"), "");			CFStringRef recoverySuggestion = CFCopyLocalizedString(CFSTR("The file's extension may not match the file's type."), "");						*error = CreateErrorForURL(AudioMetadataErrorDomain, AudioMetadataInputOutputError, description, mURL, failureReason, recoverySuggestion);						CFRelease(description), description = nullptr;			CFRelease(failureReason), failureReason = nullptr;			CFRelease(recoverySuggestion), recoverySuggestion = nullptr;		}		return false;	}	MergeChangedMetadataIntoMetadata();	return true;}
开发者ID:burningneutron,项目名称:SFBAudioEngine,代码行数:68,


示例26: CFDictionaryRemoveAllValues

bool MonkeysAudioMetadata::ReadMetadata(CFErrorRef *error){	// Start from scratch	CFDictionaryRemoveAllValues(mMetadata);	CFDictionaryRemoveAllValues(mChangedMetadata);		UInt8 buf [PATH_MAX];	if(!CFURLGetFileSystemRepresentation(mURL, false, buf, PATH_MAX))		return false;		TagLib::IOStream *stream = new TagLib::FileStream(reinterpret_cast<const char *>(buf), true);	TagLib::APE::File file(stream);		if(!file.isValid()) {		if(NULL != error) {			CFMutableDictionaryRef errorDictionary = CFDictionaryCreateMutable(kCFAllocatorDefault, 																			   0,																			   &kCFTypeDictionaryKeyCallBacks,																			   &kCFTypeDictionaryValueCallBacks);						CFStringRef displayName = CreateDisplayNameForURL(mURL);			CFStringRef errorString = CFStringCreateWithFormat(kCFAllocatorDefault, 															   NULL, 															   CFCopyLocalizedString(CFSTR("The file “%@” is not a valid Monkey's Audio file."), ""), 															   displayName);						CFDictionarySetValue(errorDictionary, 								 kCFErrorLocalizedDescriptionKey, 								 errorString);						CFDictionarySetValue(errorDictionary, 								 kCFErrorLocalizedFailureReasonKey, 								 CFCopyLocalizedString(CFSTR("Not a Monkey's Audio file"), ""));						CFDictionarySetValue(errorDictionary, 								 kCFErrorLocalizedRecoverySuggestionKey, 								 CFCopyLocalizedString(CFSTR("The file's extension may not match the file's type."), ""));						CFRelease(errorString), errorString = NULL;			CFRelease(displayName), displayName = NULL;						*error = CFErrorCreate(kCFAllocatorDefault, 								   AudioMetadataErrorDomain, 								   AudioMetadataInputOutputError, 								   errorDictionary);						CFRelease(errorDictionary), errorDictionary = NULL;						}				return false;	}		CFDictionarySetValue(mMetadata, kPropertiesFormatNameKey, CFSTR("Monkey's Audio"));		if(file.audioProperties()) {		AddAudioPropertiesToDictionary(mMetadata, file.audioProperties());				if(0 != file.audioProperties()->bitsPerSample()) {			int value = file.audioProperties()->bitsPerSample();			CFNumberRef bitsPerChannel = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &value);			CFDictionarySetValue(mMetadata, kPropertiesBitsPerChannelKey, bitsPerChannel);			CFRelease(bitsPerChannel), bitsPerChannel = NULL;		}	}	if(file.ID3v1Tag())		AddID3v1TagToDictionary(mMetadata, file.ID3v1Tag());	if(file.APETag())		AddAPETagToDictionary(mMetadata, file.APETag());	return true;}
开发者ID:hjzc,项目名称:SFBAudioEngine,代码行数:73,


示例27: file

bool MonkeysAudioMetadata::WriteMetadata(CFErrorRef *error){	UInt8 buf [PATH_MAX];	if(!CFURLGetFileSystemRepresentation(mURL, false, buf, PATH_MAX))		return false;		TagLib::IOStream *stream = new TagLib::FileStream(reinterpret_cast<const char *>(buf));	TagLib::APE::File file(stream, false);		if(!file.isValid()) {		if(error) {			CFMutableDictionaryRef errorDictionary = CFDictionaryCreateMutable(kCFAllocatorDefault, 																			   0,																			   &kCFTypeDictionaryKeyCallBacks,																			   &kCFTypeDictionaryValueCallBacks);						CFStringRef displayName = CreateDisplayNameForURL(mURL);			CFStringRef errorString = CFStringCreateWithFormat(kCFAllocatorDefault, 															   NULL, 															   CFCopyLocalizedString(CFSTR("The file “%@” is not a valid Mpnkey's Audio file."), ""), 															   displayName);						CFDictionarySetValue(errorDictionary, 								 kCFErrorLocalizedDescriptionKey, 								 errorString);						CFDictionarySetValue(errorDictionary, 								 kCFErrorLocalizedFailureReasonKey, 								 CFCopyLocalizedString(CFSTR("Not a Mpnkey's Audio file"), ""));						CFDictionarySetValue(errorDictionary, 								 kCFErrorLocalizedRecoverySuggestionKey, 								 CFCopyLocalizedString(CFSTR("The file's extension may not match the file's type."), ""));						CFRelease(errorString), errorString = NULL;			CFRelease(displayName), displayName = NULL;						*error = CFErrorCreate(kCFAllocatorDefault, 								   AudioMetadataErrorDomain, 								   AudioMetadataInputOutputError, 								   errorDictionary);						CFRelease(errorDictionary), errorDictionary = NULL;						}				return false;	}	// Although both ID3v1 and APE tags are read, only APE tags are written	if(file.APETag())		SetAPETagFromMetadata(*this, file.APETag());	if(!file.save()) {		if(error) {			CFMutableDictionaryRef errorDictionary = CFDictionaryCreateMutable(kCFAllocatorDefault, 																			   0,																			   &kCFTypeDictionaryKeyCallBacks,																			   &kCFTypeDictionaryValueCallBacks);						CFStringRef displayName = CreateDisplayNameForURL(mURL);			CFStringRef errorString = CFStringCreateWithFormat(kCFAllocatorDefault, 															   NULL, 															   CFCopyLocalizedString(CFSTR("The file “%@” is not a valid Mpnkey's Audio file."), ""), 															   displayName);						CFDictionarySetValue(errorDictionary, 								 kCFErrorLocalizedDescriptionKey, 								 errorString);						CFDictionarySetValue(errorDictionary, 								 kCFErrorLocalizedFailureReasonKey, 								 CFCopyLocalizedString(CFSTR("Unable to write metadata"), ""));						CFDictionarySetValue(errorDictionary, 								 kCFErrorLocalizedRecoverySuggestionKey, 								 CFCopyLocalizedString(CFSTR("The file's extension may not match the file's type."), ""));						CFRelease(errorString), errorString = NULL;			CFRelease(displayName), displayName = NULL;						*error = CFErrorCreate(kCFAllocatorDefault, 								   AudioMetadataErrorDomain, 								   AudioMetadataInputOutputError, 								   errorDictionary);						CFRelease(errorDictionary), errorDictionary = NULL;						}				return false;	}		MergeChangedMetadataIntoMetadata();		return true;}
开发者ID:hjzc,项目名称:SFBAudioEngine,代码行数:95,


示例28: LOGGER_WARNING

bool OggSpeexDecoder::Open(CFErrorRef *error){	if(IsOpen()) {		LOGGER_WARNING("org.sbooth.AudioEngine.AudioDecoder.OggSpeex", "Open() called on an AudioDecoder that is already open");				return true;	}	// Ensure the input source is open	if(!mInputSource->IsOpen() && !mInputSource->Open(error))		return false;	// Initialize Ogg data struct	ogg_sync_init(&mOggSyncState);	// Get the ogg buffer for writing	char *data = ogg_sync_buffer(&mOggSyncState, READ_SIZE_BYTES);		// Read bitstream from input file	ssize_t bytesRead = GetInputSource()->Read(data, READ_SIZE_BYTES);	if(-1 == bytesRead) {		if(error) {			CFMutableDictionaryRef errorDictionary = CFDictionaryCreateMutable(kCFAllocatorDefault, 																			   0,																			   &kCFTypeDictionaryKeyCallBacks,																			   &kCFTypeDictionaryValueCallBacks);						CFStringRef displayName = CreateDisplayNameForURL(mInputSource->GetURL());			CFStringRef errorString = CFStringCreateWithFormat(kCFAllocatorDefault, 															   NULL, 															   CFCopyLocalizedString(CFSTR("The file “%@” could not be read."), ""), 															   displayName);						CFDictionarySetValue(errorDictionary, 								 kCFErrorLocalizedDescriptionKey, 								 errorString);						CFDictionarySetValue(errorDictionary, 								 kCFErrorLocalizedFailureReasonKey, 								 CFCopyLocalizedString(CFSTR("Read error"), ""));						CFDictionarySetValue(errorDictionary, 								 kCFErrorLocalizedRecoverySuggestionKey, 								 CFCopyLocalizedString(CFSTR("Unable to read from the input file."), ""));						CFRelease(errorString), errorString = NULL;			CFRelease(displayName), displayName = NULL;						*error = CFErrorCreate(kCFAllocatorDefault, 								   AudioDecoderErrorDomain, 								   AudioDecoderInputOutputError, 								   errorDictionary);						CFRelease(errorDictionary), errorDictionary = NULL;						}				ogg_sync_destroy(&mOggSyncState);		return false;	}		// Tell the sync layer how many bytes were written to its internal buffer	int result = ogg_sync_wrote(&mOggSyncState, bytesRead);	if(-1 == result) {		if(error) {			CFMutableDictionaryRef errorDictionary = CFDictionaryCreateMutable(kCFAllocatorDefault, 																			   0,																			   &kCFTypeDictionaryKeyCallBacks,																			   &kCFTypeDictionaryValueCallBacks);						CFStringRef displayName = CreateDisplayNameForURL(mInputSource->GetURL());			CFStringRef errorString = CFStringCreateWithFormat(kCFAllocatorDefault, 															   NULL, 															   CFCopyLocalizedString(CFSTR("The file “%@” does not appear to be an Ogg file."), ""), 															   displayName);						CFDictionarySetValue(errorDictionary, 								 kCFErrorLocalizedDescriptionKey, 								 errorString);						CFDictionarySetValue(errorDictionary, 								 kCFErrorLocalizedFailureReasonKey, 								 CFCopyLocalizedString(CFSTR("Not an Ogg file"), ""));						CFDictionarySetValue(errorDictionary, 								 kCFErrorLocalizedRecoverySuggestionKey, 								 CFCopyLocalizedString(CFSTR("The file's extension may not match the file's type."), ""));						CFRelease(errorString), errorString = NULL;			CFRelease(displayName), displayName = NULL;						*error = CFErrorCreate(kCFAllocatorDefault, 								   AudioDecoderErrorDomain, 								   AudioDecoderFileFormatNotRecognizedError, 								   errorDictionary);						CFRelease(errorDictionary), errorDictionary = NULL;						}				ogg_sync_destroy(&mOggSyncState);		return false;	}//.........这里部分代码省略.........
开发者ID:hjzc,项目名称:SFBAudioEngine,代码行数:101,


示例29: mpc_demux_init

bool SFB::Audio::MusepackDecoder::_Open(CFErrorRef *error){	UInt8 buf [PATH_MAX];	if(!CFURLGetFileSystemRepresentation(mInputSource->GetURL(), FALSE, buf, PATH_MAX))		return false;	mReader.read = read_callback;	mReader.seek = seek_callback;	mReader.tell = tell_callback;	mReader.get_size = get_size_callback;	mReader.canseek = canseek_callback;	mReader.data = this;		mDemux = mpc_demux_init(&mReader);	if(nullptr == mDemux) {		if(error) {			SFB::CFString description = CFCopyLocalizedString(CFSTR("The file “%@” is not a valid Musepack file."), "");			SFB::CFString failureReason = CFCopyLocalizedString(CFSTR("Not a Musepack file"), "");			SFB::CFString recoverySuggestion = CFCopyLocalizedString(CFSTR("The file's extension may not match the file's type."), "");						*error = CreateErrorForURL(Decoder::ErrorDomain, Decoder::InputOutputError, description, mInputSource->GetURL(), failureReason, recoverySuggestion);		}		mpc_reader_exit_stdio(&mReader);				return false;	}		// Get input file information	mpc_streaminfo streaminfo;	mpc_demux_get_info(mDemux, &streaminfo);		mTotalFrames				= mpc_streaminfo_get_length_samples(&streaminfo);		// Canonical Core Audio format	mFormat.mFormatID			= kAudioFormatLinearPCM;	mFormat.mFormatFlags		= kAudioFormatFlagsNativeFloatPacked | kAudioFormatFlagIsNonInterleaved;		mFormat.mSampleRate			= streaminfo.sample_freq;	mFormat.mChannelsPerFrame	= streaminfo.channels;	mFormat.mBitsPerChannel		= 8 * sizeof(float);		mFormat.mBytesPerPacket		= (mFormat.mBitsPerChannel / 8);	mFormat.mFramesPerPacket	= 1;	mFormat.mBytesPerFrame		= mFormat.mBytesPerPacket * mFormat.mFramesPerPacket;		mFormat.mReserved			= 0;		// Set up the source format	mSourceFormat.mFormatID				= 'MUSE';		mSourceFormat.mSampleRate			= streaminfo.sample_freq;	mSourceFormat.mChannelsPerFrame		= streaminfo.channels;		mSourceFormat.mFramesPerPacket		= (1 << streaminfo.block_pwr);		// Setup the channel layout	switch(streaminfo.channels) {		case 1:		mChannelLayout = ChannelLayout::ChannelLayoutWithTag(kAudioChannelLayoutTag_Mono);			break;		case 2:		mChannelLayout = ChannelLayout::ChannelLayoutWithTag(kAudioChannelLayoutTag_Stereo);		break;		case 4:		mChannelLayout = ChannelLayout::ChannelLayoutWithTag(kAudioChannelLayoutTag_Quadraphonic);	break;	}		// Allocate the buffer list	if(!mBufferList.Allocate(mFormat, MPC_FRAME_LENGTH)) {		if(error)			*error = CFErrorCreate(kCFAllocatorDefault, kCFErrorDomainPOSIX, ENOMEM, nullptr);		mpc_demux_exit(mDemux), mDemux = nullptr;		mpc_reader_exit_stdio(&mReader);				return false;	}	for(UInt32 i = 0; i < mBufferList->mNumberBuffers; ++i)		mBufferList->mBuffers[i].mDataByteSize = 0;	return true;}
开发者ID:JanX2,项目名称:SFBAudioEngine,代码行数:79,



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


C++ CFDataCreate函数代码示例
C++ CFCUtil_die函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。