setNoiseFilter method

void setNoiseFilter(
  1. bool bool
)

Implementation

void setNoiseFilter(bool bool) {
  this._isNoiseFilter = bool;
  if(channelWS != null ){
    channelWS!.sink.close();
    channelWS = null;
  }
  if(bool){
    channelWS = new IOWebSocketChannel.connect("ws://192.168.1.27/recv_audio");
//      _streamingController.streamingAudioRecord(element);
    channelWS!.stream.listen((dynamic message) async{
      print("message");
      print(message.runtimeType);
      List<int> list  = new List.from(message);
      print(list.runtimeType);

      await _channel.invokeMethod('write', {"buffer": list});
      _streamingController!.streamingAudioRecord(list);

    },
        onDone: () {
          print('ws noise filter on done');
        },
        onError: (error) {

          print('ws noise filter $error');
        }
    );
  }else{
    channelWS!.sink.close();
    channelWS = null;
  }
}