HulaLoop
Simple cross-platform audio loopback and recording.
LinuxAudio.h
1 #ifndef HL_LINUX_AUDIO_H
2 #define HL_LINUX_AUDIO_H
3 
4 #include <alsa/asoundlib.h>
5 
6 #include <stdlib.h>
7 #include <cstdint>
8 #include <iostream>
9 #include <thread>
10 #include <vector>
11 
12 #include "hlaudio/internal/Device.h"
13 #include "hlaudio/internal/OSAudio.h"
14 
15 #ifndef ALSA_PCM_NEW_HW_PARAMS_API
16  #define ALSA_PCM_NEW_HW_PARAMS_API
17 #endif
18 #define FRAME_TIME 8192
19 using byte = uint8_t;
20 
21 namespace hula
22 {
23  class LinuxAudio : public OSAudio {
24  private:
25  int bitrate;
26  std::vector<Device *> iDevices;
27  std::vector<Device *> oDevices;
28 
29  public:
30  LinuxAudio();
31  ~LinuxAudio();
32  void capture();
33 
34  static void startPAVUControl();
35 
36  std::vector<Device *> getDevices(DeviceType type);
37 
38  bool checkRates(Device *device);
39 
40  void setActiveOutputDevice(Device *device);
41  };
42 }
43 
44 #endif // HL_LINUX_AUDIO_H
bool checkRates(Device *device)
Check with the hardware to ensure that the current audio settings are valid for the selected device...
Definition: LinuxAudio.cpp:106
Abstract class that defines the required components for OS specfic audio classes. ...
Definition: OSAudio.h:19
~LinuxAudio()
Destructor for LinuxAudio.
Definition: LinuxAudio.cpp:290
std::vector< Device * > getDevices(DeviceType type)
Fetch devices of the specified type.
Definition: LinuxAudio.cpp:25
void setActiveOutputDevice(Device *device)
DEPRECATED: To be replaced by OSAudio::setActiveOutputDevice.
Definition: LinuxAudio.cpp:156
void capture()
Capture loop for LinuxAudio.
Definition: LinuxAudio.cpp:204
LinuxAudio()
Construct a new instance of LinuxAudio.
Definition: LinuxAudio.cpp:9
static void startPAVUControl()
Open the program Pulse Audio Volume Control to the Record tab.
Definition: LinuxAudio.cpp:191
Definition: LinuxAudio.h:23
Wrapper for OS specific device information.
Definition: Device.h:34
Definition: Controller.h:11