Platforms to show: All Mac Windows Linux Cross-Platform
/MacCF/MIDI/Event Benchmark/MIDI Destination
Required plugins for this example: MBS MacCF Plugin, MBS Main Plugin
Last modified Fri, 4th Oct 2012.
You find this example project in your MBS Xojo Plugin download as a Xojo project file within the examples folder: /MacCF/MIDI/Event Benchmark/MIDI Destination
Download this example: MIDI Destination.zip
Project "MIDI Destination.xojo_binary_project"
FileTypes
Filetype text
End FileTypes
Class Window1 Inherits Window
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
Control Label2 Inherits Label
ControlInstance Label2 Inherits Label
End Control
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
EventHandler Sub Action()
label2.text = str(endpoint.count)
Label1.text = "Receiving "+str(endpoint.count-lastcount)+" per second."
lastcount = endpoint.count
End EventHandler
End Control
EventHandler Sub Close()
closeMidiClient
End EventHandler
EventHandler Sub Open()
Client=new MidiClientMBS
openMidiClient
End EventHandler
Protected Sub closeMidiClient()
End Sub
Sub openMidiClient()
dim i,n as Integer
dim myname as cfstringMBS
myname=NewCFStringMBS("MidiTest")
Client.Init(myname)
if Client.Lasterror <> 0 then
MsgBox "MidiClient MBS Init failed: " + str(Client.Lasterror)
end
endpoint=new myMidiEndpoint
Client.Createdestination(newcfstringMBS("MyDestination"), endpoint)
if endpoint.Handle=0 then
MsgBox "There was an error: "+str(Client.Lasterror)
end if
system.debuglog "endpoint.handle: "+hex(endpoint.Handle)
End Sub
Property Protected Client As midiclientMBS
Property Protected endpoint As MyMidiEndpoint
Property lastcount As Integer
End Class
MenuBar MenuBar1
MenuItem UntitledMenu1 = ""
MenuItem FileMenu = "&File"
MenuItem FileQuit = "Quit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
Class MyMidiEndpoint Inherits MidiEndpointMBS
EventHandler Sub Read(endpoint as MidiEndpointMBS, list as MidiPacketListMBS)
count = count + 1
'window1.Label2.text = str(count)
End EventHandler
Property count As integer
End Class
End Project
See also:
Download this example: MIDI Destination.zip
The items on this page are in the following plugins: MBS MacCF Plugin.