• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 380
  • Last Modified:

MIDIOutGetDevCaps

I try this simple thing;

y = midiOutGetDevCaps(0, MIDIOUTCAPS, 1024)
Text1.Text = y

but get an byref argument mismatch at the MIDIOUTCAPS
Can you help?

0
CATT
Asked:
CATT
  • 3
  • 2
1 Solution
 
dirtdartCommented:
You can't use a type directly in a call like the one above.  You have to create a variable of that type.  For example:

Dim MIC As MIDIOUTCAPS

'Set your MIDIOUTCAPS options here

y = midiOutGetDevCaps(0, MIC, 1024)

This should solve the problem.
0
 
CATTAuthor Commented:
well ok, but I get a 0, zero, return.
Do I read it wrong?

0
 
dirtdartCommented:
1.  Is 0 an actual Device ID of a midi device?  If not, this is probably where you are getting your error.  If no device is specified, then it can't query the device.

2.  Instead of using the constant 1024 for the size of your MIDIOUTCAPS structure, use the actual size.  You can do this with the Len() function.  Like this:

Dim MIC As MIDIOUTCAPS
Dim lMIC As Long

'Set MIDIOUTCAPS options here if you need too.

lMIC = Len(MIC)

y = midiOutGetDevCaps(uDeviceID, MIC, lMIC)

3.  Is y defined as any type of variable.  Some API calls won't return a value to a variable unless it is explicitly defined.  This is usually the case with strings, but can also happen with long values.
0
 
CATTAuthor Commented:
0 should be ok, checked with midioutgetnumdevs, what returns 2. I need to connect to it and use midioutopen, but need to tell wich mididevice to use. I need both an address and an identifier. Guess the 2 I get gives me one of them, but am I not to read the  MIDIOUTCAPS content for that, or can you show me the way?
0
 
dirtdartCommented:
Don't think 0 is going to be alright.  The reurn of 2 is simply the number of midi devices present on your system.  That doesn't necessarily mean that they are identified as 0 and 1.  You would have to use midiOutGetID to get the proper device ID for a given device, and before you do that, you have to get a device handle, which I have no idea how to do.  As far as the address, I'm not sure which address you are looking for, so I don't know how to get it.

I think this all goes back to you needing a proper device ID for the device you are trying to retrieve information on.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now