forked from paulh002/sdrberry
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAudioInput.h
More file actions
47 lines (43 loc) · 1.11 KB
/
AudioInput.h
File metadata and controls
47 lines (43 loc) · 1.11 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once
#include "RtAudio.h"
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstring>
#include "Audiodefs.h"
#include "DataBuffer.h"
class AudioInput : public RtAudio
{
public:
bool init(std::string device, int pcmrate, bool stereo, DataBuffer<Sample> *AudioBuffer);
bool open();
void adjust_gain(SampleVector& samples);
bool read(SampleVector& samples);
void close();
~AudioInput();
double get_volume() {return m_volume;}
void set_volume(double vol) {m_volume = vol; }
void ToneBuffer(int tone);
DataBuffer<Sample> *get_databuffer() {return databuffer;};
bool get_stereo() {return m_stereo;};
float get_rms_level();
void set_level(float f);
operator bool() const
{
return (!m_zombie) && m_error.empty();
}
private:
RtAudio::StreamParameters parameters;
unsigned int sampleRate;
unsigned int bufferFrames;
double m_volume {0.5};
DataBuffer<Sample> *databuffer;
string m_error;
bool m_zombie {false};
long asteps {0};
bool m_stereo;
double Nexttone();
double NextTwotone();
float m_level;
};
extern AudioInput *audio_input;