HulaLoop
Simple cross-platform audio loopback and recording.
Controller.h
1 #ifndef HL_CONTROLLER_H
2 #define HL_CONTROLLER_H
3 
4 #include <iostream>
5 #include <vector>
6 
7 #include "Device.h"
8 #include "OSAudio.h"
9 #include "HulaRingBuffer.h"
10 
11 namespace hula
12 {
19  class Controller {
20  private:
21  OSAudio *audio;
22 
23  public:
24  #ifndef NDEBUG
25  Controller(bool dryRun);
26  #endif // END NDEBUG
27 
28  Controller();
29  virtual ~Controller();
30 
31  void addBuffer(HulaRingBuffer *rb);
32  void removeBuffer(HulaRingBuffer *rb);
33  HulaRingBuffer *createBuffer(float duration);
34  HulaRingBuffer *createAndAddBuffer(float duration);
35 
36  std::vector<Device *> getDevices(DeviceType type) const;
37 
38  void setActiveInputDevice(Device *device) const;
39  void setActiveOutputDevice(Device *device) const;
40  };
41 }
42 
43 #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:169
std::vector< Device * > getDevices(DeviceType type) const
Fetch a list of devices for the given DeviceType.
Definition: Controller.cpp:129
void setActiveOutputDevice(Device *device) const
Set the device to which audio should be played back.
Definition: Controller.cpp:161
void setActiveInputDevice(Device *device) const
Set the device from which audio should be captured.
Definition: Controller.cpp:145
HulaLoop wrapper class for PortAudio ring buffer.
Definition: HulaRingBuffer.h:86
Wrapper for OS specific device information.
Definition: Device.h:34
Definition: Controller.h:11
HulaRingBuffer * createBuffer(float duration)
Allocate and initialize a HulaRingBuffer that can be added to the OSAudio ring buffer list via Contro...
Definition: Controller.cpp:78
Central component of the audio backend.
Definition: Controller.h:19
void addBuffer(HulaRingBuffer *rb)
Add an initialized buffer to the list of buffers that receive audio data.
Definition: Controller.cpp:65
void removeBuffer(HulaRingBuffer *rb)
Remove a buffer from the list of buffers that receive audio data.
Definition: Controller.cpp:109
Controller()
Construct an instance of Controller class.
Definition: Controller.cpp:21
HulaRingBuffer * createAndAddBuffer(float duration)
Allocate and initialize a HulaRingBuffer and automatically add it to the OSAudio ring buffer list...
Definition: Controller.cpp:89