VCV Rack API v2
Loading...
Searching...
No Matches
rack::midi::Port Struct Referenceabstract

A handle to a Device, typically owned by modules to have shared access to a single Device. More...

#include <midi.hpp>

Inheritance diagram for rack::midi::Port:
[legend]
Collaboration diagram for rack::midi::Port:
[legend]

Public Member Functions

 Port ()
 
virtual ~Port ()
 
DrivergetDriver ()
 
int getDriverId ()
 
void setDriverId (int driverId)
 
DevicegetDevice ()
 
virtual std::vector< int > getDeviceIds ()=0
 
virtual int getDefaultDeviceId ()=0
 
int getDeviceId ()
 
virtual void setDeviceId (int deviceId)=0
 
virtual std::string getDeviceName (int deviceId)=0
 
virtual std::vector< int > getChannels ()=0
 
int getChannel ()
 
void setChannel (int channel)
 
std::string getChannelName (int channel)
 
json_t * toJson ()
 
void fromJson (json_t *rootJ)
 

Public Attributes

int channel = -1
 For MIDI output, the channel to automatically set outbound messages.
 
int driverId = -1
 
int deviceId = -1
 
Driverdriver = NULL
 Not owned.
 
Devicedevice = NULL
 
Contextcontext
 

Detailed Description

A handle to a Device, typically owned by modules to have shared access to a single Device.

All Port methods safely wrap Drivers methods. That is, if the active Device throws a rack::Exception, it is caught and logged inside all Port methods, so they do not throw exceptions.

Use Input or Output subclasses in your module, not Port directly.

Constructor & Destructor Documentation

◆ Port()

rack::midi::Port::Port ( )

◆ ~Port()

virtual rack::midi::Port::~Port ( )
virtual

Member Function Documentation

◆ getDriver()

Driver * rack::midi::Port::getDriver ( )

◆ getDriverId()

int rack::midi::Port::getDriverId ( )

◆ setDriverId()

void rack::midi::Port::setDriverId ( int driverId)

◆ getDevice()

Device * rack::midi::Port::getDevice ( )

◆ getDeviceIds()

virtual std::vector< int > rack::midi::Port::getDeviceIds ( )
pure virtual

Implemented in rack::midi::Input, and rack::midi::Output.

◆ getDefaultDeviceId()

virtual int rack::midi::Port::getDefaultDeviceId ( )
pure virtual

Implemented in rack::midi::Input, and rack::midi::Output.

◆ getDeviceId()

int rack::midi::Port::getDeviceId ( )

◆ setDeviceId()

virtual void rack::midi::Port::setDeviceId ( int deviceId)
pure virtual

Implemented in rack::midi::Input, and rack::midi::Output.

◆ getDeviceName()

virtual std::string rack::midi::Port::getDeviceName ( int deviceId)
pure virtual

Implemented in rack::midi::Input, and rack::midi::Output.

◆ getChannels()

virtual std::vector< int > rack::midi::Port::getChannels ( )
pure virtual

Implemented in rack::midi::Input, and rack::midi::Output.

◆ getChannel()

int rack::midi::Port::getChannel ( )

◆ setChannel()

void rack::midi::Port::setChannel ( int channel)

◆ getChannelName()

std::string rack::midi::Port::getChannelName ( int channel)

◆ toJson()

json_t * rack::midi::Port::toJson ( )

◆ fromJson()

void rack::midi::Port::fromJson ( json_t * rootJ)

Member Data Documentation

◆ channel

int rack::midi::Port::channel = -1

For MIDI output, the channel to automatically set outbound messages.

If -1, the channel is not overwritten and must be set by MIDI generator.

For MIDI input, messages will be filtered by the channel. If -1, all MIDI channels pass through.

◆ driverId

int rack::midi::Port::driverId = -1

◆ deviceId

int rack::midi::Port::deviceId = -1

◆ driver

Driver* rack::midi::Port::driver = NULL

Not owned.

◆ device

Device* rack::midi::Port::device = NULL

◆ context

Context* rack::midi::Port::context

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