MBS Xojo Developer Conference and Training
Join us from 3rd to 6th May 2017 in Berlin, Germany.

MBS Real Studio Plugin Tutorial Videos

Midi Receive Source

Class App
Inherits Application
// Constants
Const kFileQuitShortcut = Ctrl+Q
Const kFileQuit = E&xit
Const kEditClear = &Delete
End Class

Class Window1
Inherits Window
// Controls
End ControlInstance
Sub Action() Handles Event
dim d as PortMidiEventMBS

while s.Poll<>0

dim e as integer = s.Read(d)
if e = 1 then

List.AddRow Format(d.When, "0")
List.Cell(List.LastIndex, 1) = str(d.Status)
List.Cell(List.LastIndex, 2) = str(d.Data1)
List.Cell(List.LastIndex, 3) = str(d.Data2)
List.ScrollPosition = List.LastIndex
end if

End Sub
End ControlInstance

// Properties
Dim p As PortMidiMBS

Dim s As PortMidiStreamMBS

// Event implementations
Sub Open()
p = new PortMidiMBS

dim c as integer = p.CountDevices - 1

for DeviceID as integer = 0 to c

dim info as PortMidiDeviceInfoMBS = p.DeviceInfo(DeviceID)

if info<>nil then
if info.HasInput then

// found device
s = new PortMidiStreamMBS
dim e as integer = s.OpenInput(DeviceID, 100)

if e = 0 then
Title = info.Name+" - "+info.InterfaceName
end if
end if
end if

MsgBox "No MIDI input device found."

End Sub
End Class

All movies

MBS Xojo Chart Plugins