Skinz 0.2 Volume Control (The follow along tutorial :)
[1/3] from: tbrownell:shaw:ca at: 26-Feb-2002 1:15
Ok, need a slider that provides a value of 0 on the bottom, to 255 on the top. Once
the slider stops moving, must fill in n below and make this call...
send-message winamp-hwnd WM_USER n 122
Realtime thing happening here, if the slider moves, then the new value is sent. How
often would/should it update.. my guess is, of course, when the value is different.
But with a slider it makes many incremental changes.. can each be sent via "SendMessage"?
TB
[2/3] from: greggirwin:mindspring at: 26-Feb-2002 9:39
Hi Terry,
<< Ok, need a slider that provides a value of 0 on the bottom, to 255 on the
top. Once the slider stops moving, must fill in n below and make this
call...
send-message winamp-hwnd WM_USER n 122 >>
map-slider-to-value: func [
"Converts a slider value between 0 and 1 to a value within a range."
value [number!] "A value between 0 and 1."
min-val [number!] "The minimum range value (if value = 0)."
max-val [number!] "The maximum range value (if value = 1)."
][
max-val - min-val * value + min-val
]
map-value-to-slider: func [
"Converts a value within a range to a slider value between 0 and 1."
value [number!] "A value between min-val and max-val."
min-val [number!] "The minimum range value. Equals a slider value of
0."
max-val [number!] "The maximum range value. Equals a slider value of
1."
][
value - min-val / (max-val - min-val)
]
view layout [
sld-vol: slider [
vol-val: to-integer map-slider-to-value sld-vol/data 255 1
print vol-val
]
]
You can use map-value-to-slider to preset the slider to the correct position
if you can read the current volume setting from WinAmp.
sld-vol/data: map-value-to-slider vol-current-value 255 1
--Gregg
[3/3] from: greggirwin::mindspring::com at: 26-Feb-2002 12:17
Ooops,
You said 0 to 255 and I posted sample values of 1 to 255.
--Gregg