musikbox
alarming
autosfx
aysalia
calllib
checksum-tools
cmdb2
colormanager
cryptochat
currency_converter
decoder
delphiutils
distributed
dpcstudio
dpg2
fastphp
fileformats
filter_foundry
forest
gridgame
ht46f47_simulator
indexer_suite
ipe_artfile_utils
javautils
jumper
lightgame
logviewer
mystic_house
oidconverter
oidinfo_api
oidinfo_new_design
oidplus
personal-webbase
php_antispam
php_clientchallenge
php_guestbook
php_utils
plumbers
prepend
recyclebinunit
simple_log_event
sokoban
spacemission
stackman
userdetect2
uuid_mac_utils
vgwhois
vnag
webcounter
winbugtracker
yt_downloader
BlueGrey
calm
Elegant
Català-Valencià – Catalan
中文 – Chinese (Simplified)
中文 – Chinese (Traditional)
Česky – Czech
Dansk – Danish
Nederlands – Dutch
English – English
Suomi – Finnish
Français – French
Deutsch – German
עברית – Hebrew
हिंदी – Hindi
Magyar – Hungarian
Bahasa Indonesia – Indonesian
Italiano – Italian
日本語 – Japanese
한국어 – Korean
Македонски – Macedonian
मराठी – Marathi
Norsk – Norwegian
Polski – Polish
Português – Portuguese
Português – Portuguese (Brazil)
Русский – Russian
Slovenčina – Slovak
Slovenščina – Slovenian
Español – Spanish
Svenska – Swedish
Türkçe – Turkish
Українська – Ukrainian
Oëzbekcha – Uzbek
Subversion Repositories
musikbox
musikbox
/
trunk
/
VCL_WAVECONTROL
/
WaveControl.pas
– Rev 2
Rev
Blame
|
Last modification
|
View Log
|
RSS feed
{=====================================================|
| WaveControl 1.00 - (c) 1998 by John Mogesnen, DK |
|-----------------------------------------------------|
| Change the WAV-Volume settings for Delphi 3 |
| (16 and 32 bits) |
|-----------------------------------------------------|
| E-Mail: JMogensnen@Web4you.dk |
|=====================================================}
(* Attention: To enabled componentuser to change the
Update time remove the {} from the Code!*)
unit
WaveControl
;
interface
uses
Windows
,
Messages
,
SysUtils
,
Classes
,
Graphics
,
Controls
,
Forms
,
Dialogs
,
ExtCtrls
,
ComCtrls
;
type
TWaveVolumeSetting
=
class
(
TTrackBar
)
private
FTimer
:
TTimer
;
FInterval
:
Integer
;
{ procedure SetInterval(Value : integer);}
procedure
FTimerOnTimer
(
sender
:
TObject
)
;
procedure
OnTrackChange
(
Sender
:
TObject
)
;
function
GetTrackBar
:
integer
;
procedure
SetVolume
;
protected
public
constructor
Create
(
AOwner
:
TComponent
)
;
override
;
destructor
Destroy
;
override
;
published
{ property WavUpdateInterval: integer read FInterval write SetInterval;}
end
;
procedure
Register
;
var
pCurrentVolumeLevel
:
PDWord
;
CurrentVolumeLevel
:
DWord
;
VolumeControlHandle
:
hWnd
;
GetCurrentVolumeLevel
:
LPDWORD
;
implementation
Uses
Wave_System_Control
;
procedure
Register
;
begin
RegisterComponents
(
'Samples'
,
[
TWaveVolumeSetting
]
)
;
end
;
constructor
TWaveVolumeSetting
.
Create
(
AOwner
:
TComponent
)
;
begin
inherited
Create
(
Aowner
)
;
New
(
pCurrentVolumeLevel
)
;
Orientation
:
=
trVertical
;
TickStyle
:
=
tsNone
;
TickMarks
:
=
tmBoth
;
Width
:
=
27
;
Height
:
=
113
;
min
:
=
0
;
max
:
=
26
;
FInterval
:
=
1
;
FTimer
:
=
TTimer
.
create
(
self
)
;
FTimer
.
Enabled
:
=
TRUE
;
FTimer
.
interval
:
=
FInterval
;
FTimer
.
OnTimer
:
=
FTimerOnTimer
;
OnChange
:
=
OnTrackChange
;
SetVolume
;
end
;
destructor
TWaveVolumeSetting
.
Destroy
;
begin
inherited
Destroy
;
end
;
{
procedure TWaveVolumeSetting.SetInterval(Value: integer);
begin
if (FInterval <> Value) then
begin
FInterval := Value;
FTimer.interval := FInterval;
end;
end;
}
function
TWaveVolumeSetting
.
GetTrackBar
:
integer
;
begin
result
:
=
65535
div
max
;
end
;
procedure
TWaveVolumeSetting
.
OnTrackChange
(
Sender
:
TObject
)
;
Var
x
:
Integer
;
begin
IF
Orientation
=
trVertical
then
x
:
=
max
-
position
ELSE
x
:
=
position
;
CurrentVolumeLevel
:
=
(
x
*
GetTrackBar
shl
16
)
+
(
x
*
GetTrackBar
)
;
WaveOutSetVolume
(
VolumeControlHandle
,
CurrentVolumeLevel
)
;
end
;
procedure
TWaveVolumeSetting
.
SetVolume
;
begin
VolumeControlHandle
:
=
FindWindow
(
'Volume Control'
,
nil
)
;
WaveOutGetVolume
(
VolumeControlHandle
,
pCurrentVolumeLevel
)
;
CurrentVolumeLevel
:
=
pCurrentVolumeLevel
^
;
IF
Orientation
=
trVertical
then
position
:
=
max
-
LoWord
(
CurrentVolumeLevel
)
DIV
GetTrackBar
ELSE
position
:
=
LoWord
(
CurrentVolumeLevel
)
DIV
GetTrackBar
;
end
;
procedure
TWaveVolumeSetting
.
FTimerOnTimer
(
sender
:
TObject
)
;
begin
SetVolume
;
end
;
end
.