Jabaco Source |
|
1 2 3 4 5 6 7 8 9 |
Import themidibus#* Dim MB As New MBClass Dim myBus As New MidiBus(MB,0,1) ' 0 and 1 in this case refer to the MIDI input and output devices that you wish you use. You will need to enumerate your devices using midibus.list (below) and choose the appropriate values. Public Sub Form_Load() midibus.list End Sub |
Jabaco Source |
|
1 2 3 4 5 |
Public Sub controllerChange(channel As Integer,number As Integer,value As Integer) system.out.println("Channel: " & channel & " Number: " & number & " Value: " & value) End Sub |
Beginner
Date of registration: Feb 18th 2013
Location: Varese, Italy
Hobbies: programming, electronic engeenering, 3D graphic with CAD
Source code |
|
1 2 3 |
Public Sub rawMidi(rawData() As Byte) Text1.Text = Text1.Text & "raw - " & rawData(0) & vbCrLf End Sub |
Source code |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
'Import themidibus#* 'I see that this is not really needed (just add themidibus.jar to ClassPath) '************************************** SYNTAX FOR MIDIBUS COSTRUCTOR ************************************ '** (These are just a few costructors) there are actually many more (please refer to TheMidiBus JavaDoc ** '******** not passing anything as an argument is left to decide what to do TheMidiBus library ************ '********************************************************************************************************* ' Parent In Out ' | | | 'myBus = New MidiBus(this, 0, 1); // Create a New MidiBus using the device index To Select the Midi input And output devices respectively. ' Parent In Out ' | | | 'myBus = New MidiBus(this, "IncomingDeviceName", "OutgoingDeviceName"); // Create a New MidiBus using the device names To Select the Midi input And output devices respectively. ' Parent In Out ' | | | 'myBus = New MidiBus(this, -1, "Java Sound Synthesizer"); // Create a New MidiBus With no input device and the default Java Sound Synthesizer As the output device. ' 0 and 1 in this case refer to the MIDI input and output devices that you wish you use. ' You will need To enumerate your devices using midibus.list (below) And choose the appropriate values. 'Dim MB As New MBClass 'use external class for midi input events (not used in this example because we use this istance (Me)) 'Dim myBus As New MidiBus(MB,0,1) 'use external class for midi input events (not used in this example because we use this istance (Me)) Dim myBus As New MidiBus(Me,0,1) 'use this istance for midi input events 'Dim myBus As New MidiBus() 'if default costructor is used then you need to use "INITIALIZE" 'Dim Note AS Note 'use this if you want manipulate Note class of TheMidiBus library 'Dim CChange As ControlChange 'use this if you want manipulate ControlChange class of TheMidiBus library 'Dim Message As MidiMessage 'use this if you want manipulate low level javafx.sound.midi MidiMessage Dim Count As Integer = 0 Public Sub Form_Load() MidiBus.list ' INITIALIZE (use this if you have previously used the constructor with no parameters) ' myBus.addInput(0) ' myBus.addOutput(1) ' myBus.registerParent(Me) End Sub Public Sub Form_Unload(cancel As Integer) myBus.close End Sub Sub cmd1_Click() Text1.Text = "" Count = 0 : lblCount.Caption = Count End Sub Sub RefreshLabel Count = Count + 1 : lblCount.Caption = Count ' Text1.SelStart = Count*100 End Sub Public Sub controllerChange(ch As Integer, ctrl As Integer, val As Integer) Text1.Text = Text1.Text & "ControlChange - Channel: " & ch+1 & " Control: " & ctrl & " Value: " & val & vbCrLf RefreshLabel End Sub Public Sub noteOn(ch As Integer, note As Integer, vel As Integer) Text1.Text = Text1.Text & "NoteOn - Channel: " & ch+1 & " Note: " & note & " Velocity: " & vel & vbCrLf RefreshLabel End Sub Public Sub noteOff(ch As Integer, note As Integer, vel As Integer) Text1.Text = Text1.Text & "NoteOff - Channel: " & ch+1 & " Note: " & note & " Velocity: " & vel & vbCrLf RefreshLabel End Sub Public Sub rawMidi(rawData() As Byte) Text1.Text = Text1.Text & "raw - " & rawData(0) & vbCrLf RefreshLabel End Sub |
This post has been edited 5 times, last edit by "maxer73" (Oct 12th 2014, 8:44pm)
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 |
Dim data() as byte Dim a as integer Public Sub midiMessage(Message As javax#sound#midi#MidiMessage) data()=Message.getMessage 'your MIDI byte array For a=0 To (Message.getLength)-1 system.out.println(data(a)) Next a End Sub |