setReference method

void setReference(
  1. List<double> pcm,
  2. int sampleRate,
  3. int nChannels,
  4. String referenceFeature
)

Implementation

void setReference(List<double> pcm, int sampleRate, int nChannels, String referenceFeature){
  if (!available) {
    throw Exception("Model not opened yet. wait one second and try again.");
  }

  ffi.Pointer<ffi.Float> waveBuf = malloc<ffi.Float>(pcm.length);
  for (int i = 0; i < pcm.length; i++) {
    waveBuf[i] = pcm[i];
  }

  int status = ailiaVoice.ailiaVoiceSetReference(
    ppAilia!.value,
    waveBuf,
    pcm.length * 4,
    nChannels,
    sampleRate,
    referenceFeature.toNativeUtf8().cast<ffi.Char>()
  );
  throwError("ailiaVoiceSetReference", status);

  malloc.free(waveBuf);
}