The base class for all audio output streams.
Inherited from std::ostream
⚠️ Using these operations should be avoided. They are provided for maximum flexibility if clients need to operate on the raw pcm data. In most use cases, formatted output operations can and should be used as they provide type safety and are optimized for best performance.
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.⚠️ Using these operations should be avoided. They are provided for maximum flexibility if clients need to operate on the raw pcm data. It is the clients reponsibility to ensure that the position is aligned withing a sample or frame. Therefore it is recommended to use sample based positioning operations instead.
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 flagsThese 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.
std::ostream
operator<<
.⚠️ It is highly recommended to use the range-based version instead of the value-based version, as this will result in a better performance (during pcm conversion).
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 info audio::ostream_info
which contains audio specific information like:
num_channels
: the number of channelsnum_frames
: the number of sample frames (one frame consist of num_channels
samples)sample_rate
: the sample rateformat
: the pcm format the audio data is stored in