Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
channel_mapper_writer.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Roc Streaming 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_audio/channel_mapper_writer.h
10//! @brief Channel mapper writer.
11
12#ifndef ROC_AUDIO_CHANNEL_MAPPER_WRITER_H_
13#define ROC_AUDIO_CHANNEL_MAPPER_WRITER_H_
14
20#include "roc_core/slice.h"
21#include "roc_core/stddefs.h"
22
23namespace roc {
24namespace audio {
25
26//! Channel mapper writer.
27//! Reads frames from nested writer and maps them to another channel mask.
29public:
30 //! Initialize.
32 FrameFactory& frame_factory,
33 const SampleSpec& in_spec,
34 const SampleSpec& out_spec);
35
36 //! Check if the object was succefully constructed.
37 bool is_valid() const;
38
39 //! Write audio frame.
40 virtual void write(Frame& frame);
41
42private:
43 void write_(sample_t* in_samples,
44 size_t n_samples,
45 unsigned flags,
46 core::nanoseconds_t capture_ts);
47
48 IFrameWriter& output_writer_;
49 core::Slice<sample_t> output_buf_;
50
51 ChannelMapper mapper_;
52
53 const SampleSpec in_spec_;
54 const SampleSpec out_spec_;
55
56 bool valid_;
57};
58
59} // namespace audio
60} // namespace roc
61
62#endif // ROC_AUDIO_CHANNEL_MAPPER_WRITER_H_
Channel mapper.
Channel mapper writer. Reads frames from nested writer and maps them to another channel mask.
bool is_valid() const
Check if the object was succefully constructed.
virtual void write(Frame &frame)
Write audio frame.
ChannelMapperWriter(IFrameWriter &writer, FrameFactory &frame_factory, const SampleSpec &in_spec, const SampleSpec &out_spec)
Initialize.
Audio frame.
Definition frame.h:25
Frame writer interface.
Sample specification. Describes sample rate and channels.
Definition sample_spec.h:30
Base class for non-copyable objects.
Definition noncopyable.h:23
Frame factory.
Frame writer interface.
float sample_t
Raw audio sample.
Definition sample.h:22
int64_t nanoseconds_t
Nanoseconds.
Definition time.h:58
Root namespace.
Non-copyable object.
Sample specifications.
Slice.
Commonly used types and functions.