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 the volume on a wave device 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
115
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

How to get and set the volume on a wave device

Answer:

Here are a couple of functions for getting/ setting the volume on the default wave 
device:


1   uses
2     mmsystem;
3   
4   function GetWaveVolume: DWord;
5   var
6     Woc: TWAVEOUTCAPS;
7     Volume: DWord;
8   begin
9     if WaveOutGetDevCaps(WAVE_MAPPER, @Woc, sizeof(Woc)) = MMSYSERR_NOERROR then
10      if Woc.dwSupport and WAVECAPS_VOLUME = WAVECAPS_VOLUME then
11      begin
12        WaveOutGetVolume(WAVE_MAPPER, @Volume);
13        Result := Volume;
14      end;
15  end;
16  
17  procedure SetWaveVolume(const AVolume: DWord);
18  var
19    Woc: TWAVEOUTCAPS;
20  begin
21    if WaveOutGetDevCaps(WAVE_MAPPER, @Woc, sizeof(Woc)) = MMSYSERR_NOERROR then
22      if Woc.dwSupport and WAVECAPS_VOLUME = WAVECAPS_VOLUME then
23        WaveOutSetVolume(WAVE_MAPPER, AVolume);
24  end;
25  
26  
27  //Here's how they might be used:
28  
29  
30  procedure TForm1.Button2Click(Sender: TObject);
31  var
32    LeftVolume: Word;
33    RightVolume: Word;
34  begin
35    LeftVolume := StrToInt(Edit1.Text);
36    RightVolume := StrToInt(Edit2.Text);
37    SetWaveVolume(MakeLong(LeftVolume, RightVolume));
38  end;
39  
40  procedure TForm1.Button3Click(Sender: TObject);
41  begin
42    Caption := IntToStr(GetWaveVolume);
43  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