Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to Get and Set volume (soundcard) Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
19-Jun-03
Category
Multimedia
Language
Delphi 3.x
Views
122
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Udo Nesshoever

How do I get the soundcard's volume? How to set it ?

Answer:

1   procedure GetVolume(var volL, volR: Word);
2   var
3     hWO: HWAVEOUT;
4     waveF: TWAVEFORMATEX;
5     vol: DWORD;
6   begin
7     volL := 0;
8     volR := 0;
9     // init TWAVEFORMATEX
10    FillChar(waveF, SizeOf(waveF), 0);
11    // open WaveMapper = std output of playsound
12    waveOutOpen(@hWO, WAVE_MAPPER, @waveF, 0, 0, 0);
13    // get volume
14    waveOutGetVolume(hWO, @vol);
15    volL := vol and $FFFF;
16    volR := vol shr 16;
17    waveOutClose(hWO);
18  end;
19  
20  procedure SetVolume(const volL, volR: Word);
21  var
22    hWO: HWAVEOUT;
23    waveF: TWAVEFORMATEX;
24    vol: DWORD;
25  begin
26    // init TWAVEFORMATEX
27    FillChar(waveF, SizeOf(waveF), 0);
28    // open WaveMapper = std output of playsound
29    waveOutOpen(@hWO, WAVE_MAPPER, @waveF, 0, 0, 0);
30    vol := volL + volR shl 16;
31    // set volume
32    waveOutSetVolume(hWO, vol);
33    waveOutClose(hWO);
34  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC