capo-lite v2.1.0
Simple audio playback library
 
Loading...
Searching...
No Matches
capo::IStream Class Referenceabstract

Interface for custom audio stream (data source). Supports streaming data of indefinite length. The API is in terms of samples, they are converted to frames by the library. More...

#include <capo/stream.hpp>

Inheritance diagram for capo::IStream:
capo::Polymorphic capo::IStreamPipe

Public Member Functions

virtual auto get_sample_rate () const -> std::uint32_t=0
 Must return positive value.
 
virtual auto get_channels () const -> std::uint8_t=0
 Must return positive value.
 
virtual auto read_samples (std::span< float > out) -> std::size_t=0
 
virtual auto seek_to_sample (std::size_t index) -> bool
 
virtual auto get_cursor () const -> std::optional< std::size_t >
 
virtual auto get_sample_count () const -> std::size_t
 
virtual auto set_looping (bool looping) -> bool
 Handle custom looping behavior, if applicable. Just return true / don't override for the bound Audio Source to use its own looping mechanism.
 
- Public Member Functions inherited from capo::Polymorphic
 Polymorphic ()=default
 
virtual ~Polymorphic ()=default
 
 Polymorphic (Polymorphic const &)=default
 
 Polymorphic (Polymorphic &&)=default
 
auto operator= (Polymorphic const &) -> Polymorphic &=default
 
auto operator= (Polymorphic &&) -> Polymorphic &=default
 

Detailed Description

Interface for custom audio stream (data source). Supports streaming data of indefinite length. The API is in terms of samples, they are converted to frames by the library.

Member Function Documentation

◆ get_channels()

virtual auto capo::IStream::get_channels ( ) const -> std::uint8_t
pure virtual

Must return positive value.

◆ get_cursor()

virtual auto capo::IStream::get_cursor ( ) const -> std::optional<std::size_t>
inlinevirtual
Returns
nullopt if not supported.

◆ get_sample_count()

virtual auto capo::IStream::get_sample_count ( ) const -> std::size_t
inlinevirtual
Returns
0 if not supported.

◆ get_sample_rate()

virtual auto capo::IStream::get_sample_rate ( ) const -> std::uint32_t
pure virtual

Must return positive value.

◆ read_samples()

virtual auto capo::IStream::read_samples ( std::span< float >  out) -> std::size_t
pure virtual
Returns
Count of samples read, 0 if at end.

◆ seek_to_sample()

virtual auto capo::IStream::seek_to_sample ( std::size_t  index) -> bool
inlinevirtual
Parameters
indexSample index to seek to.
Returns
false if seeking is not supported.

◆ set_looping()

virtual auto capo::IStream::set_looping ( bool  looping) -> bool
inlinevirtual

Handle custom looping behavior, if applicable. Just return true / don't override for the bound Audio Source to use its own looping mechanism.

Returns
false if looping is not possible.

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