Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
roc::sndio::Pump Class Reference

Audio pump. More...

#include <pump.h>

Inheritance diagram for roc::sndio::Pump:
Collaboration diagram for roc::sndio::Pump:

Public Types

enum  Mode { ModePermanent = 0 , ModeOneshot = 1 }
 Pump mode. More...
 

Public Member Functions

 Pump (core::BufferFactory< audio::sample_t > &buffer_factory, ISource &source, ISource *backup_source, ISink &sink, core::nanoseconds_t frame_length, const audio::SampleSpec &sample_spec, Mode mode)
 Initialize. More...
 
bool is_valid () const
 Check if the object was successfulyl constructed. More...
 
ROC_ATTR_NODISCARD bool run ()
 Run the pump. More...
 
void stop ()
 Stop the pump. More...
 

Detailed Description

Audio pump.

Remarks
Reads frames from source and writes them to sink.

Definition at line 33 of file pump.h.

Member Enumeration Documentation

◆ Mode

Pump mode.

Definition at line 36 of file pump.h.

Constructor & Destructor Documentation

◆ Pump()

roc::sndio::Pump::Pump ( core::BufferFactory< audio::sample_t > &  buffer_factory,
ISource source,
ISource backup_source,
ISink sink,
core::nanoseconds_t  frame_length,
const audio::SampleSpec sample_spec,
Mode  mode 
)

Initialize.

Member Function Documentation

◆ is_valid()

bool roc::sndio::Pump::is_valid ( ) const

Check if the object was successfulyl constructed.

◆ run()

ROC_ATTR_NODISCARD bool roc::sndio::Pump::run ( )

Run the pump.

Remarks
Run until the stop() is called or, if oneshot mode is enabled, the source becomes inactive.

◆ stop()

void roc::sndio::Pump::stop ( )

Stop the pump.

Remarks
May be called from any thread.

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