Solved

midiOutGetID

Posted on 1998-01-31
2
280 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now