Skip to content

Commit

Permalink
[wip] HW device integration
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Aug 26, 2024
1 parent c5b5327 commit 272e708
Show file tree
Hide file tree
Showing 14 changed files with 762 additions and 125 deletions.
5 changes: 5 additions & 0 deletions src/plugins/score-plugin-avnd/AvndDevices/AvndDevice.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@

#include <Crousti/Concepts.hpp>

#include <ossia/detail/fmt.hpp>
#include <ossia/network/base/protocol.hpp>
#include <ossia/network/generic/generic_device.hpp>

#include <QFormLayout>

#include <avnd/binding/ossia/from_value.hpp>
#include <avnd/binding/ossia/to_value.hpp>
#include <avnd/introspection/input.hpp>
#include <avnd/introspection/output.hpp>
namespace oscr
{
template <typename Node>
Expand Down
44 changes: 2 additions & 42 deletions src/plugins/score-plugin-avnd/Crousti/Concepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

#include <Dataflow/CurveInlet.hpp>

#include <score/plugins/UuidKey.hpp>

#include <ossia/dataflow/audio_port.hpp>
#include <ossia/dataflow/port.hpp>
#include <ossia/dataflow/safe_nodes/tick_policies.hpp>
Expand All @@ -15,6 +13,7 @@
#include <boost/container/vector.hpp>

#include <avnd/binding/ossia/qt.hpp>
#include <avnd/binding/ossia/uuid.hpp>
#include <avnd/common/concepts_polyfill.hpp>
#include <avnd/common/struct_reflection.hpp>
#include <avnd/concepts/audio_port.hpp>
Expand All @@ -30,13 +29,6 @@

#include <type_traits>

#define make_uuid(text) score::uuids::string_generator::compute((text))
#if defined(_MSC_VER)
#define uuid_constexpr inline
#else
#define uuid_constexpr constexpr
#endif

namespace oscr
{
template <typename Node, typename FieldIndex>
Expand All @@ -50,39 +42,6 @@ struct is_custom_serialized<oscr::CustomFloatControl<Node, FieldIndex>> : std::t

namespace oscr
{
template <typename N>
consteval score::uuid_t uuid_from_string()
{
if constexpr(requires {
{
N::uuid()
} -> std::convertible_to<score::uuid_t>;
})
{
return N::uuid();
}
else
{
constexpr const char* str = N::uuid();
return score::uuids::string_generator::compute(str, str + 37);
}
}

template <typename Node>
score::uuids::uuid make_field_uuid(uint64_t is_input, uint64_t index)
{
score::uuid_t node_uuid = uuid_from_string<Node>();
uint64_t dat[2];

memcpy(dat, node_uuid.data, 16);

dat[0] ^= is_input;
dat[1] ^= index;

memcpy(node_uuid.data, dat, 16);

return node_uuid;
}

struct CustomFloatControlBase : public Process::ControlInlet
{
Expand Down Expand Up @@ -119,6 +78,7 @@ struct CustomFloatControl : public CustomFloatControlBase
{
return make_field_uuid<Node>(true, FieldIndex{});
}

key_type concreteKey() const noexcept override { return static_concreteKey(); }

void serialize_impl(const VisitorVariant& vis) const noexcept override
Expand Down
17 changes: 6 additions & 11 deletions src/plugins/score-plugin-avnd/Crousti/Metadata.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ template <typename Info>
class ProcessModel;
}

inline QString fromStringView(std::string_view v)
{
return QString::fromUtf8(v.data(), v.size());
}

////////// METADATA ////////////
namespace oscr
{
Expand Down Expand Up @@ -126,12 +121,12 @@ struct Metadata<Process::Descriptor_k, oscr::ProcessModel<Info>>
Else; \
}()

#define if_attribute(Attr) \
[]() noexcept -> QString { \
if constexpr(avnd::has_##Attr<Info>) \
return fromStringView(avnd::get_##Attr<Info>()); \
else \
return QString{}; \
#define if_attribute(Attr) \
[]() noexcept -> QString { \
if constexpr(avnd::has_##Attr<Info>) \
return oscr::fromStringView(avnd::get_##Attr<Info>()); \
else \
return QString{}; \
}()
#endif
static Process::Descriptor desc
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/score-plugin-protocols/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,15 @@ set(ARTNET_SRCS
)

set(SIMPLEIO_HDRS
"${CMAKE_CURRENT_SOURCE_DIR}/Protocols/SimpleIO/HardwareDevice.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Protocols/SimpleIO/SimpleIODevice.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Protocols/SimpleIO/SimpleIOProtocolFactory.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Protocols/SimpleIO/SimpleIOProtocolSettingsWidget.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Protocols/SimpleIO/SimpleIOSpecificSettings.hpp"
)

set(SIMPLEIO_SRCS
"${CMAKE_CURRENT_SOURCE_DIR}/Protocols/SimpleIO/HardwareDevice.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Protocols/SimpleIO/SimpleIODevice.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Protocols/SimpleIO/SimpleIOProtocolFactory.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Protocols/SimpleIO/SimpleIOProtocolSettingsWidget.cpp"
Expand Down
Loading

0 comments on commit 272e708

Please sign in to comment.