Skip to content

Commit

Permalink
[net] Add parameter type information
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Nov 11, 2023
1 parent e77c0e0 commit 1830ebd
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/ossia/audio/audio_parameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace ossia
audio_parameter::audio_parameter(net::node_base& n)
: ossia::net::parameter_base{n}
{
m_type = parameter_type::AUDIO;
}

void audio_parameter::clone_value(audio_vector& res_vec) const
Expand Down
2 changes: 1 addition & 1 deletion src/ossia/audio/audio_parameter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class OSSIA_EXPORT audio_parameter : public ossia::net::parameter_base
ossia::small_vector<tcb::span<float>, 8> audio;
double m_gain{1.};

audio_parameter(ossia::net::node_base& n);
explicit audio_parameter(ossia::net::node_base& n);

virtual ~audio_parameter();

Expand Down
4 changes: 2 additions & 2 deletions src/ossia/dataflow/dataflow_fwd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ struct midi_delay_line;
struct value_delay_line;
struct geometry_delay_line;

using data_type
= ossia::nullable_variant<audio_port, midi_port, value_port, geometry_port>;
// using data_type
// = ossia::nullable_variant<audio_port, midi_port, value_port, geometry_port>;
using delay_line_type = ossia::nullable_variant<
audio_delay_line, midi_delay_line, value_delay_line, geometry_delay_line>;
}
7 changes: 6 additions & 1 deletion src/ossia/gfx/texture_parameter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ namespace ossia::gfx
class OSSIA_EXPORT texture_parameter : public ossia::net::parameter_base
{
public:
using parameter_base::parameter_base;
explicit texture_parameter(ossia::net::node_base& n)
: parameter_base{n}
{
m_type = parameter_type::TEXTURE;
}

virtual ~texture_parameter();

void pull_value() override;
Expand Down
5 changes: 5 additions & 0 deletions src/ossia/network/base/parameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ parameter_base& parameter_base::set_critical(bool v)
return *this;
}

parameter_type parameter_base::get_type() const noexcept
{
return m_type;
}

value_with_unit get_value(const ossia::destination& d)
{
ossia::net::parameter_base& addr = d.value.get();
Expand Down
3 changes: 3 additions & 0 deletions src/ossia/network/base/parameter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,16 @@ class OSSIA_EXPORT parameter_base : public callback_container<value_callback>
bool get_critical() const noexcept;
parameter_base& set_critical(bool v);

parameter_type get_type() const noexcept;

protected:
ossia::net::node_base& m_node;
unit_t m_unit;
bool m_critical{};
bool m_disabled{};
bool m_muted{};
ossia::repetition_filter m_repetitionFilter{ossia::repetition_filter::OFF};
parameter_type m_type{};
};

inline bool operator==(const parameter_base& lhs, const parameter_base& rhs)
Expand Down
12 changes: 12 additions & 0 deletions src/ossia/network/common/parameter_properties.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ enum class val_type : int8_t
NONE = std::numeric_limits<int8_t>::max()
};

/**
* @brief Possible types of parameters / ports
*/
enum class parameter_type : int8_t
{
MESSAGE,
AUDIO,
MIDI,
TEXTURE,
GEOMETRY
};

/**
* @brief Address behaviors at crossing domain boundaries time
*/
Expand Down

0 comments on commit 1830ebd

Please sign in to comment.