12 using Shared_buffer = std::shared_ptr<Buffer>;
17 using Samples = std::vector<short>;
23 : id_(current_id_++), samples_(begin, end), channels_(
channels),
30 static auto load(
const std::filesystem::path &path) ->
Buffer;
32 Samples::const_iterator begin()
const;
34 Samples::const_iterator end()
const;
37 auto data()
const ->
const short *;
40 auto id()
const ->
unsigned int;
52 auto size()
const -> size_t;
55 static std::atomic_uint current_id_;
auto id() const -> unsigned int
Unique id.
auto sample_rate() const -> int
Get sample rate.
auto channels() const -> int
Get number of channels.
static auto load(const std::filesystem::path &path) -> Buffer
Load shared buffer.
16bit integer audio buffer.
Definition: buffer.hpp:15
auto size() const -> size_t
Size of samples container.
auto duration() const -> float
Duration in seconds.
Buffer(const T begin, const T end, const int channels=1, const int sample_rate=44100)
Construct buffer from a container of shorts.
Definition: buffer.hpp:21
auto data() const -> const short *
Raw data.
Definition: filter.hpp:13