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 restore the original volume settings after changing the volume of a wave 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
102
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

I'm trying to control the left/ right channel volume of a wave. I've checked with 
WaveOutGetDevCaps that volume and left/ right control is supported. When I try to 
read the volume with WaveOutGetVolume (using "word (Wave_Mapper)" as the device), I 
get MMSysErr_NotSupported. I need the original volume setting in order to restore 
it later. WaveOutSetVolume also returns the same error.

Answer:

The code below worked for me. You will see that it is in message handlers for 
WaveOutOpen etc. messages. The key might be that you need the handle to an open 
wave device rather than simply the constant for wave_mapper.


1   procedure TClockForm.mm_wom_open(var Msg: TMessage);
2   {This code handles the WaveOutOpen message by writing two buffers of data
3   to the wave device.  Plus other miscellaneous housekeeping.}
4   begin
5     waveOutGetVolume(hWave_out, @saved_volumes);
6     waveOutSetVolume(hWave_out, volumes);
7     waveOutPrepareHeader(hWave_out, p_wave_hdr, SizeOf(TWaveHdr));
8     waveOutWrite(hWave_out, p_wave_hdr, SizeOf(TWaveHdr));
9   end;
10  
11  procedure TClockForm.mm_wom_done(var Msg: TMessage);
12  {Handle the wave out done message}
13  begin
14    waveOutSetVolume(hWave_out, saved_volumes);
15    waveOutReset(hWave_out);
16    waveOutClose(hWave_out);
17  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