getDefaultFormat method
Get supported audio formats for a given loopback device.
Implementation
@override
Future<MiniAVAudioInfo> getDefaultFormat(String deviceId) async {
final deviceIdPtr = deviceId.toNativeUtf8();
final formatOutPtr = calloc<bindings.MiniAVAudioInfo>();
try {
final res = bindings.MiniAV_Loopback_GetDefaultFormat(
deviceIdPtr.cast<ffi.Char>(),
formatOutPtr,
);
if (res != bindings.MiniAVResultCode.MINIAV_SUCCESS) {
throw Exception(
'Failed to get default loopback format for $deviceId: ${res.name}',
);
}
return AudioInfoFFIToPlatform.fromNative(
formatOutPtr.ref,
).toPlatformType();
} finally {
calloc.free(deviceIdPtr);
calloc.free(formatOutPtr);
}
}