AlHo Tuner
micmanager.h
1 #ifndef MICMANAGER_H
2 #define MICMANAGER_H
3 
4 #include <string.h>
5 #include <iostream>
6 #include <math.h>
7 #include "alsa/asoundlib.h"
8 #include "dspmanager.h"
9 
13 class MicManager {
14 
15  public:
16  MicManager(short bufferSizeMatrix, int totalBufferSize, long int sampleFreq);
20  void readBuffer();
24  void closeDev();
28  void populateTotalBuffer();
33  void setBufferSize(int size);
38  void setTotalBufferSize(int size);
43  void setSampleRate(long int sr);
47  void openDev();
52  void setDev(int sr);
53 
58  short *getBuffer();
63  short *getTotalBuffer();
69  short getMaxima(double *t);
70 
71  private:
72 
73  int index = 0;
74  int err_code;
75  int buffer_size;
76  int total_buffer_size;
77  long int sample_rate;
78 
79  short *buffer;
80  short *total_buffer;
81 
82  const char *device = "default";
83  snd_pcm_t *handle_capture;
84  snd_pcm_sframes_t frames;
85 };
86 
87 #endif /* MICMANAGER_H */
88 
Permite la captura de micrófono a través de API de ALSA.
Definition: MicManager.h:9