JUCE v8.0.9
JUCE API
 
Loading...
Searching...
No Matches
juce::MidiDeviceListConnection Class Reference

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

#include <juce_MidiDevices.h>

Collaboration diagram for juce::MidiDeviceListConnection:

Public Types

using Key = uint64_t
 

Public Member Functions

 MidiDeviceListConnection ()=default
 Constructs an inactive connection.
 
 MidiDeviceListConnection (const MidiDeviceListConnection &)=delete
 
 MidiDeviceListConnection (MidiDeviceListConnection &&other) noexcept
 
 ~MidiDeviceListConnection () noexcept
 
MidiDeviceListConnectionoperator= (const MidiDeviceListConnection &)=delete
 
MidiDeviceListConnectionoperator= (MidiDeviceListConnection &&other) noexcept
 
void reset () noexcept
 Clears this connection.
 

Static Public Member Functions

static MidiDeviceListConnection make (std::function< void()>)
 Registers a function to be called whenever the midi device list changes.
 

Private Member Functions

 MidiDeviceListConnection (MidiDeviceListConnectionBroadcaster *b, const Key k)
 
void swap (MidiDeviceListConnection &other) noexcept
 

Private Attributes

MidiDeviceListConnectionBroadcaster * broadcaster = nullptr
 
Key key = {}
 

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();
static MidiDeviceListConnection make(std::function< void()>)
Registers a function to be called whenever the midi device list changes.
void reset() noexcept
Clears this connection.
Definition juce_MidiDevices.h:91
#define DBG(textToWrite)
Writes a string to the standard error stream.
Definition juce_PlatformDefs.h:159

@tags{Audio}

Member Typedef Documentation

◆ Key

Constructor & Destructor Documentation

◆ MidiDeviceListConnection() [1/4]

juce::MidiDeviceListConnection::MidiDeviceListConnection ( )
default

Constructs an inactive connection.

Referenced by operator=(), and reset().

◆ MidiDeviceListConnection() [2/4]

juce::MidiDeviceListConnection::MidiDeviceListConnection ( const MidiDeviceListConnection )
delete

◆ MidiDeviceListConnection() [3/4]

juce::MidiDeviceListConnection::MidiDeviceListConnection ( MidiDeviceListConnection &&  other)
inlinenoexcept

◆ ~MidiDeviceListConnection()

juce::MidiDeviceListConnection::~MidiDeviceListConnection ( )
noexcept

◆ MidiDeviceListConnection() [4/4]

juce::MidiDeviceListConnection::MidiDeviceListConnection ( MidiDeviceListConnectionBroadcaster *  b,
const Key  k 
)
inlineprivate

Member Function Documentation

◆ make()

static 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=() [1/2]

MidiDeviceListConnection & juce::MidiDeviceListConnection::operator= ( const MidiDeviceListConnection )
delete

◆ operator=() [2/2]

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

◆ reset()

void juce::MidiDeviceListConnection::reset ( )
inlinenoexcept

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.

References MidiDeviceListConnection().

◆ swap()

void juce::MidiDeviceListConnection::swap ( MidiDeviceListConnection other)
inlineprivatenoexcept

References broadcaster, and key.

Referenced by operator=().

Member Data Documentation

◆ broadcaster

MidiDeviceListConnectionBroadcaster* juce::MidiDeviceListConnection::broadcaster = nullptr
private

Referenced by swap().

◆ key

Key juce::MidiDeviceListConnection::key = {}
private

Referenced by swap().


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