Solved

auxGetVolume

Posted on 1998-05-13
11
380 Views
Last Modified: 2010-05-18
Why does this procedure not work ???

unit VolUnit1;
uses ......., mmsystem;
...
var
    Device:       Byte;
    VolumeTotaal: Cardinal;
    VolumeLeft:   Word;
    VolumeRight:  Word;
...
procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Device:=2;
  auxGetVolume(Device,@VolumeTotaal);
  VolumeLeft := VolumeTotaal and $0000ffff;
  VolumeRight:= VolumeTotaal shr 16;
  Label1.Caption:=FloatToStr(VolumeTotaal);
  Label2.Caption:=FloatToStr(VolumeLeft);
  Label3.Caption:=FloatToStr(VolumeRight);
end;
...

HELP me PLEASE !!!!!
Thanx.
Stefan van Roosmalen.
0
Comment
Question by:roosiedb
  • 5
  • 4
  • 2
11 Comments
 
LVL 6

Expert Comment

by:Stuart_Johnson
ID: 1345410
Let me guess, you aren't using a Genuine SoundBlaster card are you?  We are trying to do the same thing here with an ESS Audio Drive card and it wont work - but it does perfectly on a Creative Labs card.

I just tested you code on my SB Vibra 16 P&P card and it worked perfectly.  However, when I ran it on the ESS Audio Drive 1689 P&P card, I just got the same number no matter what I set the volume levels too.

I would be interested to know if you can solve this or not.  We have had the guys from NEC trying to solve it for us, and we are in the middle of contacting ESS now.

If I find anything, rest assured, I will let you know.

Regards,

Stuart.
0
 

Author Comment

by:roosiedb
ID: 1345411
Adjusted points to 125
0
 
LVL 6

Expert Comment

by:Stuart_Johnson
ID: 1345412
Roosiedb:

So, are you using a non Sound Blaster compatible card???  I'ld just be interested to know if my comments where useful or not.

Stu.
0
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.

 

Author Comment

by:roosiedb
ID: 1345413
Well, I don't exactly know the name of my soundcard, but it is definitely not a SoundBlaster-card. I really do not know how to solve this problem and I want to ask everyone who can, to solve it so that my solution to this problem also works on the other soundcards, like for example: CreativeLabs. Otherwise my application won't work at computers with other soundcards than mine. When you found something what maybe can help me, please tell me. But I don't want to use new components, because I allready tried several components, and they seem only to work with SB-cards too. Bye!
0
 
LVL 4

Accepted Solution

by:
BoRiS earned 250 total points
ID: 1345414
roosiedb

here is a function I used recently on a Volume control component I wrote for someone here....

add this to the your unit

const
  AuxVolume       = 0;
  WaveVolume    = 1;
  MidiVolume     = 2;

type
    TVolumeRec = record
    case Integer of
    0: (LongVolume: Longint);
    1: (LeftVolume,
        RightVolume : Word);
    end;

then this to your private clause

FDevices     : array[0..2] of Integer;
function       GetVolume(PIndex: Integer): Byte;

then here is the function

    function       TVolumeMixer.GetVolume(PIndex: Integer): Byte;
    var Mix: TVolumeRec;
    begin
      Mix.LongVolume := 0;
      if FDevices[PIndex] <> -1 then
      case PIndex of
      0: auxGetVolume(FDevices[PIndex], @Mix.LongVolume);
      1: waveOutGetVolume(FDevices[PIndex], @Mix.LongVolume);
      2: midiOutGetVolume(FDevices[PIndex], @Mix.LongVolume);
      end;
      Result := (Mix.LeftVolume + Mix.RightVolume) shr 9;
    end;

It works on my machine and I have an OPTI card which is not a Sound blaster compatible card

Anyway this function goes along with a procdeure called setvolume etc....

Let me know if it works

Later
BoRiS
0
 

Author Comment

by:roosiedb
ID: 1345415
Boris,

Your function seems to work great, but I also want to know how I can get the volume-values of the other mixer-channels (Master and Microphone). Would you please tell me how to adjust the code you sent me so that I can finish my (audio)job.
Thanx !!

Stefan van Roosmalen.
0
 
LVL 4

Expert Comment

by:BoRiS
ID: 1345416
roosiedb

The master volume I'm still working on but the microphone volume I have set up

Please grad this answer and send me your mail address then I'll send you the component I wrote that gets and sets all the volumes except for now the master volume which is what I'm busy with...

Later
BoRiS
0
 

Author Comment

by:roosiedb
ID: 1345417
My e-mail adres is:
roosiedb@wxs.nl
Please send me the MICROPHONE and MASTER -stuff too ...
Thanx again. It is worth 250 points !!! Excellent !!!
0
 
LVL 4

Expert Comment

by:BoRiS
ID: 1345418
roosiedb

K I'll send you the component as sson as I get the master volume done..

I have added you to my contacts list so I'll mail you the component soon

till then

Later
BoRiS
0
 

Author Comment

by:roosiedb
ID: 1345419
Boris, Can I have you e-mail to contact you in the future for this kind of things?
Bye! Stefan.
0
 
LVL 4

Expert Comment

by:BoRiS
ID: 1345420
roosiedb

my email at work is pdutoit@brillacc.com
and at home is idbehold@iafrica.com

keep in touch

Later
BoRiS
(Phillip)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

828 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