NETSIM 1.2.0
Hardware-in-the-loop acoustic network simulator
 
Loading...
Searching...
No Matches
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
38namespace netsim
39{
40typedef float sample_t;
41
43{
45 AudioBuffer(size_t size) : samples(size, 0) {}
46
47 template <typename It> AudioBuffer(It begin, It end) : samples(begin, end) {}
48
50 jack_nframes_t jack_frame_time{0};
51
52 std::vector<netsim::sample_t> samples;
53};
54
56{
57 std::shared_ptr<const AudioBuffer> buffer;
58
59 enum class Marker
60 {
61 NONE,
62 START,
63 END,
64 MIDDLE
65 };
67 int packet_id{-1};
68};
69
70} // namespace netsim
71
72#endif
float sample_t
Definition common.h:40
AudioBuffer(size_t size)
Definition common.h:45
AudioBuffer(It begin, It end)
Definition common.h:47
double buffer_start_time
Definition common.h:49
jack_nframes_t jack_frame_time
Definition common.h:50
std::vector< netsim::sample_t > samples
Definition common.h:52
std::shared_ptr< const AudioBuffer > buffer
Definition common.h:57