Solved

midiOutGetID

Posted on 1998-01-31
2
292 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

738 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