Shared ptr lifetime management for sockets.

This commit is contained in:
Robin Davies
2024-10-05 02:13:49 -04:00
parent db03a7e47f
commit 6f268daec9
3 changed files with 152 additions and 316 deletions
+5 -3
View File
@@ -54,6 +54,8 @@ namespace pipedal
class IPiPedalModelSubscriber
{
public:
using ptr = std::shared_ptr<IPiPedalModelSubscriber>;
virtual int64_t GetClientId() = 0;
virtual void OnItemEnabledChanged(int64_t clientId, int64_t pedalItemId, bool enabled) = 0;
virtual void OnControlChanged(int64_t clientId, int64_t pedalItemId, const std::string &symbol, float value) = 0;
@@ -175,7 +177,7 @@ namespace pipedal
std::shared_ptr<Lv2Pedalboard> lv2Pedalboard;
std::filesystem::path webRoot;
std::vector<IPiPedalModelSubscriber *> subscribers;
std::vector<std::shared_ptr<IPiPedalModelSubscriber>> subscribers;
void SetPresetChanged(int64_t clientId, bool value, bool changeSnapshotSelect = true);
void FireSelectedSnapshotChanged(int64_t selectedSnapshot);
void FirePresetsChanged(int64_t clientId);
@@ -311,8 +313,8 @@ namespace pipedal
void LoadPluginPreset(int64_t pluginInstanceId, uint64_t presetInstanceId);
void AddNotificationSubscription(IPiPedalModelSubscriber *pSubscriber);
void RemoveNotificationSubsription(IPiPedalModelSubscriber *pSubscriber);
void AddNotificationSubscription(std::shared_ptr<IPiPedalModelSubscriber> pSubscriber);
void RemoveNotificationSubsription(std::shared_ptr<IPiPedalModelSubscriber> pSubscriber);
void SetPedalboardItemEnable(int64_t clientId, int64_t instanceId, bool enabled);
void SetControl(int64_t clientId, int64_t pedalItemId, const std::string &symbol, float value);