Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
roc::sndio::ISource Class Referenceabstract

Source interface. More...

#include <isource.h>

Inheritance diagram for roc::sndio::ISource:
roc::sndio::ITerminal roc::audio::IFrameReader roc::core::ListNode roc::core::NonCopyable< ListNode > roc::pipeline::ConverterSource roc::pipeline::ReceiverLoop roc::pipeline::ReceiverSource roc::sndio::SoxSource

Public Types

enum  State { Playing , Idle , Paused }
 Source state. More...
 

Public Member Functions

virtual State state () const =0
 Get current source state.
 
virtual void pause ()=0
 Pause reading.
 
virtual bool resume ()=0
 Resume paused reading.
 
virtual bool restart ()=0
 Restart reading from the beginning.
 
virtual void reclock (packet::ntp_timestamp_t timestamp)=0
 Adjust source clock to match consumer clock.
 
- Public Member Functions inherited from roc::sndio::ITerminal
virtual audio::SampleSpec sample_spec () const =0
 Get sample specification of the terminal.
 
virtual core::nanoseconds_t latency () const =0
 Get latency of the terminal.
 
virtual bool has_clock () const =0
 Check if the terminal has own clock.
 
- Public Member Functions inherited from roc::audio::IFrameReader
virtual bool read (Frame &frame)=0
 Read audio frame.
 
- Public Member Functions inherited from roc::core::ListNode
ListNodeDatalist_node_data () const
 Get list node data.
 

Detailed Description

Source interface.

Definition at line 23 of file isource.h.

Member Enumeration Documentation

◆ State

Source state.

Enumerator
Playing 

Source is running and active. It is producing some sound.

Idle 

Source is running but is inactive. It is producing silence. It may be safely paused.

Paused 

Source is paused. It's not producing anything.

Definition at line 28 of file isource.h.

Member Function Documentation

◆ pause()

virtual void roc::sndio::ISource::pause ( )
pure virtual

◆ reclock()

virtual void roc::sndio::ISource::reclock ( packet::ntp_timestamp_t  timestamp)
pure virtual

Adjust source clock to match consumer clock.

Remarks
Invoked regularly after reading every or a several frames. timestamp defines the time in NTP domain when the last sample of the last frame read from source is going to be actually processed by consumer.

Implemented in roc::pipeline::ConverterSource, roc::pipeline::ReceiverSource, and roc::sndio::SoxSource.

◆ restart()

virtual bool roc::sndio::ISource::restart ( )
pure virtual

Restart reading from the beginning.

Remarks
If the reading is paused, it's automatically resumed.
Returns
false if an error occured.

Implemented in roc::pipeline::ConverterSource, roc::pipeline::ReceiverSource, and roc::sndio::SoxSource.

◆ resume()

virtual bool roc::sndio::ISource::resume ( )
pure virtual

Resume paused reading.

Returns
false if an error occured.

Implemented in roc::pipeline::ConverterSource, roc::pipeline::ReceiverSource, and roc::sndio::SoxSource.

◆ state()

virtual State roc::sndio::ISource::state ( ) const
pure virtual

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