6 #include <stb_vorbis.h> 9 #include <mos/core/id.hpp> 14 using Shared_stream = std::shared_ptr<Stream>;
19 explicit Stream(
const std::string &path);
26 static const int buffer_size = 4096 * 8;
29 auto read() -> std::array<short, buffer_size>;
32 auto done()
const -> bool;
38 auto channels()
const ->
unsigned int;
44 auto size()
const -> size_t;
50 auto id()
const ->
unsigned int;
54 unsigned int samples_left_;
55 std::string file_name_;
56 stb_vorbis *vorbis_stream_;
57 stb_vorbis_info vorbis_info_;
auto read() -> std::array< short, buffer_size >
Read a chunk of data from the stream.
Audio streaming from *.ogg file.
Definition: stream.hpp:17
auto duration() const -> float
Duration in seconds.
auto id() const -> unsigned int
Unique id.
auto done() const -> bool
Check if stream reached the end.
auto seek_start() -> void
Restart streaming.
auto channels() const -> unsigned int
Get number of channels.
auto size() const -> size_t
Size of stream in samples.
auto sample_rate() const -> unsigned int
Sample rate, eg 44100.
Definition: filter.hpp:13