The base class for all audio output streams.
Inherited from std::ostream
- write(): inserts blocks of characters
Inherited from std::ostream.
tellp()
: returns the output position indicatorseekp()
:⚠️ is not implemented yet. It is unclear at this point if this fucntionality can be / will be added later on, as it seems not all codecs support seeking while encoding.
Inherited from std::basic_ios.
good()
: checks if no error has occurred i.e. I/O operations are availableeof()
: checks if end-of-file has been reachedfail()
: checks if an error has occurredbad()
: checks if a non-recoverable error has occurredoperator!()
: checks if an error has occurred (synonym of fail())operator bool()
: checks if no error has occurred (synonym of !fail())rdstate()
: returns state flagssetstate()
: sets state flagsclear()
: modifies state flags
These operations inserts one or more samples into the stream, by converting the sequence of samples
to a pcm data sequence which is then insterted into the stream. The sample format can be any floating
point type (i.e. float
, double
) or integral type (e.g int8_t
, int16_t
, int32_t
, int64_t
,
uint8_t
, uint16_t
, uint32_t
, uint64_t
).
operator<<
: inserts samples into the stream.- The value-based operator inserts a single sample into the stream, in analogy to
std::ostream
operator<<
. - The range-based operator inserts a range of samples into the stream.
- The value-based operator inserts a single sample into the stream, in analogy to
I.e. clients should stream block wise:
void fill(audio::ostream& stream, const std::vector<float>& samples)
{
stream << samples;
}
rather than sample wise:
void fill(audio::istream& stream, const std::vector<float>& samples)
{
for (auto sample : samples)
{
stream << sample;
}
}
sample_tellp()
: returns the output position indicator of the current sample.frame_tellp()
: returns the output position indicator of the current frame.
info()
: returns the stream infoaudio::ostream_info
which contains audio specific information like:num_channels
: the number of channelsnum_frames
: the number of sample frames (one frame consist ofnum_channels
samples)sample_rate
: the sample rateformat
: the pcm format the audio data is stored in- …