move portaudio common record code to microphone (#2264)
Co-authored-by: cqm <cqm@97kid.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user