Skip to content

Commit 47b60df

Browse files
committed
make generate and add definitions
1 parent 76bb3e9 commit 47b60df

File tree

7 files changed

+27
-13
lines changed

7 files changed

+27
-13
lines changed

src/VoicevoxCoreSharp.Core.Unity/Packages/VoicevoxCoreSharp.Core.Unity/Runtime/Script/Enum/ResultCode.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ public enum ResultCode : int
6565
/// </summary>
6666
RESULT_READ_ZIP_ENTRY_ERROR = 17,
6767
/// <summary>
68+
/// モデルの形式が不正
69+
/// </summary>
70+
RESULT_INVALID_MODEL_HEADER_ERROR = 28,
71+
/// <summary>
6872
/// すでに読み込まれている音声モデルを読み込もうとした
6973
/// </summary>
7074
RESULT_MODEL_ALREADY_LOADED_ERROR = 18,
@@ -122,6 +126,7 @@ internal static ResultCode FromNative(this VoicevoxResultCode code)
122126
VoicevoxResultCode.VOICEVOX_RESULT_INVALID_ACCENT_PHRASE_ERROR => ResultCode.RESULT_INVALID_ACCENT_PHRASE_ERROR,
123127
VoicevoxResultCode.VOICEVOX_RESULT_OPEN_ZIP_FILE_ERROR => ResultCode.RESULT_OPEN_ZIP_FILE_ERROR,
124128
VoicevoxResultCode.VOICEVOX_RESULT_READ_ZIP_ENTRY_ERROR => ResultCode.RESULT_READ_ZIP_ENTRY_ERROR,
129+
VoicevoxResultCode.VOICEVOX_RESULT_INVALID_MODEL_HEADER_ERROR => ResultCode.RESULT_INVALID_MODEL_HEADER_ERROR,
125130
VoicevoxResultCode.VOICEVOX_RESULT_MODEL_ALREADY_LOADED_ERROR => ResultCode.RESULT_MODEL_ALREADY_LOADED_ERROR,
126131
VoicevoxResultCode.VOICEVOX_RESULT_STYLE_ALREADY_LOADED_ERROR => ResultCode.RESULT_STYLE_ALREADY_LOADED_ERROR,
127132
VoicevoxResultCode.VOICEVOX_RESULT_INVALID_MODEL_DATA_ERROR => ResultCode.RESULT_INVALID_MODEL_DATA_ERROR,
@@ -153,6 +158,7 @@ internal static VoicevoxResultCode ToNative(this ResultCode code)
153158
ResultCode.RESULT_INVALID_ACCENT_PHRASE_ERROR => VoicevoxResultCode.VOICEVOX_RESULT_INVALID_ACCENT_PHRASE_ERROR,
154159
ResultCode.RESULT_OPEN_ZIP_FILE_ERROR => VoicevoxResultCode.VOICEVOX_RESULT_OPEN_ZIP_FILE_ERROR,
155160
ResultCode.RESULT_READ_ZIP_ENTRY_ERROR => VoicevoxResultCode.VOICEVOX_RESULT_READ_ZIP_ENTRY_ERROR,
161+
ResultCode.RESULT_INVALID_MODEL_HEADER_ERROR => VoicevoxResultCode.VOICEVOX_RESULT_INVALID_MODEL_HEADER_ERROR,
156162
ResultCode.RESULT_MODEL_ALREADY_LOADED_ERROR => VoicevoxResultCode.VOICEVOX_RESULT_MODEL_ALREADY_LOADED_ERROR,
157163
ResultCode.RESULT_STYLE_ALREADY_LOADED_ERROR => VoicevoxResultCode.VOICEVOX_RESULT_STYLE_ALREADY_LOADED_ERROR,
158164
ResultCode.RESULT_INVALID_MODEL_DATA_ERROR => VoicevoxResultCode.VOICEVOX_RESULT_INVALID_MODEL_DATA_ERROR,

src/VoicevoxCoreSharp.Core.Unity/Packages/VoicevoxCoreSharp.Core.Unity/Runtime/Script/Native/CoreUnsafe.g.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ internal static unsafe partial class CoreUnsafe
4747

4848
/// <summary>::VoicevoxVoiceModel からIDを取得する。 @param [in] model 音声モデル @returns 音声モデルID \\safety{ - `model`は ::voicevox_voice_model_new_from_path で得たものでなければならず、また ::voicevox_voice_model_delete で解放されていてはいけない。 }</summary>
4949
[DllImport(__DllName, EntryPoint = "voicevox_voice_model_id", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
50-
public static extern byte* voicevox_voice_model_id(VoicevoxVoiceModel* model);
50+
public static extern void/* byte[] */* voicevox_voice_model_id(VoicevoxVoiceModel* model);
5151

5252
/// <summary>::VoicevoxVoiceModel からメタ情報を取得する。 @param [in] model 音声モデル @returns メタ情報のJSON文字列 \\safety{ - `model`は ::voicevox_voice_model_new_from_path で得たものでなければならず、また ::voicevox_voice_model_delete で解放されていてはいけない。 - 戻り値の文字列の&lt;b&gt;生存期間&lt;/b&gt;(_lifetime_)は次にこの関数が呼ばれるか、`model`が破棄されるまでである。この生存期間を越えて文字列にアクセスしてはならない。 }</summary>
5353
[DllImport(__DllName, EntryPoint = "voicevox_voice_model_get_metas_json", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
@@ -69,19 +69,19 @@ internal static unsafe partial class CoreUnsafe
6969
[DllImport(__DllName, EntryPoint = "voicevox_synthesizer_load_voice_model", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
7070
public static extern VoicevoxResultCode voicevox_synthesizer_load_voice_model(VoicevoxSynthesizer* synthesizer, VoicevoxVoiceModel* model);
7171

72-
/// <summary>音声モデルの読み込みを解除する。 @param [in] synthesizer 音声シンセサイザ @param [in] model_id 音声モデルID @returns 結果コード \\safety{ - `synthesizer`は ::voicevox_synthesizer_new で得たものでなければならず、また ::voicevox_synthesizer_delete で解放されていてはいけない。 - `model_id`はヌル終端文字列を指し、かつ&lt;a href=\"#voicevox-core-safety\"&gt;読み込みについて有効&lt;/a&gt;でなければならない。 }</summary>
72+
/// <summary>音声モデルの読み込みを解除する。 @param [in] synthesizer 音声シンセサイザ @param [in] model_id 音声モデルID @returns 結果コード \\safety{ - `synthesizer`は ::voicevox_synthesizer_new で得たものでなければならず、また ::voicevox_synthesizer_delete で解放されていてはいけない。 - `model_id`&lt;a href=\"#voicevox-core-safety\"&gt;読み込みについて有効&lt;/a&gt;でなければならない。 }</summary>
7373
[DllImport(__DllName, EntryPoint = "voicevox_synthesizer_unload_voice_model", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
74-
public static extern VoicevoxResultCode voicevox_synthesizer_unload_voice_model(VoicevoxSynthesizer* synthesizer, byte* model_id);
74+
public static extern VoicevoxResultCode voicevox_synthesizer_unload_voice_model(VoicevoxSynthesizer* synthesizer, void/* byte[] */* model_id);
7575

7676
/// <summary>ハードウェアアクセラレーションがGPUモードか判定する。 @param [in] synthesizer 音声シンセサイザ @returns GPUモードかどうか \\safety{ - `synthesizer`は ::voicevox_synthesizer_new で得たものでなければならず、また ::voicevox_synthesizer_delete で解放されていてはいけない。 }</summary>
7777
[DllImport(__DllName, EntryPoint = "voicevox_synthesizer_is_gpu_mode", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
7878
[return: MarshalAs(UnmanagedType.U1)]
7979
public static extern bool voicevox_synthesizer_is_gpu_mode(VoicevoxSynthesizer* synthesizer);
8080

81-
/// <summary>指定したIDの音声モデルが読み込まれているか判定する。 @param [in] synthesizer 音声シンセサイザ @param [in] model_id 音声モデルID @returns モデルが読み込まれているかどうか \\safety{ - `synthesizer`は ::voicevox_synthesizer_new で得たものでなければならず、また ::voicevox_synthesizer_delete で解放されていてはいけない。 - `model_id`はヌル終端文字列を指し、かつ&lt;a href=\"#voicevox-core-safety\"&gt;読み込みについて有効&lt;/a&gt;でなければならない。 }</summary>
81+
/// <summary>指定したIDの音声モデルが読み込まれているか判定する。 @param [in] synthesizer 音声シンセサイザ @param [in] model_id 音声モデルID @returns モデルが読み込まれているかどうか \\safety{ - `synthesizer`は ::voicevox_synthesizer_new で得たものでなければならず、また ::voicevox_synthesizer_delete で解放されていてはいけない。 - `model_id`&lt;a href=\"#voicevox-core-safety\"&gt;読み込みについて有効&lt;/a&gt;でなければならない。 }</summary>
8282
[DllImport(__DllName, EntryPoint = "voicevox_synthesizer_is_loaded_voice_model", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
8383
[return: MarshalAs(UnmanagedType.U1)]
84-
public static extern bool voicevox_synthesizer_is_loaded_voice_model(VoicevoxSynthesizer* synthesizer, byte* model_id);
84+
public static extern bool voicevox_synthesizer_is_loaded_voice_model(VoicevoxSynthesizer* synthesizer, void/* byte[] */* model_id);
8585

8686
/// <summary>今読み込んでいる音声モデルのメタ情報を、JSONで取得する。 JSONの解放は ::voicevox_json_free で行う。 @param [in] synthesizer 音声シンセサイザ @return メタ情報のJSON文字列 \\safety{ - `synthesizer`は ::voicevox_synthesizer_new で得たものでなければならず、また ::voicevox_synthesizer_delete で解放されていてはいけない。 }</summary>
8787
[DllImport(__DllName, EntryPoint = "voicevox_synthesizer_create_metas_json", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
@@ -260,6 +260,7 @@ internal enum VoicevoxResultCode : int
260260
VOICEVOX_RESULT_INVALID_ACCENT_PHRASE_ERROR = 15,
261261
VOICEVOX_RESULT_OPEN_ZIP_FILE_ERROR = 16,
262262
VOICEVOX_RESULT_READ_ZIP_ENTRY_ERROR = 17,
263+
VOICEVOX_RESULT_INVALID_MODEL_HEADER_ERROR = 28,
263264
VOICEVOX_RESULT_MODEL_ALREADY_LOADED_ERROR = 18,
264265
VOICEVOX_RESULT_STYLE_ALREADY_LOADED_ERROR = 26,
265266
VOICEVOX_RESULT_INVALID_MODEL_DATA_ERROR = 27,

src/VoicevoxCoreSharp.Core.Unity/Packages/VoicevoxCoreSharp.Core.Unity/Runtime/Script/VoiceModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public string Id
6868
unsafe
6969
{
7070
var ptr = CoreUnsafe.voicevox_voice_model_id((VoicevoxVoiceModel*)Handle);
71-
return StringConvertCompat.ToUTF8String(ptr);
71+
return StringConvertCompat.ToUTF8String((byte*)ptr);
7272
}
7373
}
7474
}

src/VoicevoxCoreSharp.Core/Enum/ResultCode.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ public enum ResultCode : int
6565
/// </summary>
6666
RESULT_READ_ZIP_ENTRY_ERROR = 17,
6767
/// <summary>
68+
/// モデルの形式が不正
69+
/// </summary>
70+
RESULT_INVALID_MODEL_HEADER_ERROR = 28,
71+
/// <summary>
6872
/// すでに読み込まれている音声モデルを読み込もうとした
6973
/// </summary>
7074
RESULT_MODEL_ALREADY_LOADED_ERROR = 18,
@@ -122,6 +126,7 @@ internal static ResultCode FromNative(this VoicevoxResultCode code)
122126
VoicevoxResultCode.VOICEVOX_RESULT_INVALID_ACCENT_PHRASE_ERROR => ResultCode.RESULT_INVALID_ACCENT_PHRASE_ERROR,
123127
VoicevoxResultCode.VOICEVOX_RESULT_OPEN_ZIP_FILE_ERROR => ResultCode.RESULT_OPEN_ZIP_FILE_ERROR,
124128
VoicevoxResultCode.VOICEVOX_RESULT_READ_ZIP_ENTRY_ERROR => ResultCode.RESULT_READ_ZIP_ENTRY_ERROR,
129+
VoicevoxResultCode.VOICEVOX_RESULT_INVALID_MODEL_HEADER_ERROR => ResultCode.RESULT_INVALID_MODEL_HEADER_ERROR,
125130
VoicevoxResultCode.VOICEVOX_RESULT_MODEL_ALREADY_LOADED_ERROR => ResultCode.RESULT_MODEL_ALREADY_LOADED_ERROR,
126131
VoicevoxResultCode.VOICEVOX_RESULT_STYLE_ALREADY_LOADED_ERROR => ResultCode.RESULT_STYLE_ALREADY_LOADED_ERROR,
127132
VoicevoxResultCode.VOICEVOX_RESULT_INVALID_MODEL_DATA_ERROR => ResultCode.RESULT_INVALID_MODEL_DATA_ERROR,
@@ -153,6 +158,7 @@ internal static VoicevoxResultCode ToNative(this ResultCode code)
153158
ResultCode.RESULT_INVALID_ACCENT_PHRASE_ERROR => VoicevoxResultCode.VOICEVOX_RESULT_INVALID_ACCENT_PHRASE_ERROR,
154159
ResultCode.RESULT_OPEN_ZIP_FILE_ERROR => VoicevoxResultCode.VOICEVOX_RESULT_OPEN_ZIP_FILE_ERROR,
155160
ResultCode.RESULT_READ_ZIP_ENTRY_ERROR => VoicevoxResultCode.VOICEVOX_RESULT_READ_ZIP_ENTRY_ERROR,
161+
ResultCode.RESULT_INVALID_MODEL_HEADER_ERROR => VoicevoxResultCode.VOICEVOX_RESULT_INVALID_MODEL_HEADER_ERROR,
156162
ResultCode.RESULT_MODEL_ALREADY_LOADED_ERROR => VoicevoxResultCode.VOICEVOX_RESULT_MODEL_ALREADY_LOADED_ERROR,
157163
ResultCode.RESULT_STYLE_ALREADY_LOADED_ERROR => VoicevoxResultCode.VOICEVOX_RESULT_STYLE_ALREADY_LOADED_ERROR,
158164
ResultCode.RESULT_INVALID_MODEL_DATA_ERROR => VoicevoxResultCode.VOICEVOX_RESULT_INVALID_MODEL_DATA_ERROR,

src/VoicevoxCoreSharp.Core/Native/CoreUnsafe.g.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ internal static unsafe partial class CoreUnsafe
4747

4848
/// <summary>::VoicevoxVoiceModel からIDを取得する。 @param [in] model 音声モデル @returns 音声モデルID \\safety{ - `model`は ::voicevox_voice_model_new_from_path で得たものでなければならず、また ::voicevox_voice_model_delete で解放されていてはいけない。 }</summary>
4949
[DllImport(__DllName, EntryPoint = "voicevox_voice_model_id", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
50-
public static extern byte* voicevox_voice_model_id(VoicevoxVoiceModel* model);
50+
public static extern void/* byte[] */* voicevox_voice_model_id(VoicevoxVoiceModel* model);
5151

5252
/// <summary>::VoicevoxVoiceModel からメタ情報を取得する。 @param [in] model 音声モデル @returns メタ情報のJSON文字列 \\safety{ - `model`は ::voicevox_voice_model_new_from_path で得たものでなければならず、また ::voicevox_voice_model_delete で解放されていてはいけない。 - 戻り値の文字列の&lt;b&gt;生存期間&lt;/b&gt;(_lifetime_)は次にこの関数が呼ばれるか、`model`が破棄されるまでである。この生存期間を越えて文字列にアクセスしてはならない。 }</summary>
5353
[DllImport(__DllName, EntryPoint = "voicevox_voice_model_get_metas_json", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
@@ -69,19 +69,19 @@ internal static unsafe partial class CoreUnsafe
6969
[DllImport(__DllName, EntryPoint = "voicevox_synthesizer_load_voice_model", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
7070
public static extern VoicevoxResultCode voicevox_synthesizer_load_voice_model(VoicevoxSynthesizer* synthesizer, VoicevoxVoiceModel* model);
7171

72-
/// <summary>音声モデルの読み込みを解除する。 @param [in] synthesizer 音声シンセサイザ @param [in] model_id 音声モデルID @returns 結果コード \\safety{ - `synthesizer`は ::voicevox_synthesizer_new で得たものでなければならず、また ::voicevox_synthesizer_delete で解放されていてはいけない。 - `model_id`はヌル終端文字列を指し、かつ&lt;a href=\"#voicevox-core-safety\"&gt;読み込みについて有効&lt;/a&gt;でなければならない。 }</summary>
72+
/// <summary>音声モデルの読み込みを解除する。 @param [in] synthesizer 音声シンセサイザ @param [in] model_id 音声モデルID @returns 結果コード \\safety{ - `synthesizer`は ::voicevox_synthesizer_new で得たものでなければならず、また ::voicevox_synthesizer_delete で解放されていてはいけない。 - `model_id`&lt;a href=\"#voicevox-core-safety\"&gt;読み込みについて有効&lt;/a&gt;でなければならない。 }</summary>
7373
[DllImport(__DllName, EntryPoint = "voicevox_synthesizer_unload_voice_model", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
74-
public static extern VoicevoxResultCode voicevox_synthesizer_unload_voice_model(VoicevoxSynthesizer* synthesizer, byte* model_id);
74+
public static extern VoicevoxResultCode voicevox_synthesizer_unload_voice_model(VoicevoxSynthesizer* synthesizer, void/* byte[] */* model_id);
7575

7676
/// <summary>ハードウェアアクセラレーションがGPUモードか判定する。 @param [in] synthesizer 音声シンセサイザ @returns GPUモードかどうか \\safety{ - `synthesizer`は ::voicevox_synthesizer_new で得たものでなければならず、また ::voicevox_synthesizer_delete で解放されていてはいけない。 }</summary>
7777
[DllImport(__DllName, EntryPoint = "voicevox_synthesizer_is_gpu_mode", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
7878
[return: MarshalAs(UnmanagedType.U1)]
7979
public static extern bool voicevox_synthesizer_is_gpu_mode(VoicevoxSynthesizer* synthesizer);
8080

81-
/// <summary>指定したIDの音声モデルが読み込まれているか判定する。 @param [in] synthesizer 音声シンセサイザ @param [in] model_id 音声モデルID @returns モデルが読み込まれているかどうか \\safety{ - `synthesizer`は ::voicevox_synthesizer_new で得たものでなければならず、また ::voicevox_synthesizer_delete で解放されていてはいけない。 - `model_id`はヌル終端文字列を指し、かつ&lt;a href=\"#voicevox-core-safety\"&gt;読み込みについて有効&lt;/a&gt;でなければならない。 }</summary>
81+
/// <summary>指定したIDの音声モデルが読み込まれているか判定する。 @param [in] synthesizer 音声シンセサイザ @param [in] model_id 音声モデルID @returns モデルが読み込まれているかどうか \\safety{ - `synthesizer`は ::voicevox_synthesizer_new で得たものでなければならず、また ::voicevox_synthesizer_delete で解放されていてはいけない。 - `model_id`&lt;a href=\"#voicevox-core-safety\"&gt;読み込みについて有効&lt;/a&gt;でなければならない。 }</summary>
8282
[DllImport(__DllName, EntryPoint = "voicevox_synthesizer_is_loaded_voice_model", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
8383
[return: MarshalAs(UnmanagedType.U1)]
84-
public static extern bool voicevox_synthesizer_is_loaded_voice_model(VoicevoxSynthesizer* synthesizer, byte* model_id);
84+
public static extern bool voicevox_synthesizer_is_loaded_voice_model(VoicevoxSynthesizer* synthesizer, void/* byte[] */* model_id);
8585

8686
/// <summary>今読み込んでいる音声モデルのメタ情報を、JSONで取得する。 JSONの解放は ::voicevox_json_free で行う。 @param [in] synthesizer 音声シンセサイザ @return メタ情報のJSON文字列 \\safety{ - `synthesizer`は ::voicevox_synthesizer_new で得たものでなければならず、また ::voicevox_synthesizer_delete で解放されていてはいけない。 }</summary>
8787
[DllImport(__DllName, EntryPoint = "voicevox_synthesizer_create_metas_json", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
@@ -260,6 +260,7 @@ internal enum VoicevoxResultCode : int
260260
VOICEVOX_RESULT_INVALID_ACCENT_PHRASE_ERROR = 15,
261261
VOICEVOX_RESULT_OPEN_ZIP_FILE_ERROR = 16,
262262
VOICEVOX_RESULT_READ_ZIP_ENTRY_ERROR = 17,
263+
VOICEVOX_RESULT_INVALID_MODEL_HEADER_ERROR = 28,
263264
VOICEVOX_RESULT_MODEL_ALREADY_LOADED_ERROR = 18,
264265
VOICEVOX_RESULT_STYLE_ALREADY_LOADED_ERROR = 26,
265266
VOICEVOX_RESULT_INVALID_MODEL_DATA_ERROR = 27,

src/VoicevoxCoreSharp.Core/VoiceModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public string Id
6868
unsafe
6969
{
7070
var ptr = CoreUnsafe.voicevox_voice_model_id((VoicevoxVoiceModel*)Handle);
71-
return StringConvertCompat.ToUTF8String(ptr);
71+
return StringConvertCompat.ToUTF8String((byte*)ptr);
7272
}
7373
}
7474
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
33
<VoicevoxOnnxRuntimeVersion>1.14.0</VoicevoxOnnxRuntimeVersion>
4-
<VoicevoxCoreCommitHash>52bc1d657e9529b288c8da7966f5242463d6580b</VoicevoxCoreCommitHash>
4+
<VoicevoxCoreCommitHash>4cd19cce53ae2e0ee14adeb93180f3c6e530ba3a</VoicevoxCoreCommitHash>
55
</PropertyGroup>
66
</Project>

0 commit comments

Comments
 (0)