Solved

auxGetVolume

Posted on 1998-05-13
11
362 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
Comment Utility
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
Comment Utility
Adjusted points to 125
0
 
LVL 6

Expert Comment

by:Stuart_Johnson
Comment Utility
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
Comment Utility
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
Comment Utility
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:roosiedb
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 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

11 Experts available now in Live!

Get 1:1 Help Now