Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
converter.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Roc authors
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 */
8
9//! @file roc_pipeline/converter.h
10//! @brief Converter pipeline.
11
12#ifndef ROC_PIPELINE_CONVERTER_H_
13#define ROC_PIPELINE_CONVERTER_H_
14
21#include "roc_core/unique_ptr.h"
22#include "roc_pipeline/config.h"
23#include "roc_sndio/isink.h"
24
25namespace roc {
26namespace pipeline {
27
28//! Converter pipeline.
29class Converter : public sndio::ISink, public core::NonCopyable<> {
30public:
31 //! Initialize.
33 audio::IWriter* output_writer,
35 core::IAllocator& allocator);
36
37 //! Check if the pipeline was successfully constructed.
38 bool valid();
39
40 //! Get sink sample rate.
41 virtual size_t sample_rate() const;
42
43 //! Check if the sink has own clock.
44 virtual bool has_clock() const;
45
46 //! Write audio frame.
47 virtual void write(audio::Frame& frame);
48
49private:
50 audio::NullWriter null_writer_;
51
52 core::UniquePtr<audio::PoisonWriter> resampler_poisoner_;
54
56
57 core::UniquePtr<audio::PoisonWriter> pipeline_poisoner_;
58
59 audio::IWriter* audio_writer_;
60
61 ConverterConfig config_;
62};
63
64} // namespace pipeline
65} // namespace roc
66
67#endif // ROC_PIPELINE_CONVERTER_H_
Buffer pool.
Audio frame.
Definition: frame.h:22
Audio writer interface.
Definition: iwriter.h:21
Memory allocator interface.
Definition: iallocator.h:23
Base class for non-copyable objects.
Definition: noncopyable.h:23
Unique ownrship pointer.
Definition: unique_ptr.h:27
Converter pipeline.
Definition: converter.h:29
virtual void write(audio::Frame &frame)
Write audio frame.
virtual bool has_clock() const
Check if the sink has own clock.
virtual size_t sample_rate() const
Get sink sample rate.
Converter(const ConverterConfig &config, audio::IWriter *output_writer, core::BufferPool< audio::sample_t > &pool, core::IAllocator &allocator)
Initialize.
bool valid()
Check if the pipeline was successfully constructed.
Sink interface.
Definition: isink.h:21
Sink interface.
Root namespace.
Null writer.
Poison writer.
Profiling writer.
Resampler profile.
Pipeline config.
Converter parameters.
Definition: config.h:205
Unique ownrship pointer.