Articles   Members Online: 3
-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 turn off the master volume of a sound card 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
30-Aug-02
Category
Multimedia
Language
Delphi 2.x
Views
114
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

How to turn off the master volume of a sound card

Answer:

1   unit WaveUnit;
2   
3   interface
4   
5   uses
6     Windows, Messages, SysUtils, Classes, Graphics, Controls,
7     Forms, Dialogs, MMSystem, StdCtrls;
8   
9   type
10    TForm1 = class(TForm)
11      Button1: TButton;
12      Edit1: TEdit;
13      Edit2: TEdit;
14      Memo1: TMemo;
15      procedure Button1Click(Sender: TObject);
16    private
17      { Private declarations }
18    public
19      { Public declarations }
20    end;
21  
22  var
23    Form1: TForm1;
24  
25  implementation
26  
27  {$R *.DFM}
28  
29  procedure TForm1.Button1Click(Sender: TObject);
30  var
31    NumDevs: Integer;
32    waveCaps: TWaveOutCaps;
33    Volume: DWORD;
34    Left, Right: Word;
35    Version: Word;
36  begin
37    { We should have at least one device }
38    NumDevs := waveOutGetNumDevs;
39    Edit1.Text := Format('Number of devices is %d', [NumDevs]);
40    { for the 1st device (hard-coded) }
41    {Get Device Caps}
42    waveOutGetDevCaps(0, @waveCaps, SizeOf(waveCaps));
43    { Show device caps }
44    Memo1.Lines.Add('Device Caps: ' + waveCaps.szPName);
45    Version := waveCaps.vDriverVersion;
46    Memo1.Lines.Add(Format('Driver Version: %d.%d', [Hi(Version), Lo(Version)]));
47    case waveCaps.wChannels of
48      1: Memo1.Lines.Add('Left');
49      2: Memo1.Lines.Add('Right');
50    end;
51    { Standard formats }
52    if waveCaps.dwFormats and WAVE_FORMAT_1M08 <> 0 then
53      Memo1.Lines.Add('11.025 kHz, mono, 8-bit');
54    if waveCaps.dwFormats and WAVE_FORMAT_1M16 <> 0 then
55      Memo1.Lines.Add('11.025 kHz, mono, 16-bit');
56  
57    {
58    WAVE_FORMAT_1S08        11.025 kHz, stereo, 8-bit
59    WAVE_FORMAT_1S16        11.025 kHz, stereo, 16-bit
60    WAVE_FORMAT_2M08        22.05 kHz, mono, 8-bit
61    WAVE_FORMAT_2M16        22.05 kHz, mono, 16-bit
62    WAVE_FORMAT_2S08        22.05 kHz, stereo, 8-bit
63    WAVE_FORMAT_2S16        22.05 kHz, stereo, 16-bit
64    WAVE_FORMAT_4M08        44.1 kHz, mono, 8-bit
65    WAVE_FORMAT_4M16        44.1 kHz, mono, 16-bit
66    WAVE_FORMAT_4S08        44.1 kHz, stereo, 8-bit
67    WAVE_FORMAT_4S16        44.1 kHz, stereo, 16-bit
68    }
69  
70      { If Volume Control Supported }
71    if waveCaps.dwSupport and WAVECAPS_VOLUME <> 0 then
72    begin
73      waveOutGetVolume(0, @Volume);
74      Left := LoWord(Volume);
75      Right := HiWord(Volume);
76      { Show values of WAVE Device on volume control panel }
77      Edit2.Text := Format('Left : %d, Right : %d', [Left, Right]);
78      waveOutSetVolume(0, $40008000);
79    end;
80  end;
81  
82  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