Click here to Skip to main content
15,171,659 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# MIDI controller interface. Pin
DaveyM6930-Sep-12 4:53
professionalDaveyM6930-Sep-12 4:53 
GeneralRe: C# MIDI controller interface. Pin
DaveyM697-Oct-12 3:42
professionalDaveyM697-Oct-12 3:42 
GeneralRe: C# MIDI controller interface. Pin
Jumpin' Jeff8-Oct-12 2:21
MemberJumpin' Jeff8-Oct-12 2:21 
GeneralRe: C# MIDI controller interface. Pin
Jumpin' Jeff10-Oct-12 4:46
MemberJumpin' Jeff10-Oct-12 4:46 
GeneralRe: C# MIDI controller interface. Pin
DaveyM6910-Oct-12 15:13
professionalDaveyM6910-Oct-12 15:13 
GeneralRe: C# MIDI controller interface. Pin
Jumpin' Jeff11-Oct-12 2:49
MemberJumpin' Jeff11-Oct-12 2:49 
GeneralRe: C# MIDI controller interface. Pin
Jumpin' Jeff11-Oct-12 3:13
MemberJumpin' Jeff11-Oct-12 3:13 
GeneralRe: C# MIDI controller interface. Pin
DaveyM6911-Oct-12 8:18
professionalDaveyM6911-Oct-12 8:18 
I can't test with Maple Virtual Midi Cable as it won't run on Win 7 x64. I have to suspect that there is a problem with their driver as it works fine with all my MidiMan and MAudio hardware, as well as with MidiYoke.

There seems to be something a little odd. There are 8 buffers assigned when Record is called. Every time one is used, another is assigned to take it's place unless the input is closing or resetting, so the first time line 454 is hit, there should be 8 buffers, even if you have received data.

Perhaps there is something going wrong for you in Callback? The buffers are returned to there which will reduce the count to 7 when the first SysEx is received, but should be re-added in the block from line 280. Can you put breakpoints on:

  • Line 253 and check the value of wMsg it should be 964. This should get hit 9 times - the first time SysEx is received, then once for each of the 8 buffers when midiInReset is called.
  • Line 276: Does it get hit? I'm suspecting not from what you describe. If not, the call to midiInUnprepareHeader on line 274 may be failing. If so, refactor that line so you can capture the result and let me know what the value is.
  • Line 288: Does it get hit? If the above succeeded then it's possible that midiInPrepareHeader or midiInAddBuffer are failing on lines 285 and 286. If so, refactor and call the two functions separately and let me know the return result(s).

It's very important that midiInReset is called so that the buffers can be returned by Windows, unprepared and freed - all this while the handle is still valid. Bypassing it may get the program to the end but could eventually cause RAM access problems without a reboot, BSOD or just an entire system hang/freeze.

I did consider creating a custom MidiException class and throwing an instance when a function returned non-zero. I decided against it in the end as it's important that everything gets disposed while live and not during a later GC. Halting on an exception would have made that impossible.

If we can't get to the bottom of this I will add some logging so the error codes are captured and saved.
Dave

Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.
Astonish us. Be exceptional. (Pete O'Hanlon)

BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)



GeneralRe: C# MIDI controller interface. Pin
Jumpin' Jeff11-Oct-12 9:21
MemberJumpin' Jeff11-Oct-12 9:21 
GeneralRe: C# MIDI controller interface. Pin
DaveyM6911-Oct-12 11:40
professionalDaveyM6911-Oct-12 11:40 
GeneralRe: C# MIDI controller interface. Pin
Jumpin' Jeff12-Oct-12 2:42
MemberJumpin' Jeff12-Oct-12 2:42 
GeneralRe: C# MIDI controller interface. Pin
DaveyM6911-Oct-12 11:51
professionalDaveyM6911-Oct-12 11:51 
GeneralRe: C# MIDI controller interface. Pin
Jumpin' Jeff11-Oct-12 15:34
MemberJumpin' Jeff11-Oct-12 15:34 
GeneralRe: C# MIDI controller interface. Pin
Jumpin' Jeff11-Oct-12 11:20
MemberJumpin' Jeff11-Oct-12 11:20 
GeneralRe: C# MIDI controller interface. Pin
DaveyM6911-Oct-12 11:52
professionalDaveyM6911-Oct-12 11:52 
GeneralRe: C# MIDI controller interface. Pin
DaveyM692-Nov-12 9:54
professionalDaveyM692-Nov-12 9:54 
GeneralRe: C# MIDI controller interface. Pin
Jumpin' Jeff2-Nov-12 13:23
MemberJumpin' Jeff2-Nov-12 13:23 
GeneralRe: C# MIDI controller interface. Pin
Jumpin' Jeff16-Nov-12 6:36
MemberJumpin' Jeff16-Nov-12 6:36 
GeneralRe: C# MIDI controller interface. Pin
DaveyM6916-Nov-12 7:22
professionalDaveyM6916-Nov-12 7:22 
GeneralRe: C# MIDI controller interface. Pin
Jumpin' Jeff16-Nov-12 14:17
MemberJumpin' Jeff16-Nov-12 14:17 
GeneralRe: C# MIDI controller interface. Pin
DaveyM6916-Nov-12 21:32
professionalDaveyM6916-Nov-12 21:32 
QuestionC# 2008 with linq reference problem Pin
dcof5-Sep-12 13:17
Memberdcof5-Sep-12 13:17 
AnswerRe: C# 2008 with linq reference problem Pin
Shameel5-Sep-12 21:35
professionalShameel5-Sep-12 21:35 
QuestionLoosley Coupled Events Pin
Member 81371055-Sep-12 11:21
MemberMember 81371055-Sep-12 11:21 
AnswerRe: Loosley Coupled Events Pin
Pete O'Hanlon5-Sep-12 11:27
mvaPete O'Hanlon5-Sep-12 11:27 

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.