Solved

Getting handle of midi device

Posted on 1997-06-09
3
298 Views
Last Modified: 2010-04-03
I am using MediaPlayer to control midi playback.
I want to control the volume and to do so must(?) use the Win32 call:

midiOutSetVolume

which takes a Handle(HMIDIOUT) as first parameter but MediaPlayer only provides the DeviceID
(which, BTW, was all that was needed under Win16!)

How can I obtain this Handle?

Alan G.
0
Comment
Question by:agauld
  • 2
3 Comments
 

Author Comment

by:agauld
ID: 1336884
Edited text of question
0
 
LVL 1

Accepted Solution

by:
fsanchez earned 100 total points
ID: 1336885
I have executed this code and it worked on my computer, but I'm not sure it will work always. Try it.

uses MMSystem;
...
var
  HandleMidi: HMIDIOUT;
  Capabilities: TMidiOutCaps;
begin
  if(MidiOutGetDevCaps(MediaPlayer1.DeviceID, @Capabilities, sizeof(Capabilities)) = MMSYSERR_NOERROR) and
   ((Capabilities.dwSupport and MIDICAPS_VOLUME) <> 0)
  then
  begin
    { $FFFF means full volume on both channels }
    if MidiOutSetVolume(MediaPlayer1.DeviceID, $FFFF) <> MMSYSERR_NOERROR then
      ShowMessage('Error');
  end
  else
    ShowMessage('Volume not supported');
end;

If it doesn't work, you should use the handle returned by midioutopen, because the MediaPlayer use mci messages (higl level API) and that handle is used only with the low level API. Note that some cards or drivers don't implement midi volume setting.
0
 

Author Comment

by:agauld
ID: 1336886
The answer is good but didn't work for me... I can read the volume but not set it.
Also tried waveOutSetVolume but same result!


0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi 2010 Export to pdf 2 287
drawing animated level bar based on numbers 3 88
tidtcpserver connection lost handle 2 70
Firemonkey android show image from resource ? 1 32
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

911 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

16 Experts available now in Live!

Get 1:1 Help Now