openLive method

Device openLive(
  1. int driverId, {
  2. int bits = 16,
  3. int rate = 44100,
  4. int channels = 2,
  5. ByteFormat byteFormat = ByteFormat.little,
  6. String? matrix,
})

Open a live playback audio device for output.

matrix specifies the mapping of input channels to intended speaker/ouput location. See https://www.xiph.org/ao/doc/ao_sample_format.html for more information.

Implementation

Device openLive(
  int driverId, {
  int bits = 16,
  int rate = 44100,
  int channels = 2,
  ByteFormat byteFormat = ByteFormat.little,
  String? matrix,
}) {
  final sampleFormat = calloc<_SampleFormat>();
  sampleFormat.ref.bits = bits;
  sampleFormat.ref.rate = rate;
  sampleFormat.ref.channels = channels;
  sampleFormat.ref.byteFormat = _byteFormatToInt(byteFormat);
  if (matrix != null) sampleFormat.ref.matrix = matrix.toNativeUtf8();

  final device = _openLive(driverId, sampleFormat, nullptr).address;

  calloc.free(sampleFormat);

  return Device._(Pointer.fromAddress(device));
}