Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Toggle main menu visibility
Loading...
Searching...
No Matches
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
15
#include "
roc_audio/channel_mapper.h
"
16
#include "
roc_audio/frame_factory.h
"
17
#include "
roc_audio/iframe_writer.h
"
18
#include "
roc_audio/sample_spec.h
"
19
#include "
roc_core/noncopyable.h
"
20
#include "
roc_core/slice.h
"
21
#include "
roc_core/stddefs.h
"
22
23
namespace
roc
{
24
namespace
audio
{
25
26
//! Channel mapper writer.
27
//! Reads frames from nested writer and maps them to another channel mask.
28
class
ChannelMapperWriter
:
public
IFrameWriter
,
public
core::NonCopyable
<> {
29
public
:
30
//! Initialize.
31
ChannelMapperWriter
(
IFrameWriter
& writer,
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
42
private
:
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.h
Channel mapper.
roc::audio::ChannelMapperWriter::is_valid
bool is_valid() const
Check if the object was succefully constructed.
roc::audio::ChannelMapperWriter::write
virtual void write(Frame &frame)
Write audio frame.
roc::audio::ChannelMapperWriter::ChannelMapperWriter
ChannelMapperWriter(IFrameWriter &writer, FrameFactory &frame_factory, const SampleSpec &in_spec, const SampleSpec &out_spec)
Initialize.
roc::audio::ChannelMapper
Channel mapper.
Definition
channel_mapper.h:30
roc::audio::FrameFactory
Frame factory.
Definition
frame_factory.h:38
roc::audio::Frame
Audio frame.
Definition
frame.h:25
roc::audio::IFrameWriter
Frame writer interface.
Definition
iframe_writer.h:22
roc::audio::SampleSpec
Sample specification. Describes sample rate and channels.
Definition
sample_spec.h:30
roc::core::NonCopyable
Base class for non-copyable objects.
Definition
noncopyable.h:23
roc::core::Slice
Slice.
Definition
slice.h:55
frame_factory.h
Frame factory.
iframe_writer.h
Frame writer interface.
roc::audio
Audio frames and audio processing.
roc::audio::sample_t
float sample_t
Raw audio sample.
Definition
sample.h:22
roc::core::nanoseconds_t
int64_t nanoseconds_t
Nanoseconds.
Definition
time.h:58
roc
Root namespace.
noncopyable.h
Non-copyable object.
sample_spec.h
Sample specifications.
slice.h
Slice.
stddefs.h
Commonly used types and functions.
roc_audio
channel_mapper_writer.h
Generated by
1.17.0