RADLib
RADical C++ application framework
RADMedia::MidiInputDevice Class Reference

ALSA raw-MIDI input wrapper for USB MIDI controllers and DIN adapters. More...

#include <RADMedia.h>

Public Member Functions

 MidiInputDevice ()
 Creates a closed MIDI input. More...
 
 ~MidiInputDevice ()
 Closes the MIDI input if open. More...
 
 MidiInputDevice (const MidiInputDevice &)=delete
 MIDI inputs own native handles and are move-only. More...
 
MidiInputDeviceoperator= (const MidiInputDevice &)=delete
 MIDI inputs own native handles and are move-only. More...
 
 MidiInputDevice (MidiInputDevice &&) noexcept
 Moves a MIDI input. More...
 
MidiInputDeviceoperator= (MidiInputDevice &&) noexcept
 Moves a MIDI input. More...
 
bool open (const std::string &deviceId, std::string *error=nullptr)
 Opens deviceId in nonblocking input mode. More...
 
void close ()
 Closes the MIDI input. More...
 
bool isOpen () const
 Returns true when open. More...
 
const std::string & deviceId () const
 Returns the configured ALSA raw-MIDI id. More...
 
std::vector< MidiMessagereadMessages (size_t maxBytes=256)
 Reads and decodes all currently available MIDI messages without blocking. More...
 

Static Public Member Functions

static std::vector< MidiInputDeviceInfoinputDevices ()
 Lists detected raw-MIDI input devices. More...
 

Detailed Description

ALSA raw-MIDI input wrapper for USB MIDI controllers and DIN adapters.

Constructor & Destructor Documentation

◆ MidiInputDevice() [1/3]

RADMedia::MidiInputDevice::MidiInputDevice ( )

Creates a closed MIDI input.

◆ ~MidiInputDevice()

RADMedia::MidiInputDevice::~MidiInputDevice ( )

Closes the MIDI input if open.

◆ MidiInputDevice() [2/3]

RADMedia::MidiInputDevice::MidiInputDevice ( const MidiInputDevice )
delete

MIDI inputs own native handles and are move-only.

◆ MidiInputDevice() [3/3]

RADMedia::MidiInputDevice::MidiInputDevice ( MidiInputDevice &&  )
noexcept

Moves a MIDI input.

Member Function Documentation

◆ close()

void RADMedia::MidiInputDevice::close ( )

Closes the MIDI input.

◆ deviceId()

const std::string& RADMedia::MidiInputDevice::deviceId ( ) const

Returns the configured ALSA raw-MIDI id.

◆ inputDevices()

static std::vector<MidiInputDeviceInfo> RADMedia::MidiInputDevice::inputDevices ( )
static

Lists detected raw-MIDI input devices.

◆ isOpen()

bool RADMedia::MidiInputDevice::isOpen ( ) const

Returns true when open.

◆ open()

bool RADMedia::MidiInputDevice::open ( const std::string &  deviceId,
std::string *  error = nullptr 
)

Opens deviceId in nonblocking input mode.

◆ operator=() [1/2]

MidiInputDevice& RADMedia::MidiInputDevice::operator= ( const MidiInputDevice )
delete

MIDI inputs own native handles and are move-only.

◆ operator=() [2/2]

MidiInputDevice& RADMedia::MidiInputDevice::operator= ( MidiInputDevice &&  )
noexcept

Moves a MIDI input.

◆ readMessages()

std::vector<MidiMessage> RADMedia::MidiInputDevice::readMessages ( size_t  maxBytes = 256)

Reads and decodes all currently available MIDI messages without blocking.


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