游雁
2023-11-20 df03a020f6d8fe4e9b09c1e784fead2852d90bfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
 * Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights
 * Reserved. MIT License  (https://opensource.org/licenses/MIT)
 */
 
#include "microphone.h"
 
#include <stdio.h>
#include <stdlib.h>
 
#include "portaudio.h"  // NOLINT
 
Microphone::Microphone() {
  PaError err = Pa_Initialize();
  if (err != paNoError) {
    LOG(ERROR)<<"portaudio error: " << Pa_GetErrorText(err);
    exit(-1);
  }
}
 
Microphone::~Microphone() {
  PaError err = Pa_Terminate();
  if (err != paNoError) {
    LOG(ERROR)<<"portaudio error: " << Pa_GetErrorText(err);
    exit(-1);
  }
}