play method

bool play(
  1. Device device,
  2. Uint8List samples
)

Play a block of audio data to an open device. Samples are interleaved by channels.

Implementation

bool play(
  Device device,
  Uint8List samples,
) {
  final data = calloc<Int8>(samples.lengthInBytes);

  for (var i = 0; i < samples.length; i++) {
    data[i] = samples[i];
  }

  try {
    return _play(device._device, data, samples.lengthInBytes) != 0;
  } finally {
    calloc.free(data);
  }
}