enqueue method
Appends samples — mono Int16 at sampleRate — to the playback queue,
opening the output on the first chunk. Resolves once the platform holds
the chunk.
Throws XAudioSinkException when the output cannot open.
Implementation
@override
Future<void> enqueue(Int16List samples) {
final generation = _generation;
return _enqueue(() async {
if (!supported) {
throw XAudioSinkException('unsupported', '$defaultTargetPlatform');
}
if (samples.isEmpty) return;
if (generation != _generation) return;
try {
await _methods.invokeMethod<void>('enqueue', encodePcm(samples));
} on PlatformException catch (e) {
throw XAudioSinkException(e.code, e.message);
}
});
}