Solved

midiOutGetID

Posted on 1998-01-31
2
285 Views
Last Modified: 2012-08-14
I need to know how to get the handle of midi output devices on my machine, for the midiOutGetID.
I use midiOutGetNumDevs to get to know how many devices I have available.
What do I do now?
How do I get their handles?
thank you.
CATT.
0
Comment
Question by:CATT
2 Comments
 
LVL 1

Accepted Solution

by:
Future earned 40 total points
ID: 1454720
Write a function similar to this.  You would use MidiOutGetDevCaps to get the capabilities of each device.
Add the following types and declarations to your program. The ID for the MIDI Mapper is always -1.  Hope this is enough to get you started.

Declare Function midiOutGetDevCaps Lib "winmm.dll" Alias "midiOutGetDevCapsA" (ByVal uDeviceID As Long, lpCaps As MIDIOUTCAPS, ByVal uSize As Long) As Long

Type MIDIOUTCAPS
        wMid As Integer
        wPid As Integer
        vDriverVersion As Long
        szPname As String * 32
        wTechnology As Integer
        wVoices As Integer
        wNotes As Integer
        wChannelMask As Integer
        dwSupport As Long
End Type


Function GetSoundBoardMIDIAudioID()  'looks for "synth" as output                                      'device
  Dim NumAuxDevs As Long
  Dim DevNum As Long
  Dim DevCaps As MIDIOUTCAPS
  Dim retval As Long, Pos As Long

  NumAuxDevs = midiOutGetNumDevs()
  GetSoundBoardMIDIAudioID = MIDI_MAPPER
  For DevNum = 0 To (NumAuxDevs - 1)
    retval = midiOutGetDevCaps(DevNum, DevCaps, 92)
    Pos = InStr(LCase$(DevCaps.szPname), "synth")
    If Pos <> 0 Then
      GetSoundBoardMIDIAudioID = DevNum
      Exit Function
    End If
  Next DevNum
End Function
0
 

Author Comment

by:CATT
ID: 1454721
No prob.  BTW, one thing you should add is PUBLIC MIDI_MAPPER = -1& along with your declarations.  Or just use -1 for the device ID instead of bothering with any of this, as far as I know all systems have the MIDI mapper installed as an output device.

0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question