unloadTtsModel method

void unloadTtsModel()

Unload the TTS model.

Implementation

void unloadTtsModel() {
  if (_handle == null || _backendType != 'onnx') return;

  try {
    final destroy =
        _lib.lookupFunction<RacTtsOnnxDestroyNative, RacTtsOnnxDestroyDart>(
            'rac_tts_onnx_destroy');
    destroy(_handle!);
    _handle = null;
    _currentModel = null;
  } catch (e) {
    throw NativeBackendException('Failed to unload TTS model: $e');
  }
}