move portaudio common record code to microphone (#2264)

Co-authored-by: cqm <cqm@97kid.com>
This commit is contained in:
mtdxc
2025-05-31 21:48:41 +08:00
committed by GitHub
parent 921f0f40cb
commit 613e8084c2
12 changed files with 130 additions and 446 deletions

View File

@@ -4,13 +4,22 @@
#ifndef SHERPA_ONNX_CSRC_MICROPHONE_H_
#define SHERPA_ONNX_CSRC_MICROPHONE_H_
#include "portaudio.h" // NOLINT
namespace sherpa_onnx {
class Microphone {
PaStream *stream = nullptr;
public:
Microphone();
~Microphone();
int GetDeviceCount() const;
int GetDefaultInputDevice() const;
void PrintDevices(int sel) const;
bool OpenDevice(int index, int sample_rate, int channel, PaStreamCallback cb, void* userdata);
void CloseDevice();
};
} // namespace sherpa_onnx