Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

MBS Xojo 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
ControlInstance
End ControlInstance
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
wend

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
Return
end if
end if
end if
next

MsgBox "No MIDI input device found."
quit

End Sub
End Class


All movies




Links
MBS Xojo PDF Plugins