HulaLoop
Simple cross-platform audio loopback and recording.
Public Member Functions | Static Public Member Functions | List of all members
hula::OSXAudio Class Reference

A audio class that captures system wide audio on OSX. More...

#include <OSXAudio.h>

Inheritance diagram for hula::OSXAudio:
Inheritance graph
[legend]
Collaboration diagram for hula::OSXAudio:
Collaboration graph
[legend]

Public Member Functions

 OSXAudio ()
 Constructs an instance of OSXAudio class. More...
 
virtual ~OSXAudio ()
 Deconstructs the OSXAudio instance.
 
void capture ()
 Execution loop for loopback capture. More...
 
bool checkRates (Device *device)
 Checks the sampling rate and bit depth of the device. More...
 
std::vector< Device * > getDevices (DeviceType type)
 Fetch devices of the specified type. More...
 
void setActiveOutputDevice (Device *device)
 Set the selected output device and restart capture threads with new device. More...
 
- Public Member Functions inherited from hula::OSAudio
virtual ~OSAudio ()=0
 Virtual implementation of Destructor.
 
void setBufferSize (uint32_t size)
 Set the desired capture buffer size. More...
 
void addBuffer (HulaRingBuffer *rb)
 Add an initialized buffer to the list of buffers that receive audio data. More...
 
void removeBuffer (HulaRingBuffer *rb)
 Remove a buffer from the list of buffers that receive audio data. More...
 
void copyToBuffers (const void *data, uint32_t bytes)
 Write to each of the buffers contained in rbs.
 
void setActiveInputDevice (Device *device)
 Set the selected input device and restart capture threads with new device. More...
 
void setActiveOutputDevice (Device *device)
 Set the selected output device and restart capture threads with new device. More...
 

Static Public Member Functions

static void test_capture (OSAudio *_this)
 Static function in the current instance of the class to allow thread execution. More...
 
- Static Public Member Functions inherited from hula::OSAudio
static void backgroundCapture (OSAudio *_this)
 Static function to allow starting a thread with an instance's capture method. More...
 

Additional Inherited Members

- Protected Member Functions inherited from hula::OSAudio
 OSAudio ()
 Constructor is protected since this class is abstract.
 
- Protected Attributes inherited from hula::OSAudio
DeviceactiveInputDevice
 The selected input device.
 
DeviceactiveOutputDevice
 The selected output device.
 
std::vector< HulaRingBuffer * > rbs
 List of all added ring buffers. More...
 
std::vector< std::thread > inThreads
 Thread for input device activities.
 
std::vector< std::thread > outThreads
 Thread for output device activities.
 
std::atomic< bool > endCapture
 Flag to syncronize the capture thread for an instance. More...
 
uint32_t captureBufferSize
 I don't really know what this is for right now but I'm going to add this comment so that Doxygen will quit complaining. More...
 

Detailed Description

A audio class that captures system wide audio on OSX.

Constructor & Destructor Documentation

OSXAudio::OSXAudio ( )

Constructs an instance of OSXAudio class.

This will initialize an OSXDaemon which will handle the virtual loopback. OSXDaemon will join or start a JACK server to get audio.

Member Function Documentation

void OSXAudio::capture ( )
virtual

Execution loop for loopback capture.

Based on code from https://app.assembla.com/spaces/portaudio/git/source/master/examples/paex_record_file.c

Implements hula::OSAudio.

bool OSXAudio::checkRates ( Device device)
virtual

Checks the sampling rate and bit depth of the device.

Parameters
deviceInstance of Device that corresponds to the desired system device

Implements hula::OSAudio.

std::vector< Device * > OSXAudio::getDevices ( DeviceType  type)
virtual

Fetch devices of the specified type.

These devices must be deleted by the caller using the Device::deleteDevices() method.

The list is designed for one-time use. Get the list, use the device, delete the list immediately.

DO NOT STORE THIS as it may become out-of-date.

Returns
List of Device objects

Implements hula::OSAudio.

void OSXAudio::setActiveOutputDevice ( Device device)

Set the selected output device and restart capture threads with new device.

Parameters
deviceInstance of Device that corresponds to the desired system device
void OSXAudio::test_capture ( OSAudio _this)
static

Static function in the current instance of the class to allow thread execution.

Parameters
_thisInstance of the current object

The documentation for this class was generated from the following files: