Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
listener_token.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <memory>
5
6namespace pulp::state {
7
8namespace detail {
9struct ListenerRegistry; // defined in src/store.cpp
10}
11
23enum class ListenerThread {
26};
27
38
48public:
49 ListenerToken() = default;
50 ListenerToken(std::weak_ptr<detail::ListenerRegistry> registry, std::uint64_t id) noexcept;
51
52 ListenerToken(const ListenerToken&) = delete;
54
55 ListenerToken(ListenerToken&& other) noexcept;
57
59
61 void reset() noexcept;
62
64 explicit operator bool() const noexcept { return id_ != 0; }
65
67 std::uint64_t id() const noexcept { return id_; }
68
69private:
70 std::weak_ptr<detail::ListenerRegistry> registry_;
71 std::uint64_t id_ = 0;
72};
73
74} // namespace pulp::state
ListenerToken(ListenerToken &&other) noexcept
ListenerToken & operator=(const ListenerToken &)=delete
ListenerToken & operator=(ListenerToken &&other) noexcept
ListenerToken(const ListenerToken &)=delete
ListenerToken(std::weak_ptr< detail::ListenerRegistry > registry, std::uint64_t id) noexcept
std::uint64_t id() const noexcept
Numeric registry id, for diagnostics. Returns 0 when empty.
Definition listener_token.hpp:67
void reset() noexcept
Remove the subscription. Idempotent.
Definition listener_token.hpp:8
SequencerStateChannel is the audio-safe transport for a plugin's structured NON-parameter state: the ...
Definition audio_device_manager.hpp:48
ListenerThread
Where a parameter-change listener runs.
Definition listener_token.hpp:23
@ Main
Definition listener_token.hpp:24
@ Audio
Definition listener_token.hpp:25
ListenerRestoreBehavior
Whether a Main listener participates in the UI refresh that follows a successful state restore.
Definition listener_token.hpp:34
@ Silent
Definition listener_token.hpp:35
@ Reconcile
Definition listener_token.hpp:36