Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Toggle main menu visibility
Loading...
Searching...
No Matches
channel_mapper.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.h
10
//! @brief Channel mapper.
11
12
#ifndef ROC_AUDIO_CHANNEL_MAPPER_H_
13
#define ROC_AUDIO_CHANNEL_MAPPER_H_
14
15
#include "
roc_audio/channel_mapper_matrix.h
"
16
#include "
roc_audio/channel_set.h
"
17
#include "
roc_core/noncopyable.h
"
18
19
namespace
roc
{
20
namespace
audio
{
21
22
//! Channel mapper.
23
//!
24
//! Converts between input and output samples with specified channel sets.
25
//!
26
//! Supports converting between:
27
//! - different channel layouts (e.g. surround, multitrack)
28
//! - different channel orders (e.g. smpte, alsa)
29
//! - different channel masks (e.g. stereo, mono)
30
class
ChannelMapper
:
public
core::NonCopyable
<> {
31
public
:
32
//! Initialize.
33
ChannelMapper
(
const
ChannelSet
& in_chans,
const
ChannelSet
& out_chans);
34
35
//! Map samples.
36
void
map
(
const
sample_t
* in_samples,
37
size_t
n_in_samples,
38
sample_t
* out_samples,
39
size_t
n_out_samples);
40
41
private
:
42
typedef
void (
ChannelMapper
::*map_func_t)(
const
sample_t
* in_samples,
43
sample_t
* out_samples,
44
size_t
n_samples);
45
46
void
map_surround_surround_(
const
sample_t
* in_samples,
47
sample_t
* out_samples,
48
size_t
n_samples);
49
void
map_multitrack_surround_(
const
sample_t
* in_samples,
50
sample_t
* out_samples,
51
size_t
n_samples);
52
void
map_multitrack_multitrack_(
const
sample_t
* in_samples,
53
sample_t
* out_samples,
54
size_t
n_samples);
55
56
void
setup_map_func_();
57
58
const
ChannelSet
in_chans_;
59
const
ChannelSet
out_chans_;
60
ChannelSet
inout_chans_;
61
62
map_func_t map_func_;
63
64
// use for surround <=> surround mapping
65
ChannelMapperMatrix
map_matrix_;
66
};
67
68
}
// namespace audio
69
}
// namespace roc
70
71
#endif
// ROC_AUDIO_CHANNEL_MAPPER_H_
channel_mapper_matrix.h
Channel mapping matrix.
channel_set.h
Channel set.
roc::audio::ChannelMapperMatrix
Channel mapping matrix.
Definition
channel_mapper_matrix.h:38
roc::audio::ChannelMapper::map
void map(const sample_t *in_samples, size_t n_in_samples, sample_t *out_samples, size_t n_out_samples)
Map samples.
roc::audio::ChannelMapper::ChannelMapper
ChannelMapper(const ChannelSet &in_chans, const ChannelSet &out_chans)
Initialize.
roc::audio::ChannelSet
Channel set. Multi-word bitmask with bits corresponding to enabled channels. Meaning of each channel ...
Definition
channel_set.h:26
roc::core::NonCopyable
Base class for non-copyable objects.
Definition
noncopyable.h:23
roc::audio
Audio frames and audio processing.
roc::audio::sample_t
float sample_t
Raw audio sample.
Definition
sample.h:22
roc
Root namespace.
noncopyable.h
Non-copyable object.
roc_audio
channel_mapper.h
Generated by
1.17.0