feedFloat32 method

Future<int> feedFloat32({
  1. required List<Float32List> data,
})

Implementation

Future<int> feedFloat32({required List<t.Float32List> data}) async {
  if (codec != Codec.pcmFloat32) {
    callback!.log(
      Level.error,
      'Cannot feed with Float32 on a Codec <> pcmFloat32',
    );
    throw Exception('Cannot feed with Float32 with interleaved mode');
  }
  if (interleaved) {
    callback!.log(
      Level.error,
      'Cannot feed with Float32 with interleaved mode',
    );
    throw Exception('Cannot feed with Float32 with interleaved mode');
  }
  if (data.length != numChannels) {
    callback!.log(
      Level.error,
      'feedFloat32() : data length (${data.length}) != the number of channels ($numChannels)',
    );
    throw Exception(
      'feedFloat32() : data length (${data.length}) != the number of channels ($numChannels)',
    );
  }
  List<JSAny> r = [];
  for (int channel = 0; channel < data.length; ++channel) {
    r.add(data[channel].toJS);
  }
  postMessage('SEND_FEED_F32', r.toJS);
  //callback!.needSomeFood(0); // temporary
  return 0; // Length written
}