HulaLoop
Simple cross-platform audio loopback and recording.
Controller.h
1 #ifndef HL_CONTROLLER_H
2 #define HL_CONTROLLER_H
3 
4 #include <vector>
5 
6 #include "Device.h"
7 #include "OSAudio.h"
8 #include "HulaRingBuffer.h"
9 
10 namespace hula
11 {
18  class Controller {
19 
20  private:
21  OSAudio *audio;
22 
23  public:
24  Controller();
25  virtual ~Controller();
26 
27  void addBuffer(HulaRingBuffer *rb);
28  void removeBuffer(HulaRingBuffer *rb);
29  HulaRingBuffer *createBuffer(float duration);
30  HulaRingBuffer *createAndAddBuffer(float duration);
31 
32  std::vector<Device *> getDevices(DeviceType type) const;
33 
34  bool setActiveInputDevice(Device *device) const;
35  bool setActiveOutputDevice(Device *device) const;
36  };
37 }
38 
39 #endif // END HL_CONTROLLER_H
Abstract class that defines the required components for OS specfic audio classes. ...
Definition: OSAudio.h:19
virtual ~Controller()
Deconstructs the current instance of the Controller class.
Definition: Controller.cpp:187
std::vector< Device * > getDevices(DeviceType type) const
Fetch a list of devices for the given DeviceType.
Definition: Controller.cpp:131
bool setActiveInputDevice(Device *device) const
Set the device from which audio should be captured.
Definition: Controller.cpp:155
HulaLoop wrapper class for PortAudio ring buffer.
Definition: HulaRingBuffer.h:86
bool setActiveOutputDevice(Device *device) const
Set the device to which audio should be played back.
Definition: Controller.cpp:179
Wrapper for OS specific device information.
Definition: Device.h:55
Wrapper around translation functions for Qt.
Definition: Controller.h:10
HulaRingBuffer * createBuffer(float duration)
Allocate and initialize a HulaRingBuffer that can be added to the OSAudio ring buffer list via Contro...
Definition: Controller.cpp:65
Central component of the audio backend.
Definition: Controller.h:18
DeviceType
Denotes type of Device.
Definition: Device.h:18
void addBuffer(HulaRingBuffer *rb)
Add an initialized buffer to the list of buffers that receive audio data.
Definition: Controller.cpp:52
void removeBuffer(HulaRingBuffer *rb)
Remove a buffer from the list of buffers that receive audio data.
Definition: Controller.cpp:111
Controller()
Construct an instance of Controller class.
Definition: Controller.cpp:23
HulaRingBuffer * createAndAddBuffer(float duration)
Allocate and initialize a HulaRingBuffer and automatically add it to the OSAudio ring buffer list...
Definition: Controller.cpp:83