convertToWavBytes method
Future<Uint8List>
convertToWavBytes(
- Uint8List inputData,
- String formatHint, {
- int? sampleRate,
- int? channels,
- int? bitDepth,
- bool? includeHeader,
override
Implementation
@override
Future<Uint8List> convertToWavBytes(
Uint8List inputData,
String formatHint, {
int? sampleRate,
int? channels,
int? bitDepth,
bool? includeHeader,
}) async {
try {
var buffer = await _decodeAudioData(inputData);
if (sampleRate != null && sampleRate != buffer.sampleRate.toInt()) {
buffer = await _resample(buffer, sampleRate);
}
return _encodeWav(
buffer,
targetChannels: channels,
targetBitDepth: bitDepth,
includeHeader: includeHeader ?? true,
);
} catch (e) {
if (e is AudioConversionException) rethrow;
throw AudioConversionException('WAV conversion failed: $e');
}
}