Old 22nd November 2006, 18:42   #1
ILLifant
Junior Member
 
Join Date: Oct 2006
Location: StPetersburg or Sebastopol
Posts: 3
Send a message via ICQ to ILLifant
Volume Lock

Has anyone written a script that locks volume (not only a slider as slider.lock() does) for example when mouse is not upon Winamp window? I tried this, but it locks volume so safely that I couldn't change it at all:

shbutton.onLeaveArea() {
shvol.lock();
oldvol = system.getVolume();
}

system.onVolumeChanged(int newvol) {
int x; int y;
if (shbutton.isMouseOver(x, y)!=0)
System.setVolume(newvol);
else System.setVolume(oldvol);
}

I'm not really a programmer so I'm looking for someones help
ILLifant is offline   Reply With Quote
Old 22nd November 2006, 19:13   #2
E-Trance
Senior Member
 
Join Date: Oct 2005
Location: Russia
Posts: 164
Send a message via ICQ to E-Trance
Try to use timer. Script should remember current volume level and if one is in lock mode it should set that level. I think that it is only one possible way to prevent the volume level from changes.
E-Trance is offline   Reply With Quote
Old 22nd November 2006, 19:17   #3
E-Trance
Senior Member
 
Join Date: Oct 2005
Location: Russia
Posts: 164
Send a message via ICQ to E-Trance
Блин, ты же наверное по-русски понимаешь. Короче переменную создай, в неё всегда заноси текущую громкость. Как только уровень надо заблокировать, запускай таймер, который всегда будет ставить громкость на блокированный уровень. А больше никак, никаких функций кроме GetVolume и SetVolume в MAKI-интерфейсе нет.
E-Trance is offline   Reply With Quote
Old 23rd November 2006, 02:51   #4
jebus
Junior Member
 
Join Date: Aug 2002
Location: South Carolina
Posts: 42
derka derka derka?
jebus is offline   Reply With Quote
Old 23rd November 2006, 16:16   #5
ILLifant
Junior Member
 
Join Date: Oct 2006
Location: StPetersburg or Sebastopol
Posts: 3
Send a message via ICQ to ILLifant
2E-Trance
Спасибо, попробую...
P.S. понимать то я и по ихнему понимаю. пишу конечно криво
ILLifant is offline   Reply With Quote
Old 24th November 2006, 20:11   #6
ILLifant
Junior Member
 
Join Date: Oct 2006
Location: StPetersburg or Sebastopol
Posts: 3
Send a message via ICQ to ILLifant
Thanks to E-Trance, his idea really works. this is what i wrote now:

#include "std.mi"

Global Group shgroup;
Global Button shbutton;
Global Slider shvol;
Global Int oldvol;
Global Timer voltimer;

System.onScriptLoaded() {
shgroup = getScriptGroup();
shbutton = shgroup.findObject("normal");
shvol = shgroup.findObject("shvol");
oldvol = system.getVolume();
voltimer = new Timer;
voltimer.setDelay(10);
}

voltimer.onTimer() {
system.setVolume(oldvol);
}

shbutton.onEnterArea() {
shvol.unlock();
voltimer.stop();
}

system.onVolumeChanged(int newvol) {
int x; int y;
if (shbutton.isMouseOver(x,y))
oldvol = newvol;
}

shbutton.onLeaveArea() { voltimer.start(); }

System.onScriptUnloading() {}

Anyway I'm trying to find another way to do this.....
ILLifant is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Skinning and Design > Modern Skins

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump