/** * <summary>ACBデータの非同期ロード</summary> * <param name="acbData">ACBデータのバイト配列</param> * <param name="awbBinder">AWB用バインダオブジェクト</param> * <param name="awbPath">AWBファイルのパス</param> * <param name="loadAwbOnMemory">AWBファイルをメモリ上にロードするか(オプション)</param> * <returns>CriAtomExAcbLoaderオブジェクト</returns> * \par 説明: * ACBデータの非同期ロードを開始します。<br/> * 戻り値に対して ::CriAtomExAcbLoader::GetStatus を呼び出してロード状態を確認し、 * 状態が Complete に遷移したら、 ::CriAtomExAcbLoader::MoveAcb により ::CriAtomExAcb が取得可能です。<br> */ public static CriAtomExAcbLoader LoadAcbDataAsync(byte[] acbData, CriFsBinder awbBinder, string awbPath, bool loadAwbOnMemory = false) { /* バージョン番号が不正なライブラリではキューシートをロードしない */ /* 備考)不正に差し替えられたsoファイルを使用している可能性あり。 */ bool isCorrectVersion = CriWare.CheckBinaryVersionCompatibility(); if (isCorrectVersion == false) { return(null); } IntPtr binderHandle = (awbBinder != null) ? awbBinder.nativeHandle : IntPtr.Zero; LoaderConfig config = new LoaderConfig(); config.shouldLoadAwbOnMemory = loadAwbOnMemory; IntPtr handle = criAtomExAcbLoader_Create(ref config); if (handle == IntPtr.Zero) { return(null); } bool result = criAtomExAcbLoader_LoadAcbDataAsync(handle, acbData, acbData.Length, binderHandle, awbPath); if (result == false) { return(null); } return(new CriAtomExAcbLoader(handle, acbData)); }
/* 初期化実行チェック関数 */ public static bool IsInitialized() { if (initializationCount > 0) { return(true); } else { /* 現在のランタイムのバージョンが正しいかチェック */ CriWare.CheckBinaryVersionCompatibility(); return(false); } }
/* オブジェクト作成時の処理 */ void Awake() { /* 現在のランタイムのバージョンが正しいかチェック */ CriWare.CheckBinaryVersionCompatibility(); if (dontInitializeOnAwake) { /* フラグが立っていた場合はAwakeでは初期化を行わない */ return; } /* プラグインの初期化 */ this.Initialize(); }
/** * <summary>ACBファイルのロード</summary> * <param name="binder">バインダオブジェクト</param> * <param name="acbPath">ACBファイルのパス</param> * <param name="awbPath">AWBファイルのパス</param> * <returns>CriAtomExAcbオブジェクト</returns> * \par 説明: * ACBファイルをロードし、キュー再生に必要な情報を取り込みます。<br/> * <br/> * 第2引数の acbPath にはオンメモリ再生用のACBファイルのパスを、 * 第3引数の awbPath にはストリーム再生用のAWBファイルのパスを、それぞれ指定します。<br/> * (オンメモリ再生のみのACBデータをロードする場合、 * awbPath にセットした値は無視されます。)<br/> * <br/> * ACBファイルとAWBファイルを一つのCPKファイルにパッキングしている場合、 * 第1引数( binder )にCPKファイルをバインドしたCriFsBinderオブジェクトを指定する必要があります。<br/> * <br/> * ACBファイルをロードすると、ACBデータにアクセスするためのCriAtomExAcbオブジェクト * ( ::CriAtomExAcb )が返されます。<br/> * AtomExプレーヤに対し、 ::CriAtomExPlayer::SetCue 関数でACBハンドル、 * および再生するキュー名を指定することで、 * ACBファイル内のキューを再生することが可能です。<br/> * <br/> * リードエラー等によりACBファイルのロードに失敗した場合、 * 本関数は戻り値として null を返します。<br/> * \attention * 本関数を実行する前に、ライブラリを初期化しておく必要があります。<br/> * <br/> * ACBハンドルは内部的にバインダ( CriFsBinder )を確保します。<br/> * ACBファイルをロードする場合、 * ACBファイル数分のバインダが確保できる設定でライブラリを初期化する必要があります。<br/> * <br/> * 本関数は完了復帰型の関数です。<br/> * ACBファイルのロードにかかる時間は、プラットフォームによって異なります。<br/> * ゲームループ等の画面更新が必要なタイミングで本関数を実行するとミリ秒単位で * 処理がブロックされ、フレーム落ちが発生する恐れがあります。<br/> * ACBファイルのロードは、シーンの切り替わり等、負荷変動を許容できる * タイミングで行うようお願いいたします。<br/> * \sa criAtomExAcb_CalculateWorkSizeForLoadAcbFile, CriAtomExAcbHn, criAtomExPlayer_SetCueId */ public static CriAtomExAcb LoadAcbFile(CriFsBinder binder, string acbPath, string awbPath) { /* バージョン番号が不正なライブラリではキューシートをロードしない */ /* 備考)不正に差し替えられたsoファイルを使用している可能性あり。 */ bool isCorrectVersion = CriWare.CheckBinaryVersionCompatibility(); if (isCorrectVersion == false) { return(null); } IntPtr binderHandle = (binder != null) ? binder.nativeHandle : IntPtr.Zero; IntPtr handle = criAtomExAcb_LoadAcbFile( binderHandle, acbPath, binderHandle, awbPath, IntPtr.Zero, 0); if (handle == IntPtr.Zero) { return(null); } return(new CriAtomExAcb(handle, null)); }
/* オブジェクト作成時の処理 */ void Awake() { /* 現在のランタイムのバージョンが正しいかチェック */ CriWare.CheckBinaryVersionCompatibility(); /* 初期化カウンタの更新 */ initializationCount++; if (initializationCount != 1) { /* CriWareInitializer自身による多重初期化は許可しない */ GameObject.Destroy(this); return; } /* CRI File Systemライブラリの初期化 */ if (initializesFileSystem) { CriFsPlugin.SetConfigParameters( fileSystemConfig.numberOfLoaders, fileSystemConfig.numberOfBinders, fileSystemConfig.numberOfInstallers, (fileSystemConfig.installBufferSize * 1024), fileSystemConfig.maxPath ); { /* Ver.2.03.03 以前は 0 がデフォルト値だったことの互換性維持のための処理 */ if (fileSystemConfig.androidDeviceReadBitrate == 0) { fileSystemConfig.androidDeviceReadBitrate = CriFsConfig.defaultAndroidDeviceReadBitrate; } } CriFsPlugin.SetConfigAdditionalParameters_ANDROID(fileSystemConfig.androidDeviceReadBitrate); CriFsPlugin.InitializeLibrary(); if (fileSystemConfig.userAgentString.Length != 0) { CriFsUtility.SetUserAgentString(fileSystemConfig.userAgentString); } } /* CRI Atomライブラリの初期化 */ if (initializesAtom) { /* 初期化処理の実行 */ CriAtomPlugin.SetConfigParameters( (int)Math.Max(atomConfig.maxVirtualVoices, CriAtomPlugin.GetRequiredMaxVirtualVoices(atomConfig)), atomConfig.standardVoicePoolConfig.memoryVoices, atomConfig.standardVoicePoolConfig.streamingVoices, atomConfig.hcaMxVoicePoolConfig.memoryVoices, atomConfig.hcaMxVoicePoolConfig.streamingVoices, atomConfig.outputSamplingRate, atomConfig.usesInGamePreview, atomConfig.serverFrequency); CriAtomPlugin.SetConfigAdditionalParameters_IOS( (uint)Math.Max(atomConfig.iosBufferingTime, 16), atomConfig.iosOverrideIPodMusic ); { /* Ver.2.03.03 以前は 0 がデフォルト値だったことの互換性維持のための処理 */ if (atomConfig.androidBufferingTime == 0) { atomConfig.androidBufferingTime = (int)(4 * 1000.0 / atomConfig.serverFrequency); } if (atomConfig.androidStartBufferingTime == 0) { atomConfig.androidStartBufferingTime = (int)(3 * 1000.0 / atomConfig.serverFrequency); } } CriAtomPlugin.SetConfigAdditionalParameters_ANDROID( atomConfig.androidLowLatencyStandardVoicePoolConfig.memoryVoices, atomConfig.androidLowLatencyStandardVoicePoolConfig.streamingVoices, atomConfig.androidBufferingTime, atomConfig.androidStartBufferingTime); CriAtomPlugin.InitializeLibrary(); if (atomConfig.useRandomSeedWithTime == true) { /* 時刻を乱数種に設定 */ CriAtomEx.SetRandomSeed((uint)System.DateTime.Now.Ticks); } /* ACFファイル指定時は登録 */ if (atomConfig.acfFileName.Length != 0) { CriAtomEx.RegisterAcf(null, Path.Combine(CriWare.streamingAssetsPath, atomConfig.acfFileName)); } } /* CRI Manaライブラリの初期化 */ if (initializesMana) { CriManaPlugin.SetConfigParameters(manaConfig.numberOfDecoders, manaConfig.numberOfMaxEntries, manaConfig.enableCuePoint); CriManaPlugin.InitializeLibrary(); } /* シーンチェンジ後もオブジェクトを維持するかどうかの設定 */ if (dontDestroyOnLoad) { DontDestroyOnLoad(transform.gameObject); DontDestroyOnLoad(CriWare.managerObject); } }