Loading...
Searching...
No Matches
juce::MidiDeviceListConnection Class Reference

`#include <juce_MidiDevices.h>`

## Public Types

using | Key = uint64_t

## Public Member Functions

| MidiDeviceListConnection ()=default
| MidiDeviceListConnection (const MidiDeviceListConnection &)=delete
| MidiDeviceListConnection (MidiDeviceListConnection &&other) noexcept
MidiDeviceListConnection & | operator= (const MidiDeviceListConnection &)=delete
MidiDeviceListConnection & | operator= (MidiDeviceListConnection &&other) noexcept
void | reset () noexcept

## Static Public Member Functions

static MidiDeviceListConnection | make (std::function< void()>)

## Detailed Description

To find out when the available MIDI devices change, call MidiDeviceListConnection::make(), passing a lambda that will be called on each configuration change.

To stop the lambda receiving callbacks, destroy the MidiDeviceListConnection instance returned from make(), or call reset() on it.

// Start listening for configuration changes
auto connection = MidiDeviceListConnection::make ([]
{
// This will print a message when devices are connected/disconnected
DBG ("MIDI devices changed");
});
// Stop listening
connection.reset();
juce::MidiDeviceListConnection::make
static MidiDeviceListConnection make(std::function< void()>)
juce::MidiDeviceListConnection::reset
void reset() noexcept
Definition juce_MidiDevices.h:79

Definition at line 49 of file juce_MidiDevices.h.

## Member Typedef Documentation

## Key

using juce::MidiDeviceListConnection::Key = uint64_t

Definition at line 52 of file juce_MidiDevices.h.

## Constructor & Destructor Documentation

## MidiDeviceListConnection() [1/2]

juce::MidiDeviceListConnection::MidiDeviceListConnection | ( |  | ) |

default

Constructs an inactive connection.

Referenced by make(), MidiDeviceListConnection(), and reset().

## MidiDeviceListConnection() [2/2]

juce::MidiDeviceListConnection::MidiDeviceListConnection | ( | MidiDeviceListConnection && | other | ) |

inline noexcept

Definition at line 59 of file juce_MidiDevices.h.

## ~MidiDeviceListConnection()

juce::MidiDeviceListConnection::~MidiDeviceListConnection | ( |  | ) |

noexcept

Definition at line 94 of file juce_MidiDevices.cpp.

## Member Function Documentation

## make()

MidiDeviceListConnection juce::MidiDeviceListConnection::make | ( | std::function< void()> |  | ) |

static

Registers a function to be called whenever the midi device list changes.

The callback will only be active for as long as the return MidiDeviceListConnection remains alive. To stop receiving device change notifications, destroy the Connection object, e.g. by allowing it to fall out of scope.

## operator=()

MidiDeviceListConnection & juce::MidiDeviceListConnection::operator= | ( | MidiDeviceListConnection && | other | ) |

inline noexcept

Definition at line 66 of file juce_MidiDevices.h.

## reset()

void juce::MidiDeviceListConnection::reset | ( |  | ) |

inline noexcept

Clears this connection.

If this object had an active connection, that connection will be deactivated, and the corresponding callback will be removed from the MidiDeviceListConnectionBroadcaster.

Definition at line 79 of file juce_MidiDevices.h.

Referenced by reset().

The documentation for this class was generated from the following files:

- juce_MidiDevices.h
- juce_MidiDevices.cpp