Loading...
Searching...
No Matches
AudioDevice.hpp
1#pragma once
2#include <Device/Protocol/DeviceInterface.hpp>
3#include <Device/Protocol/DeviceSettings.hpp>
4#include <Device/Protocol/ProtocolFactoryInterface.hpp>
5#include <Device/Protocol/ProtocolSettingsWidget.hpp>
6
7#include <ossia/network/generic/generic_device.hpp>
8
9#include <score_plugin_audio_export.h>
10
11#include <verdigris>
12
13namespace ossia
14{
15class audio_protocol;
16}
17class QLineEdit;
18namespace Dataflow
19{
21{
22 SCORE_CONCRETE("2835e6da-9b55-4029-9802-e1c817acbdc1")
23 QString prettyName() const noexcept override;
24 QString category() const noexcept override;
25 QUrl manual() const noexcept override;
26 Device::DeviceEnumerators
27 getEnumerators(const score::DocumentContext& ctx) const override;
28
29 Device::DeviceInterface* makeDevice(
30 const Device::DeviceSettings& settings,
31 const Explorer::DeviceDocumentPlugin& plugin,
32 const score::DocumentContext& ctx) override;
33 const Device::DeviceSettings& defaultSettings() const noexcept override;
34 Device::AddressDialog* makeAddAddressDialog(
36 QWidget* parent) override;
37 Device::AddressDialog* makeEditAddressDialog(
39 const score::DocumentContext& ctx, QWidget*) override;
40
41 Device::ProtocolSettingsWidget* makeSettingsWidget() override;
42
43 QVariant makeProtocolSpecificSettings(const VisitorVariant& visitor) const override;
44
45 void serializeProtocolSpecificSettings(
46 const QVariant& data, const VisitorVariant& visitor) const override;
47
48 bool checkCompatibility(
50 const Device::DeviceSettings& b) const noexcept override;
51};
52
53class SCORE_PLUGIN_AUDIO_EXPORT AudioDevice final : public Device::DeviceInterface
54{
55 W_OBJECT(AudioDevice)
56public:
57 explicit AudioDevice(const Device::DeviceSettings& settings);
59
60 void addAddress(const Device::FullAddressSettings& settings) override;
61
62 void updateAddress(
63 const State::Address& currentAddr,
64 const Device::FullAddressSettings& settings) override;
65 bool reconnect() override;
66 void recreate(const Device::Node& n) override;
67 const std::shared_ptr<ossia::net::generic_device>& sharedDevice() const noexcept
68 {
69 return m_dev;
70 }
71 ossia::net::device_base* getDevice() const override { return m_dev.get(); }
72 ossia::audio_protocol* getProtocol() const { return m_protocol; }
73
74 void changed() E_SIGNAL(SCORE_PLUGIN_AUDIO_EXPORT, changed)
75
76private:
77 using Device::DeviceInterface::refresh;
78 void setupNode(ossia::net::node_base&, const ossia::extended_attributes& attr);
79 Device::Node refresh() override;
80 void disconnect() override;
81 ossia::audio_protocol* m_protocol{};
82 std::shared_ptr<ossia::net::generic_device> m_dev;
83};
84
86{
87public:
88 AudioSettingsWidget(QWidget* parent = nullptr);
89
90 Device::DeviceSettings getSettings() const override;
91
92 void setSettings(const Device::DeviceSettings& settings) override;
93
94private:
95 void setDefaults();
96 QLineEdit* m_deviceNameEdit{};
97};
98}
Definition AudioDevice.hpp:54
Definition AudioDevice.hpp:21
Definition AudioDevice.hpp:86
Definition ProtocolSettingsWidget.hpp:41
Definition DeviceInterface.hpp:66
Definition ProtocolFactoryInterface.hpp:49
Definition ProtocolSettingsWidget.hpp:22
Definition AddressSettings.hpp:49
Definition DeviceSettings.hpp:20
Definition AddressSettings.hpp:62
The Address struct.
Definition Address.hpp:58
The VisitorVariant struct.
Definition VisitorInterface.hpp:26
Definition DocumentContext.hpp:18