Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
port_change_watcher.hpp File Reference

Port-list diffing and a polling change notifier. More...

#include <pulp/midi/device.hpp>
#include <chrono>
#include <condition_variable>
#include <functional>
#include <memory>
#include <mutex>
#include <string>
#include <thread>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

struct  pulp::midi::PortListDiff
 Ports that appeared and ports that went away between two snapshots. More...
class  pulp::midi::PortListTracker
 Remembers the last snapshot and reports what changed since. More...
class  pulp::midi::PortChangePoller
 Calls on_change from a background thread whenever the combined input and output list changes. More...

Namespaces

namespace  pulp
namespace  pulp::midi
namespace  pulp::midi::detail

Functions

bool pulp::midi::detail::same_port (const MidiPortInfo &a, const MidiPortInfo &b)
bool pulp::midi::detail::contains_port (const std::vector< MidiPortInfo > &list, const MidiPortInfo &p)
PortListDiff pulp::midi::diff_port_lists (const std::vector< MidiPortInfo > &before, const std::vector< MidiPortInfo > &after)
 Compare two snapshots.

Detailed Description

Port-list diffing and a polling change notifier.

Some MIDI backends (the classic Windows multimedia API) have no plug or unplug notification of their own. They can still report hotplug by enumerating on a timer and comparing snapshots. The comparison and the timer thread live here, free of any platform header, so the logic is the same everywhere and testable without hardware.