openFile method
Open a file for audio output. The file format is determined by the audio driver used.
Implementation
Device openFile(
int driverId,
String filename, {
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 =
_openFile(driverId, filename.toNativeUtf8(), 1, sampleFormat, nullptr)
.address;
calloc.free(sampleFormat);
return Device._(Pointer.fromAddress(device));
}