本文整理汇总了C#中CHANNEL_CALLBACK类的典型用法代码示例。如果您正苦于以下问题:C#CHANNEL_CALLBACK类的具体用法?C#CHANNEL_CALLBACK怎么用?C#CHANNEL_CALLBACK使用的例子?这里精选的类代码示例或许可以为您提供帮助。
示例1:SetCallback
publicvoidSetCallback(Action
callback)
{
//Removepreviouscallback
RemoveCallback();
//Passinginnulltosetremovesanyexistingcallbacks
if(callback==null)
return;
//Keepareferencetothecallbackhandler
//Createacallbackwhichwrapstheactualcallback
//Thiswillcleanitselfupwhenthe"end"eventhappens
varcallbackFunction=newCHANNEL_CALLBACK((channelraw,controltype,type,commanddata1,commanddata2)=>
{
//Calltherealcallback
callback((ChannelControlCallbackType)type,commanddata1,commanddata2);
//Cleanupasnecessary
if(type==CHANNELCONTROL_CALLBACK_TYPE.END)
{
//Endofsound,wecanreleaseourcallbackhandlenow
_callbackHandle=null;
}
returnRESULT.OK;
});
//SetthecallbackintoFMOD
_fmod.setCallback(callbackFunction).Check();
//Holdthedelegateobjectinmemory
_callbackHandle=callbackFunction;
}
原文链接:http://www.jxszl.com/biancheng/C/556723.html