Return to Snippet

Revision: 41740
at February 23, 2011 01:30 by takezou621


Initial Code
-(void)playSystemSound:(NSURL*)fileURL{
	SystemSoundID	systemSoundID;
	OSStatus		err;
	
	err = AudioServicesCreateSystemSoundID((CFURLRef) fileURL,
											&systemSoundID);
	
	if(err){
		NSLog(@"AudioServicesCreateSystemSoundID err = %d",err);
		return;
	}
	
	// systemSoundCompletionProcFunctionはサウンド再生完了時に呼び出されるコールバック関数
	AudioServicesAddSystemSoundCompletion(systemSoundID,
											NULL,
											NULL,
											systemSoundCompletionProcFunction,
											NULL);
	// コールバック関数を削除
	//AudioServicesRemoveSystemSoundCompletion(systemSoundID);
											
	// 再生開始
	AudioServicesPlaySystemSound(systemSoundID);

}

Initial URL


Initial Description


Initial Title
Use System Sound Services

Initial Tags


Initial Language
Objective C