voicevoxAudioQueryValidate function
JSONをAudioQuery型としてバリデートする。
次のうちどれかを満たすならエラーを返す。
- Rust APIの
AudioQuery型としてデシリアライズ不可、もしくはJSONとして不正。 accent_phrasesの要素のうちいずれかが、 ::voicevox_accent_phrase_validate でエラーになる。outputSamplingRateが24000の倍数ではない、もしくは0(将来的に解消予定。cf. #762)。
次の状態に対しては警告のログを出す。将来的にはエラーになる予定。
accent_phrasesの要素のうちいずれかが警告が出る状態。speedScaleが負。volumeScaleが負。prePhonemeLengthが負。postPhonemeLengthが負。outputSamplingRateが24000以外の値(エラーと同様将来的に解消予定)。
@param in audio_query_json AudioQuery型のJSON
@returns 成功時には ::VOICEVOX_RESULT_OK 、失敗時には ::VOICEVOX_RESULT_INVALID_AUDIO_QUERY_ERROR
\safety{
audio_query_jsonはヌル終端文字列を指し、かつ読み込みについて有効でなければならない。 }
\orig-impl{voicevox_audio_query_validate}
__declspec(dllimport) VoicevoxResultCode voicevox_audio_query_validate(const char *audio_query_json)
Implementation
int voicevoxAudioQueryValidate(String? audioQueryJson) {
final voicevoxAudioQueryValidateLookupFunction = _libCore
.lookupFunction<
Int32 Function(Pointer<Utf8>),
int Function(Pointer<Utf8>)
>('voicevox_audio_query_validate');
final audioQueryJsonPointer = audioQueryJson != null
? audioQueryJson.toNativeUtf8()
: nullptr;
final result = voicevoxAudioQueryValidateLookupFunction(
audioQueryJsonPointer,
);
calloc.free(audioQueryJsonPointer);
return result;
}