NETSIM
1.0.1
Hardware-in-the-loopacousticnetworksimulator
common.h
Go to the documentation of this file.
1
// Copyright 2017-2020:
2
// GobySoft, LLC (2017-)
3
// Massachusetts Institute of Technology (2017-)
4
// File authors:
5
// Toby Schneider <toby@gobysoft.org>
6
//
7
//
8
// This file is part of the NETSIM Libraries.
9
//
10
// The NETSIM Libraries are free software: you can redistribute them and/or modify
11
// them under the terms of the GNU Lesser General Public License as published by
12
// the Free Software Foundation, either version 2.1 of the License, or
13
// (at your option) any later version.
14
//
15
// The NETSIM Libraries are distributed in the hope that they will be useful,
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
// GNU Lesser General Public License for more details.
19
//
20
// You should have received a copy of the GNU Lesser General Public License
21
// along with NETSIM. If not, see <http://www.gnu.org/licenses/>.
22
23
#ifndef COMMON20170816H
24
#define COMMON20170816H
25
26
#include <jack/jack.h>
27
28
#include <vector>
29
30
#include <boost/preprocessor/repetition/repeat.hpp>
31
32
// clang-format off
33
#ifndef NETSIM_MAX_MODEMS
34
#define NETSIM_MAX_MODEMS 16
35
#endif
36
// clang-format on
37
38
namespace
netsim
39
{
40
typedef
float
sample_t
;
41
42
struct
AudioBuffer
43
{
44
AudioBuffer
() {}
45
AudioBuffer
(
size_t
size) :
samples
(size, 0) {}
46
47
template
<
typename
It>
AudioBuffer
(It begin, It end) :
samples
(begin, end) {}
48
49
double
buffer_start_time
{0};
50
jack_nframes_t
jack_frame_time
{0};
51
52
std::vector<netsim::sample_t>
samples
;
53
};
54
55
struct
TaggedAudioBuffer
56
{
57
std::shared_ptr<const AudioBuffer>
buffer
;
58
59
enum class
Marker
60
{
61
NONE
,
62
START
,
63
END
,
64
MIDDLE
65
};
66
Marker
marker
{
Marker::NONE
};
67
int
packet_id
{-1};
68
};
69
70
}
// namespace netsim
71
72
#endif
netsim::AudioBuffer::buffer_start_time
double buffer_start_time
Definition:
common.h:49
netsim::TaggedAudioBuffer::Marker::MIDDLE
@ MIDDLE
netsim
Definition:
environment.h:30
netsim::TaggedAudioBuffer::marker
Marker marker
Definition:
common.h:66
netsim::TaggedAudioBuffer::packet_id
int packet_id
Definition:
common.h:67
netsim::TaggedAudioBuffer::buffer
std::shared_ptr< const AudioBuffer > buffer
Definition:
common.h:57
netsim::TaggedAudioBuffer::Marker::START
@ START
netsim::AudioBuffer::jack_frame_time
jack_nframes_t jack_frame_time
Definition:
common.h:50
netsim::TaggedAudioBuffer
Definition:
common.h:55
netsim::TaggedAudioBuffer::Marker::NONE
@ NONE
netsim::TaggedAudioBuffer::Marker
Marker
Definition:
common.h:59
netsim::AudioBuffer::AudioBuffer
AudioBuffer(It begin, It end)
Definition:
common.h:47
netsim::AudioBuffer
Definition:
common.h:42
netsim::AudioBuffer::AudioBuffer
AudioBuffer(size_t size)
Definition:
common.h:45
netsim::AudioBuffer::samples
std::vector< netsim::sample_t > samples
Definition:
common.h:52
netsim::sample_t
float sample_t
Definition:
common.h:40
netsim::AudioBuffer::AudioBuffer
AudioBuffer()
Definition:
common.h:44
netsim::TaggedAudioBuffer::Marker::END
@ END
obj-x86_64-linux-gnu
include
netsim
core
common.h
Generated by
1.8.17