版本
menu
本节包含针对特定游戏引擎集成场景的补充说明。
In addition to the speechEngine plug-in library, voices dynamic libraries are required at
runtime such as vt_eng.dll
or vt_fre.dll
for English and
French on Windows.
要在构建阶段复制所需的库,请使用 Unity Editor 辅助脚本。该脚本位于 Unity 工程的以下目录中:SDK/Plugins/speechEngine/Unity/Editor/SpeechEnginePluginImporterScript.cs
。
Any text you send at runtime must use UTF-8 character encoding. Depending on the platform, you might have to convert text from a different type of encoding to UTF-8. The following code samples for Unity and Unreal demonstrate how to convert UTF-16 encoding (the default on Windows) to UTF-8. You might have to modify the code for other platforms depending on the type of encoding they use.
Unity:
public byte[] ConvertUtf16ToUtf8Bytes(string utf16String) { // Get the UTF-8 encoding Encoding utf8 = Encoding.UTF8; // Convert the UTF-16 string to a UTF-8 byte array byte[] utf8Bytes = utf8.GetBytes(utf16String); return utf8Bytes; } byte[] textArray = ConvertUtf16ToUtf8Bytes(Text); System.Runtime.InteropServices.GCHandle pinned = System.Runtime.InteropServices.GCHandle.Alloc(textArray, System.Runtime.InteropServices.GCHandleType.Pinned); IntPtr address = pinned.AddrOfPinnedObject(); AkUnitySoundEngine.SendPluginCustomGameData(0, this.gameObject, AkPluginType.AkPluginTypeSource, 312, 1, address, (uint)textArray.Length + 1); pinned.Free();
Unreal:
FString utf16_text = TEXT("This is a UTF-16 string at its core."); FStringView fStringView(utf16_text); auto ConvertedTemp = StringCast<UTF8CHAR>(fStringView.GetData(), fStringView.Len()); auto utf8_text = ConvertedTemp.Get(); SoundEngine->SendPluginCustomGameData(0, 100, AkPluginTypeSource, 312, 1, utf8_text, ConvertedTemp.Length() + 1);
speechEngine 插件不支持 Mac 平台。但若通过 Wwise Unreal/Unity Integration 来生成 SoundBank,将自动为 Mac 生成 SoundBank,而这可能会导致发生错误。因此,建议针对 Mac 以显式方式从工程中弃用所有 speechEngine 元素以避免此类错误。有关详细信息,请参阅从平台中弃用工程元素。
要编译 IntegrationDemo 的 speechEngine 插件页面,您需要修改随 Wwise SDK 一并提供的 Xcode 工程。
在 IntegrationDemo Xcode 属性中:
在 General - Frameworks, Libraries and Embedded Content 下:
添加 Applications/Audiokinetic/Wwise[version]/SDK/iOS_Xcode[version]/[configuration]/bin
下找到的所有 vt_[lang]_q22.framework
文件。
在 Build Settings 下:
将 @executable_path/Frameworks
添加到 Runpath Search Paths
。
将 ../../../iOS_Xcode$(XCODE_VERSION_MAJOR)/Profile$(EFFECTIVE_PLATFORM_NAME)/bin
添加到 Framework Search Paths
。