MIDI-OX User Forum (http://www.midiox.com/cgi-bin/yabb/YaBB.pl)
MIDI-OX >> Scripting Questions >> VB.net Code to Work with midi-ox
(Message started by: julynessi on Jan 1st, 2011, 5:41pm)

Title: VB.net Code to Work with midi-ox
Post by julynessi on Jan 1st, 2011, 5:41pm
'VB.net shot code for working with MIDI-OX
'You just need to add Listbox to Form1
'Add MidiOX reference to your project in "Project Menu"

Imports MIDIOXLib

Public Class Form1

   Public WithEvents mox As MIDIOXLib.MoxScript
   Delegate Sub FireToListbox(ByVal txt As String, ByVal obj As ListBox)

   Private Sub FireList(ByVal txt As String, ByVal obj As ListBox)
       Try
           If obj.InvokeRequired Then
               Dim d As New FireToListbox(AddressOf FireList)
               Me.Invoke(d, New Object() {txt, obj})
           Else
               ListBox1.Items.Add(txt)
           End If
       Catch ex As Exception
           MessageBox.Show(ex.Message)
       End Try
   End Sub

   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       mox = New MIDIOXLib.MoxScript
       mox.DivertMidiInput = 1
       mox.FireMidiInput = 1
   End Sub

   Private Sub mox_MidiInput(ByVal nTimestamp As Integer, ByVal port As Integer, ByVal status As Integer, ByVal data1 As Integer, ByVal data2 As Integer) Handles mox.MidiInput
       'combine all midi data in to 1 line split with ","
       Dim strMIDI As String = nTimestamp & "," & port & "," & status & "," & data1 & "," & data2
       FireList(strMIDI, ListBox1)
   End Sub

   Private Sub mox_SysExInput(ByVal bStrSysEx As String) Handles mox.SysExInput
       FireList(bStrSysEx, ListBox1)
   End Sub
End Class

Title: Re: VB.net Code to Work with midi-ox
Post by julynessi on Jan 1st, 2011, 5:46pm
this example will add midi input From midiOX
To your listbox
How-to
#1-Start your VS.net
2.New Project type VB.net windows form Application
3.then Drag Listbox to your form1
4.copy code to your form1.vb
5. hit F5 to test it

Hope this help

Title: Re: VB.net Code to Work with midi-ox
Post by drwave on Apr 17th, 2012, 11:58am
This sample was a great help to make MIDI from a PC. Initially I used a M-audio UNO to connect the USB out to a Korg Synth and it worked fine. The VB.net program generates MIDI messages that play on the synth. But now I want to eliminate the UNO and the synth. I don't want any MIDI input(except from the VB program) and I want the output to go to the PC WavTable sound card. Now if I try MIDI-OX with the MIDIBAR player I get a "no MIDI inputs" message but it does play a MIDI file on the PC soundcard. So does the "keyboard". But the VB.NET program provides no audio output ! Ideas ?



MIDI-OX User Forum » Powered by YaBB 1 Gold - SP 1.3.1!
YaBB © 2000-2003. All Rights Reserved.