All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Resonant::DSPNetwork Class Reference

An audio signal processing engine. More...

#include <Resonant/DSPNetwork.hpp>

Classes

class  Buf
 Holds audio sample buffers for inter-module transfer. More...
 
class  Connection
 Holds connection information between the DSP modules. More...
 
class  Item
 Stores a simple audio processing Resonant::Module. More...
 
class  NewConnection
 Objects that store the information necessary to create new connections. More...
 

Public Types

enum  AudioLoopBackend { AUDIO_LOOP_DEFAULT, AUDIO_LOOP_PORT_AUDIO, AUDIO_LOOP_PULSE_AUDIO }
 Which AudioLoop backend to use.
 
typedef std::shared_ptr< ItemItemPtr
 

Public Member Functions

void addModule (ItemPtr item)
 Adds a DSP Resonant::Module to the signal processing graph. More...
 
AudioLoopaudioLoop ()
 
ItemPtr findItem (const QByteArray &id)
 Finds an item that holds a module with given id. More...
 
ModulePtr findModule (const QByteArray &id)
 Finds a module with name id inside one of the items in DSPNetwork. More...
 
bool hasPanner () const
 
bool isRunning () const
 
std::size_t itemCount () const
 
void markDone (ItemPtr)
 Marks a given DSP module as finished. More...
 
void markDone (ModulePtr module)
 Marks a given DSP module as finished. More...
 
std::shared_ptr< ModulePannerpanner ()
 Returns the panner module or NULL.
 
std::shared_ptr
< ModuleSamplePlayer
samplePlayer ()
 Returns the default sample player object. More...
 
void send (Radiant::BinaryData &control)
 Send binary control data to the DSP network. More...
 
bool start (AudioLoopBackend backend=AUDIO_LOOP_DEFAULT)
 Starts the DSPNetwork, using given audio device. More...
 

Detailed Description

An audio signal processing engine.

DSPNetwork implements a simple signal processing graph driver. The graph has hot-plug -feature so new modules can be added in run-time, and the engine will re-wire the connetions as necessary.

DSPNetwork is a singleton. The instance is kept alive as long as there is a reference to the shared pointer returned by the DSPNetwork::instance() function. It is strongly recommended that you keep a reference to it during the lifetime of your application.

Member Function Documentation

void Resonant::DSPNetwork::addModule ( ItemPtr  item)

Adds a DSP Resonant::Module to the signal processing graph.

This function does not perform the actual addition, but puts the module into a FIFO, for the signal processing thread.

ItemPtr Resonant::DSPNetwork::findItem ( const QByteArray &  id)

Finds an item that holds a module with given id.

Parameters
idModule id,
See Also
Module::id()
Returns
Pointer to the item inside DSPNetwork or NULL
ModulePtr Resonant::DSPNetwork::findModule ( const QByteArray &  id)

Finds a module with name id inside one of the items in DSPNetwork.

Parameters
idModule id,
See Also
Module::id()
Returns
Pointer to the module or NULL
void Resonant::DSPNetwork::markDone ( ItemPtr  )

Marks a given DSP module as finished.

Once this function has been called the DSP thread will remove the module from the graph, and delete it.

void Resonant::DSPNetwork::markDone ( ModulePtr  module)

Marks a given DSP module as finished.

Once this function has been called the DSP thread will remove the module from the graph, and delete it.

std::shared_ptr<ModuleSamplePlayer> Resonant::DSPNetwork::samplePlayer ( )

Returns the default sample player object.

If the object does not exis yet, it is created on the fly.

Returns
Default sampley player object
void Resonant::DSPNetwork::send ( Radiant::BinaryData control)

Send binary control data to the DSP network.

    When sending messages, the BinaryData object should contain an identifier string
    in the beginning. The DSPNetwork will read this string, and pass the command to the
    corresponding #Resonant::Module. Typical example of use could be:
control.writeString("moviegain/gain");
control.writeFloat32(0.3);
DSPNetwork::instance().send(control);
Parameters
controlIdentifier string and correct commands for corresponding Module
bool Resonant::DSPNetwork::start ( AudioLoopBackend  backend = AUDIO_LOOP_DEFAULT)

Starts the DSPNetwork, using given audio device.

To get a list of possible sound device names we recommend you use utility application ListPortAudioDevices.

Parameters
backendAudioLoop backend
Returns
False on error