Solved

Getting handle of midi device

Posted on 1997-06-09
3
301 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

825 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