OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
audio_parameter.hpp
1#pragma once
2
3#include <ossia/dataflow/audio_port.hpp>
5#include <ossia/detail/pod_vector.hpp>
6#include <ossia/detail/span.hpp>
7#include <ossia/network/base/parameter.hpp>
8#include <ossia/network/value/value.hpp>
9
10namespace ossia
11{
12class OSSIA_EXPORT audio_parameter : public ossia::net::parameter_base
13{
14
15public:
16 ossia::small_vector<tcb::span<float>, 8> audio;
17 double m_gain{1.};
18
19 explicit audio_parameter(ossia::net::node_base& n);
20
21 virtual ~audio_parameter();
22
23 void clone_value(audio_vector& res) const;
24 virtual void push_value(const audio_port& port);
25
26 void pull_value() override;
27 net::parameter_base& push_value(const ossia::value&) override;
28 net::parameter_base& push_value(ossia::value&&) override;
29 net::parameter_base& push_value() override;
30 ossia::value value() const override;
31 ossia::value set_value(const ossia::value&) override;
32 ossia::value set_value(ossia::value&&) override;
33 val_type get_value_type() const noexcept override;
34 net::parameter_base& set_value_type(val_type) override;
35 access_mode get_access() const noexcept override;
36 net::parameter_base& set_access(access_mode) override;
37 const domain& get_domain() const noexcept override;
38 net::parameter_base& set_domain(const domain&) override;
39 bounding_mode get_bounding() const noexcept override;
40 net::parameter_base& set_bounding(bounding_mode) override;
41};
42
43class OSSIA_EXPORT virtual_audio_parameter final : public audio_parameter
44{
45 // todo use a flat vector instead for perf
46 std::vector<ossia::float_vector> m_audio_data;
47
48public:
49 virtual_audio_parameter(int num_channels, ossia::net::node_base& n);
50
51 void set_buffer_size(int bs)
52 {
53 const auto chan = m_audio_data.size();
54 audio.resize(chan);
55 for(std::size_t i = 0; i < chan; i++)
56 {
57 m_audio_data[i].resize(bs);
58 audio[i] = m_audio_data[i];
59 }
60 }
61
62 virtual ~virtual_audio_parameter();
63};
64
65using audio_mapping = ossia::int_vector;
66class OSSIA_EXPORT mapped_audio_parameter final : public audio_parameter
67{
68public:
69 audio_mapping mapping;
70 bool is_output{false};
71 mapped_audio_parameter(bool output, audio_mapping m, ossia::net::node_base& n);
72
73 virtual ~mapped_audio_parameter();
74};
75}
The node_base class.
Definition node.hpp:48
The parameter_base class.
Definition ossia/network/base/parameter.hpp:48
The value class.
Definition value.hpp:173
Definition git_info.h:7
val_type
Enum to represent the types that a value can take.
Definition parameter_properties.hpp:16
OSSIA_EXPORT void push_value(const ossia::destination &addr, const ossia::value_with_unit &)
Send a value to a given destination.
Definition ossia/network/base/parameter.cpp:151