Skip to content

Commit

Permalink
Fix code style issues (k2-fsa#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj authored Sep 21, 2022
1 parent 1af9ab6 commit 0f70b89
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 17 deletions.
4 changes: 3 additions & 1 deletion sherpa-ncnn/csrc/decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion sherpa-ncnn/csrc/features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@

#include "sherpa-ncnn/csrc/features.h"

#include <algorithm>
#include <memory>

#include "mat.h"
#include "mat.h" // NOLINT

namespace sherpa_ncnn {

Expand Down
2 changes: 1 addition & 1 deletion sherpa-ncnn/csrc/features.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion sherpa-ncnn/csrc/microphone.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <stdio.h>
#include <stdlib.h>

#include "portaudio.h"
#include "portaudio.h" // NOLINT

namespace sherpa_ncnn {

Expand Down
26 changes: 13 additions & 13 deletions sherpa-ncnn/csrc/sherpa-ncnn-microphone.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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);

Expand Down Expand Up @@ -118,14 +119,13 @@ You can download pre-trained models from the following repository:
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);
Expand Down

0 comments on commit 0f70b89

Please sign in to comment.