Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

changing speaker volume

Status
Not open for further replies.

cyprus106

Programmer
Apr 30, 2001
654
0
0
I have a problem. I need to make a function that allows users to change the volume of speakers, bass and treble. I know its possible but i dont know how! any advice?

Thanks alot...Cyprus Cyprus
 
Here's what I did with Win '98:
//-------------------------------------------------------
void __fastcall TForm1::SpeedButton2Click(TObject *Sender)
{
STARTUPINFO Info;
PROCESS_INFORMATION ProcInfo;

memset(&Info,0,sizeof(Info));
Info.cb = sizeof(Info);
Info.dwXSize = 300;
Info.dwYSize = 300;

CreateProcess("C:\\WINDOWS\\SNDVOL32.EXE","C:\\",
NULL,NULL,false,0,NULL,"C:\\",&Info,&ProcInfo);
}
//---------------------------------------------------------
It works for me!
 
Hi
I have an application in which the user can alter the speaker volume. I use a slider bar to select the value. The value of the slider bar is then used in a the waveOutSetVolume instruction.

You can find information about these functions by going to the Microsoft help area of Borland C++ Builder. Hold on tight as this path is not short!!!

START
Borland C++ Builder
Help
MS SDK Help File
Contents
Multimedia Programmers Reference
Waveform audio


do a search for 'waveOutSetVolume()' and also
'waveOutGetVolume()'

I read and store the exisitng value and then I set the new values. Note that the 'volume' value is a compund value with both the left and right volumes being burried in the same number.

Note that some bizarre things can happen when dealing with the MediaPlayer and MS Sound systems as these functions are completely asynchronous to what your program is doing. You need to be very careful that you do not get yourself tied in timing loop that completley crashes the software you are running.

I hope this information is useful for you - cry out if you need some more assistance (loud@cse-magic.com).

regards

Rob in Oz (Australia)
 
roboz,
i cant find mssdk or anything like that anywhere in help(s). I checked the folder the start menu, other folders, and I just can't find it. Im running bcb5 enterprise, if that helps or hurts any. I kinda figured some of the sound control out, like how to control sound, but i didnt really know what i was doing, and the things realy unstable, so I'd like to find the documentation on it. Would you know how to control base, treb and various other output volumes also? I've been hired to do a project where I am supposed to make a equalizer, but i dont know the first thing about controlling sound volumes... any suggestions?

thanks alot for your help, it got me started.... Cyprus
 
Hi Cyprus106,
The Help files that I mentioned are part of the Microsoft Help files that come with Borland C++ Builder. Maybe you need to go back to the installation process and run setup to load the Microsoft Help Files.

These instructions are Windows calls and not Borland C++ functions. You are interfacing directly to the PC's hardware. However, the instructions do allow control of the individual channels for volume, but I think that they do support the other parameters you want. If you find the solution, please let me know!.

I cannot see anywhere that these instructions allow you to control treble and base as I suspect that treble and base are not part of the standard mediaplayer component. Perhaps you need to find the software instructions relevant to the sound card that you are using if it can support base and treble.

I hope this helps - scream if you need more assistance

Roboz in Australia

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top