Platforms to show: All Mac Windows Linux Cross-Platform
Back to PortMidiMBS class.
PortMidiMBS.CountDevices as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | MIDI | MBS Audio Plugin | 5.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Returns 0 on any error.
PortMidiMBS.DefaultInputDeviceID as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | MIDI | MBS Audio Plugin | 5.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
On the PC, the user can specify a default device by setting an environment variable. For example, to use device #1.
set PM_RECOMMENDED_OUTPUT_DEVICE=1
The user should first determine the available device ID by using the supplied application "testin" or "testout".
In general, the registry is a better place for this kind of info, and with USB devices that can come and go, using integers is not very reliable for device identification. Under Windows, if PM_RECOMMENDED_OUTPUT_DEVICE (or PM_RECOMMENDED_INPUT_DEVICE) is *NOT* found in the environment, then the default device is obtained by looking for a string in the registry under: HKEY_LOCAL_MACHINE/SOFTWARE/PortMidi/Recommended_Input_Device and HKEY_LOCAL_MACHINE/SOFTWARE/PortMidi/Recommended_Output_Device for a string. The number of the first device with a substring that matches the string exactly is returned. For example, if the string in the registry is "USB", and device 1 is named "In USB MidiSport 1x1", then that will be the default input because it contains the string "USB".
In addition to the name, PmDeviceInfo has the member "interf", which is the interface name. (The "interface" is the underlying software system or API used by PortMidi to access devices. Examples are | MMSystem, DirectX (not implemented), ALSA, OSS (not implemented), etc.) At present, the only Win32 interface is "MMSystem", the only Linux interface is "ALSA", and the only Max OS X interface is "CoreMIDI". |
MMSystem, In USB MidiSport 1x1
In this case, the string before the comma must be a substring of the "interf" string, and the string after the space must be a substring of the "name" name string in order to match the device.
Note: in the current release, the default is simply the first device (the input or output device with the lowest PmDeviceID).
PortMidiMBS.DefaultOutputDeviceID as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | MIDI | MBS Audio Plugin | 5.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
On the PC, the user can specify a default device by setting an environment variable. For example, to use device #1.
set PM_RECOMMENDED_OUTPUT_DEVICE=1
The user should first determine the available device ID by using the supplied application "testin" or "testout".
In general, the registry is a better place for this kind of info, and with USB devices that can come and go, using integers is not very reliable for device identification. Under Windows, if PM_RECOMMENDED_OUTPUT_DEVICE (or PM_RECOMMENDED_INPUT_DEVICE) is *NOT* found in the environment, then the default device is obtained by looking for a string in the registry under: HKEY_LOCAL_MACHINE/SOFTWARE/PortMidi/Recommended_Input_Device and HKEY_LOCAL_MACHINE/SOFTWARE/PortMidi/Recommended_Output_Device for a string. The number of the first device with a substring that matches the string exactly is returned. For example, if the string in the registry is "USB", and device 1 is named "In USB MidiSport 1x1", then that will be the default input because it contains the string "USB".
In addition to the name, PmDeviceInfo has the member "interf", which is the interface name. (The "interface" is the underlying software system or API used by PortMidi to access devices. Examples are | MMSystem, DirectX (not implemented), ALSA, OSS (not implemented), etc.) At present, the only Win32 interface is "MMSystem", the only Linux interface is "ALSA", and the only Max OS X interface is "CoreMIDI". |
MMSystem, In USB MidiSport 1x1
In this case, the string before the comma must be a substring of the "interf" string, and the string after the space must be a substring of the "name" name string in order to match the device.
Note: in the current release, the default is simply the first device (the input or output device with the lowest PmDeviceID).
PortMidiMBS.DeviceInfo(DeviceID as Integer) as PortMidiDeviceInfoMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | MIDI | MBS Audio Plugin | 5.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Returns nil on any error.
PortMidiMBS.ErrorText(ErrorNumber as Integer) as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | MIDI | MBS Audio Plugin | 5.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Returns "" on any error.
PortMidiMBS.Initialize as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | MIDI | MBS Audio Plugin | 16.3 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
You call this manually to trigger initialization now.
Or you just let the plugin do it automatically when you call one of the portmidi functions.
Returns the error code. (0 = okay)
PortMidiMBS.ReInitialize as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | MIDI | MBS Audio Plugin | 9.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
As PortMidi does not recognize the attachment of new MIdi devices, you can only reinitialize.
Returns a PortMidi error code.
Some examples using this method:
The items on this page are in the following plugins: MBS Audio Plugin.