您不能選擇超過 %s 個話題 話題必須以字母或數字為開頭,可包含連接號 ('-') 且最長為 35 個字
 
 
 
 
 
 

26 行
645 B

  1. import 'dart:typed_data';
  2. import 'dart:async';
  3. // ignore: camel_case_types
  4. class Xunfei_AudioTranslation_Result_Audio {
  5. final List<Uint8List> _buffer = [];
  6. final _streamController = StreamController<Uint8List>();
  7. // 向音频流添加数据
  8. void addAudioData(Uint8List data) {
  9. _buffer.add(data);
  10. _streamController.add(data); // 每当添加新数据时,推送到流
  11. }
  12. // 获取音频数据流
  13. Stream<Uint8List> get audioStream => _streamController.stream;
  14. // 获取当前缓存的所有数据
  15. List<Uint8List> get buffer => List.from(_buffer);
  16. // 关闭流
  17. void close() {
  18. _streamController.close();
  19. }
  20. }