public static void Initialize() { CriAtomConfig atomConfig = new CriAtomConfig(); CriAtomPlugin.SetConfigParameters( Math.Max(atomConfig.maxVirtualVoices, CriAtomPlugin.GetRequiredMaxVirtualVoices(atomConfig)), atomConfig.maxVoiceLimitGroups, atomConfig.maxCategories, atomConfig.standardVoicePoolConfig.memoryVoices, atomConfig.standardVoicePoolConfig.streamingVoices, atomConfig.hcaMxVoicePoolConfig.memoryVoices, atomConfig.hcaMxVoicePoolConfig.streamingVoices, atomConfig.outputSamplingRate, atomConfig.asrOutputChannels, atomConfig.usesInGamePreview, atomConfig.serverFrequency, atomConfig.maxParameterBlocks, atomConfig.categoriesPerPlayback, atomConfig.maxBuses, false); CriAtomPlugin.SetConfigAdditionalParameters_PC( atomConfig.pcBufferingTime ); CriAtomPlugin.InitializeLibrary(); }
public static void InitializePluginForEditor() { if (CriAtomPlugin.IsLibraryInitialized()) { return; } var criInitCom = FindObjectOfType <CriWareInitializer>(); if (criInitCom != null) { if (criInitCom.initializesFileSystem) { CriFsConfig config = criInitCom.fileSystemConfig; CriFsPlugin.SetConfigParameters( config.numberOfLoaders, config.numberOfBinders, config.numberOfInstallers, (config.installBufferSize * 1024), config.maxPath, config.minimizeFileDescriptorUsage, config.enableCrcCheck ); } if (criInitCom.initializesAtom) { CriAtomConfig config = criInitCom.atomConfig; CriAtomPlugin.SetConfigParameters( Mathf.Max(config.maxVirtualVoices, CriAtomPlugin.GetRequiredMaxVirtualVoices(config)), config.maxVoiceLimitGroups, config.maxCategories, config.maxSequenceEventsPerFrame, config.maxBeatSyncCallbacksPerFrame, config.standardVoicePoolConfig.memoryVoices, config.standardVoicePoolConfig.streamingVoices, config.hcaMxVoicePoolConfig.memoryVoices, config.hcaMxVoicePoolConfig.streamingVoices, config.outputSamplingRate, config.asrOutputChannels, config.usesInGamePreview, config.serverFrequency, config.maxParameterBlocks, config.categoriesPerPlayback, config.maxBuses, config.vrMode); CriAtomPlugin.SetConfigAdditionalParameters_PC( config.pcBufferingTime ); } } CriAtomPlugin.InitializeLibrary(); }
public static bool InitializeAtom(CriAtomConfig config) { /* CRI Atomライブラリの初期化 */ if (CriAtomPlugin.IsLibraryInitialized() == false) { /* 初期化処理の実行 */ CriAtomPlugin.SetConfigParameters( (int)Math.Max(config.maxVirtualVoices, CriAtomPlugin.GetRequiredMaxVirtualVoices(config)), config.maxVoiceLimitGroups, config.maxCategories, config.maxSequenceEventsPerFrame, config.maxBeatSyncCallbacksPerFrame, config.standardVoicePoolConfig.memoryVoices, config.standardVoicePoolConfig.streamingVoices, config.hcaMxVoicePoolConfig.memoryVoices, config.hcaMxVoicePoolConfig.streamingVoices, config.outputSamplingRate, config.asrOutputChannels, config.usesInGamePreview, config.serverFrequency, config.maxParameterBlocks, config.categoriesPerPlayback, config.maxBuses, config.vrMode); CriAtomPlugin.SetConfigAdditionalParameters_PC( config.pcBufferingTime ); CriAtomPlugin.SetConfigAdditionalParameters_IOS( (uint)Math.Max(config.iosBufferingTime, 16), config.iosOverrideIPodMusic ); /* Android 固有の初期化パラメータを登録 */ { /* Ver.2.03.03 以前は 0 がデフォルト値だったことの互換性維持のための処理 */ if (config.androidBufferingTime == 0) { config.androidBufferingTime = (int)(4 * 1000.0 / config.serverFrequency); } if (config.androidStartBufferingTime == 0) { config.androidStartBufferingTime = (int)(3 * 1000.0 / config.serverFrequency); } #if !UNITY_EDITOR && UNITY_ANDROID CriAtomEx.androidDefaultSoundRendererType = config.androidForceToUseAsrForDefaultPlayback ? CriAtomEx.SoundRendererType.Asr : CriAtomEx.SoundRendererType.Default; #endif CriAtomPlugin.SetConfigAdditionalParameters_ANDROID( config.androidLowLatencyStandardVoicePoolConfig.memoryVoices, config.androidLowLatencyStandardVoicePoolConfig.streamingVoices, config.androidBufferingTime, config.androidStartBufferingTime, config.androidUsesAndroidFastMixer, config.androidUsesAAudio); } CriAtomPlugin.InitializeLibrary(); if (config.useRandomSeedWithTime == true) { /* 時刻を乱数種に設定 */ CriAtomEx.SetRandomSeed((uint)System.DateTime.Now.Ticks); } /* ACFファイル指定時は登録 */ if (config.acfFileName.Length != 0) { #if UNITY_WEBGL Debug.LogError("In WebGL, ACF File path should be set to CriAtom Component."); #else string acfPath = config.acfFileName; if (CriWare.Common.IsStreamingAssetsPath(acfPath)) { acfPath = Path.Combine(CriWare.Common.streamingAssetsPath, acfPath); } CriAtomEx.RegisterAcf(null, acfPath); #endif } CriAtomServer.KeepPlayingSoundOnPause = config.keepPlayingSoundOnPause; return(true); } else { return(false); } }
/** * <summary>プラグインの初期化(手動初期化用)</summary> * \par 説明: * プラグインの初期化を行います。<br/> * デフォルトでは本関数はAwake関数内で自動的に呼び出されるので、アプリケーションが直接呼び出す必要はありません。<br/> * <br/> * 初期化パラメタをスクリプトから動的に変更して初期化を行いたい場合、本関数を使用してください。<br/> * \par 注意: * 本関数を使用する場合は、 自動初期化を無効にするため、 ::CriWareInitializer::dontInitializeOnAwake プロパティをインスペクタ上でチェックしてください。<br/> * また、本関数を呼び出すタイミングは全てのプラグインAPIよりも前に呼び出す必要があります。Script Execution Orderが高いスクリプト上で行ってください。 * */ public void Initialize() { /* 初期化カウンタの更新 */ 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, fileSystemConfig.minimizeFileDescriptorUsage ); { /* 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.maxVoiceLimitGroups, atomConfig.maxCategories, atomConfig.standardVoicePoolConfig.memoryVoices, atomConfig.standardVoicePoolConfig.streamingVoices, atomConfig.hcaMxVoicePoolConfig.memoryVoices, atomConfig.hcaMxVoicePoolConfig.streamingVoices, atomConfig.outputSamplingRate, atomConfig.asrOutputChannels, atomConfig.usesInGamePreview, atomConfig.serverFrequency, atomConfig.maxParameterBlocks, atomConfig.categoriesPerPlayback, atomConfig.maxBuses, atomConfig.vrMode); CriAtomPlugin.SetConfigAdditionalParameters_PC( atomConfig.pcBufferingTime ); CriAtomPlugin.SetConfigAdditionalParameters_IOS( (uint)Math.Max(atomConfig.iosBufferingTime, 16), atomConfig.iosOverrideIPodMusic ); /* Android 固有の初期化パラメータを登録 */ { /* 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); } IntPtr android_context = IntPtr.Zero; #if !UNITY_EDITOR && UNITY_ANDROID if (atomConfig.androidUsesAndroidFastMixer) { AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject activity = jc.GetStatic <AndroidJavaObject>("currentActivity"); android_context = activity.GetRawObject(); } #endif CriAtomPlugin.SetConfigAdditionalParameters_ANDROID( atomConfig.androidLowLatencyStandardVoicePoolConfig.memoryVoices, atomConfig.androidLowLatencyStandardVoicePoolConfig.streamingVoices, atomConfig.androidBufferingTime, atomConfig.androidStartBufferingTime, android_context); } CriAtomPlugin.SetConfigAdditionalParameters_VITA( atomConfig.vitaAtrac9VoicePoolConfig.memoryVoices, atomConfig.vitaAtrac9VoicePoolConfig.streamingVoices, (initializesMana) ? manaConfig.numberOfDecoders : 0); { /* VR Mode が有効なときも useAudio3D を True にする */ atomConfig.ps4Audio3dConfig.useAudio3D |= atomConfig.vrMode; CriAtomPlugin.SetConfigAdditionalParameters_PS4( atomConfig.ps4Atrac9VoicePoolConfig.memoryVoices, atomConfig.ps4Atrac9VoicePoolConfig.streamingVoices, atomConfig.ps4Audio3dConfig.useAudio3D, atomConfig.ps4Audio3dConfig.voicePoolConfig.memoryVoices, atomConfig.ps4Audio3dConfig.voicePoolConfig.streamingVoices); } CriAtomPlugin.SetConfigAdditionalParameters_WEBGL( atomConfig.webglWebAudioVoicePoolConfig.voices); CriAtomPlugin.InitializeLibrary(); if (atomConfig.useRandomSeedWithTime == true) { /* 時刻を乱数種に設定 */ CriAtomEx.SetRandomSeed((uint)System.DateTime.Now.Ticks); } /* ACFファイル指定時は登録 */ if (atomConfig.acfFileName.Length != 0) { string acfPath = atomConfig.acfFileName; if (CriWare.IsStreamingAssetsPath(acfPath)) { acfPath = Path.Combine(CriWare.streamingAssetsPath, acfPath); } CriAtomEx.RegisterAcf(null, acfPath); } } #if UNITY_EDITOR || (!UNITY_PS3) /* CRI Manaライブラリの初期化 */ if (initializesMana) { CriManaPlugin.SetConfigParameters(manaConfig.graphicsMultiThreaded, manaConfig.numberOfDecoders, manaConfig.numberOfMaxEntries); CriManaPlugin.SetConfigAdditonalParameters_ANDROID(true); #if UNITY_PSP2 CriWareVITA.EnableManaH264Playback(manaConfig.vitaH264PlaybackConfig.useH264Playback); CriWareVITA.SetManaH264DecoderMaxSize(manaConfig.vitaH264PlaybackConfig.maxWidth, manaConfig.vitaH264PlaybackConfig.maxHeight); CriWareVITA.EnableManaH264DecoderGetDisplayMemoryFromUnityTexture(manaConfig.vitaH264PlaybackConfig.getMemoryFromTexture); #endif CriManaPlugin.InitializeLibrary(); } #endif /*JP< CRI Ware Decrypterの設定 */ if (useDecrypter) { ulong decryptionKey = (decrypterConfig.key.Length == 0) ? 0 : Convert.ToUInt64(decrypterConfig.key); string authenticationPath = decrypterConfig.authenticationFile; if (CriWare.IsStreamingAssetsPath(authenticationPath)) { authenticationPath = Path.Combine(CriWare.streamingAssetsPath, authenticationPath); } #if !UNITY_EDITOR && UNITY_WEBGL CriWare.criWareUnity_SetDecryptionKey_EMSCRIPTEN( decryptionKey ); #else CriWare.criWareUnity_SetDecryptionKey( decryptionKey, authenticationPath, decrypterConfig.enableAtomDecryption, decrypterConfig.enableManaDecryption ); #endif } else { #if !UNITY_EDITOR && UNITY_WEBGL CriWare.criWareUnity_SetDecryptionKey_EMSCRIPTEN(0); #else CriWare.criWareUnity_SetDecryptionKey(0, "", false, false); #endif } /* シーンチェンジ後もオブジェクトを維持するかどうかの設定 */ if (dontDestroyOnLoad) { DontDestroyOnLoad(transform.gameObject); DontDestroyOnLoad(CriWare.managerObject); } }
public static bool InitializeAtom(CriAtomConfig config) { /* CRI Atomライブラリの初期化 */ if (CriAtomPlugin.IsLibraryInitialized() == false) { /* 初期化処理の実行 */ CriAtomPlugin.SetConfigParameters( (int)Math.Max(config.maxVirtualVoices, CriAtomPlugin.GetRequiredMaxVirtualVoices(config)), config.maxVoiceLimitGroups, config.maxCategories, config.maxSequenceEventsPerFrame, config.maxBeatSyncCallbacksPerFrame, config.standardVoicePoolConfig.memoryVoices, config.standardVoicePoolConfig.streamingVoices, config.hcaMxVoicePoolConfig.memoryVoices, config.hcaMxVoicePoolConfig.streamingVoices, config.outputSamplingRate, config.asrOutputChannels, config.usesInGamePreview, config.serverFrequency, config.maxParameterBlocks, config.categoriesPerPlayback, config.maxBuses, config.vrMode); CriAtomPlugin.SetConfigAdditionalParameters_PC( config.pcBufferingTime ); CriAtomPlugin.SetConfigAdditionalParameters_IOS( (uint)Math.Max(config.iosBufferingTime, 16), config.iosOverrideIPodMusic ); /* Android 固有の初期化パラメータを登録 */ { /* Ver.2.03.03 以前は 0 がデフォルト値だったことの互換性維持のための処理 */ if (config.androidBufferingTime == 0) { config.androidBufferingTime = (int)(4 * 1000.0 / config.serverFrequency); } if (config.androidStartBufferingTime == 0) { config.androidStartBufferingTime = (int)(3 * 1000.0 / config.serverFrequency); } IntPtr android_context = IntPtr.Zero; #if !UNITY_EDITOR && UNITY_ANDROID if (config.androidUsesAndroidFastMixer) { AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject activity = jc.GetStatic <AndroidJavaObject>("currentActivity"); android_context = activity.GetRawObject(); } CriAtomEx.androidDefaultSoundRendererType = config.androidForceToUseAsrForDefaultPlayback ? CriAtomEx.SoundRendererType.Asr : CriAtomEx.SoundRendererType.Default; #endif CriAtomPlugin.SetConfigAdditionalParameters_ANDROID( config.androidLowLatencyStandardVoicePoolConfig.memoryVoices, config.androidLowLatencyStandardVoicePoolConfig.streamingVoices, config.androidBufferingTime, config.androidStartBufferingTime, android_context); } CriAtomPlugin.InitializeLibrary(); if (config.useRandomSeedWithTime == true) { /* 時刻を乱数種に設定 */ CriAtomEx.SetRandomSeed((uint)System.DateTime.Now.Ticks); } /* ACFファイル指定時は登録 */ if (config.acfFileName.Length != 0) { string acfPath = config.acfFileName; if (CriWare.IsStreamingAssetsPath(acfPath)) { acfPath = Path.Combine(CriWare.streamingAssetsPath, acfPath); } CriAtomEx.RegisterAcf(null, acfPath); } return(true); } else { return(false); } }
/** * <summary>プラグインの初期化(手動初期化用)</summary> * \par 説明: * プラグインの初期化を行います。<br/> * デフォルトでは本関数はAwake関数内で自動的に呼び出されるので、アプリケーションが直接呼び出す必要はありません。<br/> * <br/> * 初期化パラメタをスクリプトから動的に変更して初期化を行いたい場合、本関数を使用してください。<br/> * \par 注意: * 本関数を使用する場合は、 自動初期化を無効にするため、 ::CriWareInitializer::dontInitializeOnAwake プロパティをインスペクタ上でチェックしてください。<br/> * また、本関数を呼び出すタイミングは全てのプラグインAPIよりも前に呼び出す必要があります。Script Execution Orderが高いスクリプト上で行ってください。 * */ public void Initialize() { /* 初期化カウンタの更新 */ 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, fileSystemConfig.minimizeFileDescriptorUsage ); { /* 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.maxVoiceLimitGroups, atomConfig.maxCategories, atomConfig.standardVoicePoolConfig.memoryVoices, atomConfig.standardVoicePoolConfig.streamingVoices, atomConfig.hcaMxVoicePoolConfig.memoryVoices, atomConfig.hcaMxVoicePoolConfig.streamingVoices, atomConfig.outputSamplingRate, atomConfig.asrOutputChannels, atomConfig.usesInGamePreview, atomConfig.serverFrequency, atomConfig.maxParameterBlocks, atomConfig.categoriesPerPlayback, atomConfig.maxBuses, false); CriAtomPlugin.SetConfigAdditionalParameters_PC( atomConfig.pcBufferingTime ); CriAtomPlugin.SetConfigAdditionalParameters_IOS( (uint)Math.Max(atomConfig.iosBufferingTime, 16), atomConfig.iosOverrideIPodMusic ); /* Android 固有の初期化パラメータを登録 */ { /* 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); } IntPtr android_context = IntPtr.Zero; #if !UNITY_EDITOR && UNITY_ANDROID if (atomConfig.androidUsesAndroidFastMixer) { AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject activity = jc.GetStatic <AndroidJavaObject>("currentActivity"); android_context = activity.GetRawObject(); } #endif CriAtomPlugin.SetConfigAdditionalParameters_ANDROID( atomConfig.androidLowLatencyStandardVoicePoolConfig.memoryVoices, atomConfig.androidLowLatencyStandardVoicePoolConfig.streamingVoices, atomConfig.androidBufferingTime, atomConfig.androidStartBufferingTime, android_context); } CriAtomPlugin.InitializeLibrary(); if (atomConfig.useRandomSeedWithTime == true) { /* 時刻を乱数種に設定 */ CriAtomEx.SetRandomSeed((uint)System.DateTime.Now.Ticks); } /* ACFファイル指定時は登録 */ if (atomConfig.acfFileName.Length != 0) { string acfPath = atomConfig.acfFileName; if (CriWare.IsStreamingAssetsPath(acfPath)) { acfPath = Path.Combine(CriWare.streamingAssetsPath, acfPath); } CriAtomEx.RegisterAcf(null, acfPath); } } /* CRI Manaライブラリの初期化 */ if (initializesMana) { CriManaPlugin.SetConfigParameters(manaConfig.graphicsMultiThreaded, manaConfig.numberOfDecoders, manaConfig.numberOfMaxEntries); CriManaPlugin.InitializeLibrary(); } /* シーンチェンジ後もオブジェクトを維持するかどうかの設定 */ if (dontDestroyOnLoad) { DontDestroyOnLoad(transform.gameObject); DontDestroyOnLoad(CriWare.managerObject); } }