openModel method

void openModel(
  1. String encoder,
  2. String decoder1,
  3. String decoder2,
  4. String wave,
  5. String? ssl,
  6. int modelType,
  7. int cleanerType,
  8. int envId,
)

Opens a Tacotron2 model.

encoder is the path to the encoder model file. decoder1 is the path to the decoder model file. decoder2 is the path to the postnet model file. wave is the path to the waveform generation model file. ssl is the path to the SSL model file (null for Tacotron2). modelType is the model type constant. cleanerType is the cleaner type constant. envId is the execution environment ID.

Implementation

void openModel(
  String encoder,
  String decoder1,
  String decoder2,
  String wave,
  String? ssl,
  int modelType,
  int cleanerType,
  int envId,
) {
  _create(envId);

  int status;
  if (Platform.isWindows){
    status = ailiaVoice.ailiaVoiceOpenModelFileW(
      ppAilia!.value,
      encoder.toNativeUtf16().cast<ffi.WChar>(),
      decoder1.toNativeUtf16().cast<ffi.WChar>(),
      decoder2.toNativeUtf16().cast<ffi.WChar>(),
      wave.toNativeUtf16().cast<ffi.WChar>(),
      (ssl != null) ? ssl.toNativeUtf16().cast<ffi.WChar>():ffi.nullptr,
      modelType,
      cleanerType,
    );
  }else{
    status = ailiaVoice.ailiaVoiceOpenModelFileA(
      ppAilia!.value,
      encoder.toNativeUtf8().cast<ffi.Char>(),
      decoder1.toNativeUtf8().cast<ffi.Char>(),
      decoder2.toNativeUtf8().cast<ffi.Char>(),
      wave.toNativeUtf8().cast<ffi.Char>(),
      (ssl != null) ? ssl.toNativeUtf8().cast<ffi.Char>():ffi.nullptr,
      modelType,
      ailia_voice_dart.AILIA_VOICE_CLEANER_TYPE_BASIC,
    );
  }
  throwError("ailiaVoiceOpenModelFile", status);

  _finalizeOpen();
}