Old 7th March 2005, 19:55   #1
JW
Senior Member
 
Join Date: Nov 2004
Location: Valencia, CA
Posts: 304
EQ Presets button

I'm trying to create a button that will cycle through a set of hard-coded EQ presets. The code below will load one preset (and display the text for that preset, but won't cycle through them.

PHP Code:
#include ..\..\..\lib\std.mi

Function setText(String txt);
Function 
emptyText();

Global 
button EQPresets;
Global 
slider eq1eq2eq3eq4eq5eq6eq7eq8eq9eq10;
Global 
Text StatusTicker;
Global 
Timer StatusTimer;
Global 
int EQPresetNum;

System.onScriptLoaded() {

  
Group maingroup getContainer("main").getLayout("normal");

  
StatusTicker maingroup.findObject("Songticker");
  
StatusTimer = new Timer;
  
StatusTimer.setDelay(2000);

  
eq1 maingroup.findObject("eq1");
  
eq2 maingroup.findObject("eq2");
  
eq3 maingroup.findObject("eq3");
  
eq4 maingroup.findObject("eq4");
  
eq5 maingroup.findObject("eq5");
  
eq6 maingroup.findObject("eq6");
  
eq7 maingroup.findObject("eq7");
  
eq8 maingroup.findObject("eq8");
  
eq9 maingroup.findObject("eq9");
  
eq10 maingroup.findObject("eq10");

  
EQPresets maingroup.findobject("EQ_Presets");
}

EQPresets.onLeftClick() {
  if (
EQPresetNum 3) {
    
eq1.setPosition(1);
    
eq2.setPosition(1);
    
eq3.setPosition(1);
    
eq4.setPosition(1);
    
eq5.setPosition(1);
    
eq6.setPosition(1);
    
eq7.setPosition(1);
    
eq8.setPosition(1);
    
eq9.setPosition(1);
    
eq10.setPosition(1);
    
setText("EQ:  Flat");
    
EQPresetNum 1;
  }
  if (
EQPresetNum 1) {
    
eq1.setPosition(49);
    
eq2.setPosition(42);
    
eq3.setPosition(37);
    
eq4.setPosition(25);
    
eq5.setPosition(20);
    
eq6.setPosition(29);
    
eq7.setPosition(39);
    
eq8.setPosition(44);
    
eq9.setPosition(48);
    
eq10.setPosition(50);
    
setText("EQ:  Rock");
    
EQPresetNum 2;
  }
  if (
EQPresetNum 2) {
    
eq1.setPosition(50);
    
eq2.setPosition(1);
    
eq3.setPosition(37);
    
eq4.setPosition(1);
    
eq5.setPosition(20);
    
eq6.setPosition(1);
    
eq7.setPosition(39);
    
eq8.setPosition(1);
    
eq9.setPosition(48);
    
eq10.setPosition(1);
    
setText("EQ:  Test1");
    
EQPresetNum 3;
  }
}

StatusTimer.onTimer() {
  
StatusTicker.setText("");
  
stop();
}

setText(String txt) {
  
StatusTimer.stop();
  
StatusTicker.setText(txt);
  
StatusTimer.start();
}

emptyText() {
  
StatusTicker.setText("");
  
StatusTimer.stop();

Is using an integer not the correct way to handle that?
JW is offline   Reply With Quote
Old 7th March 2005, 20:01   #2
UUL
Winamp Addict
(Major Dude)
 
UUL's Avatar
 
Join Date: May 2003
Location: Winamp Modern Skinning Forum!
Posts: 868
Send a message via ICQ to UUL Send a message via AIM to UUL Send a message via Yahoo to UUL
try adding

EQPresetNum = 3;

to your onscriptloaded
UUL is offline   Reply With Quote
Old 7th March 2005, 20:04   #3
JW
Senior Member
 
Join Date: Nov 2004
Location: Valencia, CA
Posts: 304
Nope

But, that brings up another question - how do I track what the last setting was before the skin was unloaded? Is that what the GetPrivateInt and SetPrivateInt are for?
JW is offline   Reply With Quote
Old 7th March 2005, 20:08   #4
UUL
Winamp Addict
(Major Dude)
 
UUL's Avatar
 
Join Date: May 2003
Location: Winamp Modern Skinning Forum!
Posts: 868
Send a message via ICQ to UUL Send a message via AIM to UUL Send a message via Yahoo to UUL
use both, use SetPrivateInt to save the value and GetPrivateInt when the skin gets loaded
UUL is offline   Reply With Quote
Old 7th March 2005, 20:47   #5
JW
Senior Member
 
Join Date: Nov 2004
Location: Valencia, CA
Posts: 304
Cool, got it all working. Thanks!

PHP Code:
EQPresets.onLeftClick() {
  if (
System.getPrivateInt("Mobile PC""EQPreset"2) == 3) {
    
eq1.setPosition(1);
    
eq2.setPosition(1);
    
eq3.setPosition(1);
    
eq4.setPosition(1);
    
eq5.setPosition(1);
    
eq6.setPosition(1);
    
eq7.setPosition(1);
    
eq8.setPosition(1);
    
eq9.setPosition(1);
    
eq10.setPosition(1);
    
setText("EQ:  Flat");
    
System.setPrivateInt("Mobile PC""EQPreset"1);
  }
  else if (
System.getPrivateInt("Mobile PC""EQPreset"2) == 1) {
    
eq1.setPosition(49);
    
eq2.setPosition(42);
    
eq3.setPosition(37);
    
eq4.setPosition(25);
    
eq5.setPosition(20);
    
eq6.setPosition(29);
    
eq7.setPosition(39);
    
eq8.setPosition(44);
    
eq9.setPosition(48);
    
eq10.setPosition(50);
    
setText("EQ:  Rock");
    
System.setPrivateInt("Mobile PC""EQPreset"2);
  }
  else if (
System.getPrivateInt("Mobile PC""EQPreset"2) == 2) {
    
eq1.setPosition(50);
    
eq2.setPosition(1);
    
eq3.setPosition(37);
    
eq4.setPosition(1);
    
eq5.setPosition(20);
    
eq6.setPosition(1);
    
eq7.setPosition(39);
    
eq8.setPosition(1);
    
eq9.setPosition(48);
    
eq10.setPosition(1);
    
setText("EQ:  Test1");
    
System.setPrivateInt("Mobile PC""EQPreset"3);
  }

JW is offline   Reply With Quote
Old 7th March 2005, 21:11   #6
Michgelsen
Major Dude
 
Michgelsen's Avatar
 
Join Date: Oct 2003
Location: Netherlands
Posts: 1,416
Shouldn't setPrivateInt be in de onScriptUnloading section?
Michgelsen is offline   Reply With Quote
Old 8th March 2005, 06:56   #7
UUL
Winamp Addict
(Major Dude)
 
UUL's Avatar
 
Join Date: May 2003
Location: Winamp Modern Skinning Forum!
Posts: 868
Send a message via ICQ to UUL Send a message via AIM to UUL Send a message via Yahoo to UUL
this will work to, doesn't really matter
UUL is offline   Reply With Quote
Old 8th March 2005, 20:14   #8
JW
Senior Member
 
Join Date: Nov 2004
Location: Valencia, CA
Posts: 304
This way is actually a little better, in that it writes to studio.xnf as soon as the EQ profile is changed. That way if Winamp shuts down unexpectedly, the values are already saved.
JW is offline   Reply With Quote
Old 8th March 2005, 20:43   #9
Michgelsen
Major Dude
 
Michgelsen's Avatar
 
Join Date: Oct 2003
Location: Netherlands
Posts: 1,416
Oh yes that's true, didn't think of that.
Michgelsen 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