Welcome back guys.
And in this lesson what we are going to do? Let me run our application first here.
I want to here make function for my slider.
OK.
And then I changed my slider value.
Also I want to change my volume value.
OK.
I will set a new value for my volume.
So ho we can do that? First of all we need to find our slider.
OK.
Our slider is here right.
This volume slider is here and now.
And let me run it again.
Our slider value the first value is starting value is zero right.
Let me first set a starting value for our slider.
And here I'm going to say self dot volume sliders set value.
OK.
And now I am going to use here 70 and why 70 because I am going to use the minimum value will be zero and maximum
value will be 100 sorry 100 .
That's why here I want starting.
value will be 70 OK.
And if I run again but before that also let's use here self dot minimum and maximum value slider
dot set minimum minimum is going to be zero and also maximum is going to be 100.
One hundred Ok self dot volume slider dot set maximum and maximum is going to be 100.
Okay.
Now if I run my application again
now you see our slider value is 70.
OK.
And but of course this only our slider also we need to use We need to set this volume for our mixer.
OK.
But the for mixer is a little bit different.
And this mixer function for volume range is between 0 and 1.
That's why it's not between 0 100 and here what we need to do? For mixer we need to say here mixer
for starting point okay.
Mixer dot music this function dot set underscore volume.
Okay.
This is the function.
And here what we need to do? We need to use here range is between 0 and 1 That's why here I will use zero point seven
OK and it will be same this is the 70 percent and this is also 70 percent.
If I run my application again actually we are not going to say anything.
And what we need to do now also we need when we change our slider When I slide it also I need to set new
value for my volume.
OK so how I can do that here remember.
We already learned how we can use slider and how we can create a connect click connect function for
slider right.
So I will say here self dot value slider value changed.
Right.
This is the function and here I need to say connect and after that here I will say self dot set value
Ok this our functions so.
What I need to do ? I need to create this definition and it's here.
I'm going to define it here definition set volume and here what I need to do? First of I need to get my
value okay from my slider right.
I will say here self dot volume equals self dot volume slider dot value.
Okay.
Now let me print it out.
Actually we don't need to use here self parameter but it's OK.
Print self dot volume now when I slide my slider.
Let me try it again.
And here actually We don't need to
Here add a song.
Now here check it When I slide my slider.
You see now here value and here this zero minimum value and maximum value is one hundred its here.
But our starting point is 70.
It's here and now also I need to set this value for my mixer.
OK.
This also important.
But remember mixer our mixer uses only range between for volume 0 and 1.
So how I can set this volume slider value for my mixer also let me print it out.
Sorry let me comment this guy out and after that here I need to say mixer dot music.
OK.
Set again volume this function.
But here what I need to do? I need to
Use this volume right and here I will say self dot volume but divided by 100.
Remember our value was you see it is here between zero and one hundred.
So mixer mixer uses only range between 0 and 1.
So that means here we need to use. We need to divide our value by 100 OK.
Now If I run my application
and let me add sound first and here desktop sounds.
And this guy again.
And if I run it now you will play it you see it.
We set our volume value you see now its zero now it's 100 and now and you see now when we .
Slide our slider we set a new volume value for our mixer.
OK.
This is how we can set value set volume for our slider and also for our mixer for now that's all
see you in the next!