Platforms to show: All Mac Windows Linux Cross-Platform
/MacCF/MIDI/MidiThruConnectionMBS test
Required plugins for this example: MBS MacCF Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCF/MIDI/MidiThruConnectionMBS test
This example is the version from Tue, 10th Feb 2020.
Project "MidiThruConnectionMBS test.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
EventHandler Sub Open()
midiclient = New MidiClientMBS
// first destination
Dim dest As MidiEndpointMBS = MidiClient.GetDestination(0)
If dest = Nil Then
Break
Else
Log "Dest: "+dest.Name
End If
// first source
Dim source As MidiEndpointMBS = MidiClient.GetSource(0)
If source = Nil Then
Break
Else
log "Source: "+source.Name
End If
Dim params As New MidiThruConnectionParamsMBS
// make source endpoint
tSource = New MidiThruConnectionEndpointMBS
tSource.Endpoint = source
tSource.UniqueID = 0 // use endpoint
params.SourcesCount = 1
params.Source(0) = tSource
// make dest endpoint
tDest = New MidiThruConnectionEndpointMBS
tDest.Endpoint = dest
tDest.UniqueID = 0 // use endpoint
params.DestinationsCount = 1
params.Destination(0) = tDest
// build identity channel map
// set to 255 to block a channel
For i As Integer = 0 To 15
params.channelMap(i) = i
Next
params.LowNote = 0
params.HighNote = 127
params.LowVelocity = 0
params.HighVelocity = 127
// rest zero
params.ControlTransformsCount = 0
params.MapsCount = 0
// now run
ThruConnection = New MidiThruConnectionMBS
// empty identifier for no persistence
ThruConnection.Create("", params)
If ThruConnection.Handle = 0 Then
Break // failed
Log "Failed to create thru connection."
Else
Log "Running."
// Dim p As MidiThruConnectionParamsMBS = ThruConnection.Parameter
// Break
End If
End EventHandler
Sub log(s as string)
List.AddRow s
End Sub
Property MidiClient As MidiClientMBS
Property ThruConnection As MidiThruConnectionMBS
Property tDest As MidiThruConnectionEndpointMBS
Property tSource As MidiThruConnectionEndpointMBS
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project
The items on this page are in the following plugins: MBS MacCF Plugin.