Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code style issues #11

Merged
merged 1 commit into from
Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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