예제 #1
0
        //----- method -----

        public void Initialize(SoundParam defaultSoundParam)
        {
            if (initialized)
            {
                return;
            }

            this.defaultSoundParam = defaultSoundParam;

            player = new CriAtomExPlayer();

            soundParams        = new Dictionary <SoundType, SoundParam>();
            managedSoundSheets = new Dictionary <string, SoundSheet>();
            soundElements      = new List <SoundElement>();

            // デフォルトのサウンド設定を適用.
            SetSoundParam();

            // サウンドイベントを受信.
            CriAtomExSequencer.SetEventCallback(SoundEventCallback, SoundEventSeparator.ToString());

            // サウンドの状態更新.
            Observable.EveryEndOfFrame().Subscribe(_ => UpdateElement());

            // 一定周期で未使用状態になったAcbの解放を行う.
            Observable.Interval(TimeSpan.FromSeconds(5f)).Subscribe(_ => ReleaseSoundSheet());

            initialized = true;
        }
예제 #2
0
	/* プラグイン内部用API */
	public static void SetEventCallback(CriAtomExSequencer.EventCbFunc func, string separator)
	{

#if CRIWARE_SUPPORT_SEQUENCE_CALLBACK
		/* ネイティブプラグインに関数ポインタを登録 */
		IntPtr ptr = IntPtr.Zero;
		eventUserCbFunc = func;
		if (func != null) {
	#if CRIWARE_CALLBACK_IMPL_UNITYSENDMESSAGE
			ptr = IntPtr.Zero;
	#elif CRIWARE_CALLBACK_IMPL_NATIVE2MANAGED
			CriAtomExSequencer.EventCbFunc localFunc;
			localFunc = new CriAtomExSequencer.EventCbFunc(CriAtom.instance.EventCallbackFromNative);
			ptr = Marshal.GetFunctionPointerForDelegate(localFunc);
	#endif
			CriAtomPlugin.criAtomUnitySeqencer_SetEventCallback(ptr, CriAtom.instance.gameObject.name, "EventCallbackFromNative", separator);		
		}	
#elif CRIWARE_UNSUPPORT_SEQUENCE_CALLBACK
		Debug.LogError("This platform does not support event callback feature.");
#endif
	}