소스 검색

Fix code style issues (#11)

Fangjun Kuang 2 년 전
부모
커밋
ba970a487c
5개의 변경된 파일20개의 추가작업 그리고 17개의 파일을 삭제
  1. 3 1
      sherpa-ncnn/csrc/decode.h
  2. 2 1
      sherpa-ncnn/csrc/features.cc
  3. 1 1
      sherpa-ncnn/csrc/features.h
  4. 1 1
      sherpa-ncnn/csrc/microphone.cc
  5. 13 13
      sherpa-ncnn/csrc/sherpa-ncnn-microphone.cc

+ 3 - 1
sherpa-ncnn/csrc/decode.h

@@ -19,7 +19,9 @@
 #ifndef SHERPA_NCNN_CSRC_DECODE_H_
 #define SHERPA_NCNN_CSRC_DECODE_H_
 
-#include "net.h"
+#include <vector>
+
+#include "net.h"  // NOLINT
 #include "sherpa-ncnn/csrc/lstm-model.h"
 
 namespace sherpa_ncnn {

+ 2 - 1
sherpa-ncnn/csrc/features.cc

@@ -18,9 +18,10 @@
 
 #include "sherpa-ncnn/csrc/features.h"
 
+#include <algorithm>
 #include <memory>
 
-#include "mat.h"
+#include "mat.h"  // NOLINT
 
 namespace sherpa_ncnn {
 

+ 1 - 1
sherpa-ncnn/csrc/features.h

@@ -20,7 +20,7 @@
 #define SHERPA_NCNN_CSRC_FEATURES_H_
 
 #include <memory>
-#include <mutex>
+#include <mutex>  // NOLINT
 
 #include "kaldi-native-fbank/csrc/online-feature.h"
 

+ 1 - 1
sherpa-ncnn/csrc/microphone.cc

@@ -21,7 +21,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "portaudio.h"
+#include "portaudio.h"  // NOLINT
 
 namespace sherpa_ncnn {
 

+ 13 - 13
sherpa-ncnn/csrc/sherpa-ncnn-microphone.cc

@@ -20,7 +20,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "portaudio.h"
+#include "portaudio.h"  // NOLINT
 #include "sherpa-ncnn/csrc/decode.h"
 #include "sherpa-ncnn/csrc/features.h"
 #include "sherpa-ncnn/csrc/lstm-model.h"
@@ -29,10 +29,11 @@
 
 bool stop = false;
 
-static int recordCallback(const void *input_buffer, void *outputBuffer,
-                          unsigned long frames_per_buffer,
-                          const PaStreamCallbackTimeInfo *timeInfo,
-                          PaStreamCallbackFlags statusFlags, void *user_data) {
+static int RecordCallback(const void *input_buffer, void * /*output_buffer*/,
+                          unsigned long frames_per_buffer,  // NOLINT
+                          const PaStreamCallbackTimeInfo * /*time_info*/,
+                          PaStreamCallbackFlags /*status_flags*/,
+                          void *user_data) {
   auto feature_extractor =
       reinterpret_cast<sherpa_ncnn::FeatureExtractor *>(user_data);
 
@@ -118,14 +119,13 @@ https://huggingface.co/csukuangfj/sherpa-ncnn-2022-09-05
   float sample_rate = 16000;
 
   PaStream *stream;
-  PaError err = Pa_OpenStream(&stream, &param, nullptr, /* &outputParameters, */
-                              sample_rate,
-                              0,         // frames per buffer
-                              paClipOff, /* we won't output out of range samples
-                                            so don't bother clipping them */
-                              recordCallback,
-                              &feature_extractor  // userdata
-  );
+  PaError err =
+      Pa_OpenStream(&stream, &param, nullptr, /* &outputParameters, */
+                    sample_rate,
+                    0,          // frames per buffer
+                    paClipOff,  // we won't output out of range samples
+                                // so don't bother clipping them
+                    RecordCallback, &feature_extractor);
   if (err != paNoError) {
     fprintf(stderr, "portaudio error: %s\n", Pa_GetErrorText(err));
     exit(EXIT_FAILURE);