Startseite › Foren › Deutsches LiveCode-Forum › Eigener Lautstärkeregler › Antwort auf: Eigener Lautstärkeregler
Februar 16, 2020 um 21:52 Uhr
#18968
Hi Akrages,
OK, in meinem Beispiel lege ich den neuen Wert für Playloundness in ein Feld mit dieser Zeile:
on mousemove x,y
if darfziehen then
switch
case x < the left of grc "rampe_horizontal"
##set the loc of me to item 1 of the loc of me, the top of grc "rampe_horizontal"
set the loc of me to the left of grc "rampe_horizontal", item 2 of the loc of me
put 0 into fld "volume"
break
case x > the right of grc "rampe_horizontal"
##set the loc of me to item 1 of the loc of me, the top of grc "rampe_horizontal" - tAusgleich
set the loc of me to the right of grc "rampe_horizontal", item 2 of the loc of me
put 100 into fld "volume"
break
default
set the loc of me to x, item 2 of the loc of me
put round((x - the left of grc "rampe_horizontal")/(the width of grc "rampe_horizontal")*maxValue) into fld "volume"
break
end switch
end if
end mousemove
Wenn Du diesen „Umweg“ nun umgehen und direkt die Lautstärke setzen möchtest, schreib es so:
on mousemove x,y
if darfziehen then
## Zuerst die neue Lautstärke ermitteln mit hilfe von etwas Geometrie :-)
switch
case x < the left of grc "rampe_horizontal"
##set the loc of me to item 1 of the loc of me, the top of grc "rampe_horizontal"
set the loc of me to the left of grc "rampe_horizontal", item 2 of the loc of me
put 0 into neuelautstärke
break
case x > the right of grc "rampe_horizontal"
##set the loc of me to item 1 of the loc of me, the top of grc "rampe_horizontal" - tAusgleich
set the loc of me to the right of grc "rampe_horizontal", item 2 of the loc of me
put 100 into neuelautstärke
break
default
set the loc of me to x, item 2 of the loc of me
put round((x - the left of grc "rampe_horizontal")/(the width of grc "rampe_horizontal")*maxValue) into neuelautstärke
break
end switch
## Und nun erst setzen:
set the playloudness to neuelautstärke
end if
end mousemove
Gruß
Klaus