Solved

auxGetVolume

Posted on 1998-05-13
11
366 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
 

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

 

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

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

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
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…

862 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

25 Experts available now in Live!

Get 1:1 Help Now