initFile method
Future<void>
initFile(
- String filename, {
- int sampleRate = 44100,
- int channels = 1,
- SoundFormat format = SoundFormat.f32,
Initializes the recorder to save to a file.
Implementation
Future<void> initFile(
String filename, {
int sampleRate = 44100,
int channels = 1,
SoundFormat format = SoundFormat.f32,
}) async {
if (sampleRate <= 0 || channels <= 0) {
throw ArgumentError("Invalid recorder parameters");
}
if (!_isInit) {
await _recorder.initFile(
filename,
sampleRate: sampleRate,
channels: channels,
format: format,
);
_isInit = true;
}
}