MOS
Public Types | Public Member Functions | Static Public Member Functions | List of all members
mos::aud::Buffer Class Referencefinal

16bit integer audio buffer. More...

#include <buffer.hpp>

Public Types

using Samples = std::vector< short >
 

Public Member Functions

template<class T >
 Buffer (const T begin, const T end, const int channels=1, const int sample_rate=44100)
 Construct buffer from a container of shorts. More...
 
 Buffer (int channels=1, int sample_rate=44100)
 Empty buffer constructor. More...
 
Samples::const_iterator begin () const
 
Samples::const_iterator end () const
 
auto data () const -> const short *
 Raw data. More...
 
auto id () const -> unsigned int
 Unique id. More...
 
auto channels () const -> int
 Get number of channels. More...
 
auto sample_rate () const -> int
 Get sample rate.
 
auto duration () const -> float
 Duration in seconds. More...
 
auto size () const -> size_t
 Size of samples container. More...
 

Static Public Member Functions

static auto load (const std::filesystem::path &path) -> Buffer
 Load shared buffer. More...
 

Detailed Description

16bit integer audio buffer.

Constructor & Destructor Documentation

◆ Buffer() [1/2]

template<class T >
mos::aud::Buffer::Buffer ( const T  begin,
const T  end,
const int  channels = 1,
const int  sample_rate = 44100 
)
inline

Construct buffer from a container of shorts.

◆ Buffer() [2/2]

mos::aud::Buffer::Buffer ( int  channels = 1,
int  sample_rate = 44100 
)
explicit

Empty buffer constructor.

Member Function Documentation

◆ channels()

auto mos::aud::Buffer::channels ( ) const -> int

Get number of channels.

◆ data()

auto mos::aud::Buffer::data ( ) const -> const short *

Raw data.

◆ duration()

auto mos::aud::Buffer::duration ( ) const -> float

Duration in seconds.

◆ id()

auto mos::aud::Buffer::id ( ) const -> unsigned int

Unique id.

◆ load()

static auto mos::aud::Buffer::load ( const std::filesystem::path &  path) -> Buffer
static

Load shared buffer.

◆ size()

auto mos::aud::Buffer::size ( ) const -> size_t

Size of samples container.


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