Hi
I have just noticed something that really needs putting right.
I have included a sound on/off button and a volume slider control.
Both these work ok.
However, I now notice that if i adjust slider to say 20 and then turn sound off and then sound back on the slider stays the same but the volume is 100.
Naturally I would like the slider volume level to remain the same after sound off and then sound on.
Obviously the volume reflects in the code, so, something else is required.
function Bspkon_OnClick(GUIControl *control, MouseButton button)
{
if (Bspkon.NormalGraphic==1125)
{
Bspkon.NormalGraphic=1126;
System.Volume = 0;
Lsoundonoff.Text="Off";
}
else if (Bspkon.NormalGraphic==1126)
{
Bspkon.NormalGraphic=1125;
System.Volume = 100;
Lsoundonoff.Text="On";
}
}
Cheers for all assistance
EDIT: This seems to do the trick (at least i'm sure)
function Bspkon_OnClick(GUIControl *control, MouseButton button)
{
if (Bspkon.NormalGraphic==1125)
{
Bspkon.NormalGraphic=1126;
System.Volume = 0;
Lsoundonoff.Text="Off";
}
else if (Bspkon.NormalGraphic==1126)
{
Bspkon.NormalGraphic=1125;
System.Volume = 100;
Lsoundonoff.Text="On";
System.Volume = sldAudio2.Value; // ADDED THIS BIT
}
}
// Bspkon_OnClick
else if (Bspkon.NormalGraphic == 1126)
{
Bspkon.NormalGraphic = 1125;
System.Volume = 100;
Lsoundonoff.Text = "On";
System.Volume = sldAudio2.Value; // ADDED THIS BIT
}
It's helpful to understand what your code is actually doing. Assuming that 1126 is the sprite that represents the speakers (and volume) being "on" (not muted), then you do realize that:
System.Volume = 100;
This line is the reason it was always being set to 100 and not the current value of sldAudio2...right? For the record, that line shouldn't even exist in your amended code at all. You solved the issue by setting System.Volume to the right value, but you still shouldn't be setting it to some erroneous value immediately beforehand.
Hi Monkey
Point taken. I should have realized.
Still, job done.
Thanks (nod)
steptoe