Click here to Skip to main content
15,887,746 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: MIDI and USB Keyboard! Pin
User 989707413-Nov-17 9:00
User 989707413-Nov-17 9:00 
GeneralRe: MIDI and USB Keyboard! Pin
User 989707429-Nov-17 4:16
User 989707429-Nov-17 4:16 
GeneralRe: MIDI and USB Keyboard! Pin
Sascha Lefèvre29-Nov-17 23:34
professionalSascha Lefèvre29-Nov-17 23:34 
GeneralRe: MIDI and USB Keyboard! Pin
User 989707430-Nov-17 0:10
User 989707430-Nov-17 0:10 
GeneralRe: MIDI and USB Keyboard! Pin
User 98970742-Dec-17 0:48
User 98970742-Dec-17 0:48 
GeneralRe: MIDI and USB Keyboard! Pin
Sascha Lefèvre2-Dec-17 6:06
professionalSascha Lefèvre2-Dec-17 6:06 
GeneralRe: MIDI and USB Keyboard! Pin
User 98970742-Dec-17 6:44
User 98970742-Dec-17 6:44 
GeneralRe: MIDI and USB Keyboard! Pin
Sascha Lefèvre3-Dec-17 0:56
professionalSascha Lefèvre3-Dec-17 0:56 
Alienoiz wrote:
sorry..i am too lame for that..and ..i am not understanding...
and btw..i respect you all..i am not making funny of you or anything like that...i ask..if you want to reply the better, if not, i must live with it without complaints...i aprecciate your efforts and etc...
I am not a "sucking" guy..
Let me clarify. Yes, of course I want to be respected. But not by being sucked up to. Eew. No - my idea here of helping people is to teach. So they learn and can do it themselves next time. So the way I want to be respected is by people taking the advice and at least making an effort to implement it by themselves.

One more attempt:
VB
Function MidiInProc(ByVal hMidiIn As Integer, ByVal wMsg As UInteger, ByVal dwInstance As Integer, ByVal dwParam1 As Integer, ByVal dwParam2 As Integer) As Integer
    Dim DataByte1 = (dwParam1) >> 8
    m.PlayMIDINote(DataByte1, 127)
    m.NoteDuration = CInt(cboduration.Text)
    m.Pan = 50
End Function
The underlined line is the problem. You can't access cboduration inside that function because it's being executed by a different thread that originates from that MIDI-component. But only the UI-thread may access controls.

You already modify other settings (than NoteDuration) on the UI-thread. Example:
VB
Private Sub cboInstruments_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboInstruments.SelectedIndexChanged
    m.CurrentInstrument = cboInstruments.Text
End Sub
You need to do the same for m.NoteDuration.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

GeneralRe: MIDI and USB Keyboard! Pin
User 98970743-Dec-17 2:39
User 98970743-Dec-17 2:39 
GeneralRe: MIDI and USB Keyboard! Pin
Sascha Lefèvre3-Dec-17 6:10
professionalSascha Lefèvre3-Dec-17 6:10 
GeneralRe: MIDI and USB Keyboard! Pin
User 98970743-Dec-17 8:11
User 98970743-Dec-17 8:11 
GeneralRe: MIDI and USB Keyboard! Pin
User 98970746-Dec-17 6:45
User 98970746-Dec-17 6:45 
GeneralRe: MIDI and USB Keyboard! Pin
User 98970749-Dec-17 6:01
User 98970749-Dec-17 6:01 
GeneralRe: MIDI and USB Keyboard! Pin
Sascha Lefèvre9-Dec-17 6:49
professionalSascha Lefèvre9-Dec-17 6:49 
GeneralRe: MIDI and USB Keyboard! Pin
User 98970749-Dec-17 7:31
User 98970749-Dec-17 7:31 
GeneralRe: MIDI and USB Keyboard! Pin
User 989707410-Dec-17 4:39
User 989707410-Dec-17 4:39 
GeneralRe: MIDI and USB Keyboard! Pin
User 989707411-Dec-17 0:56
User 989707411-Dec-17 0:56 
GeneralRe: MIDI and USB Keyboard! Pin
Sascha Lefèvre11-Dec-17 4:40
professionalSascha Lefèvre11-Dec-17 4:40 
GeneralRe: MIDI and USB Keyboard! Pin
User 989707411-Dec-17 4:48
User 989707411-Dec-17 4:48 
GeneralRe: MIDI and USB Keyboard! Pin
Sascha Lefèvre11-Dec-17 4:56
professionalSascha Lefèvre11-Dec-17 4:56 
GeneralRe: MIDI and USB Keyboard! Pin
Sascha Lefèvre11-Dec-17 4:58
professionalSascha Lefèvre11-Dec-17 4:58 
GeneralRe: MIDI and USB Keyboard! Pin
User 989707411-Dec-17 5:04
User 989707411-Dec-17 5:04 
GeneralRe: MIDI and USB Keyboard! Pin
Sascha Lefèvre11-Dec-17 5:09
professionalSascha Lefèvre11-Dec-17 5:09 
GeneralRe: MIDI and USB Keyboard! Pin
User 989707411-Dec-17 5:18
User 989707411-Dec-17 5:18 
GeneralRe: MIDI and USB Keyboard! Pin
Sascha Lefèvre11-Dec-17 5:39
professionalSascha Lefèvre11-Dec-17 5:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.