Old 5th September 2002, 03:34   #1
AndrewMackowski
Member
 
Join Date: Mar 2002
Posts: 92
Question Dynamically creating layers in MAKI

Well, I think I know how to make a new, dynamic layer object in MAKI:
code:
Global layer mylayer;
mylayer = new layer;



After I've done this, how do I give my layer an image, set its position, and show it in one of my skin's windows?
AndrewMackowski is offline   Reply With Quote
Old 5th September 2002, 04:00   #2
frisbeemonkey
Major Dude
 
frisbeemonkey's Avatar
 
Join Date: Jun 2002
Posts: 851
Here is how I think you can do it:
code:

mylayer.setXMLParam("image","player.someimage");
mylayer.setXMLParam("x","50");
mylayer.setXMLParam("y","25");


assuming you've defined player.someimage in your elements. To show it, maybe mylayer.show(); ? Also, you can use setXMLParam to set sysregion to "1" if needed.
I must say I am quite intrigued as to why you want to do this, whatever could you be up to?
Hope this helps,
~FrisbeeMonkey
frisbeemonkey is offline   Reply With Quote
Old 5th September 2002, 04:52   #3
AndrewMackowski
Member
 
Join Date: Mar 2002
Posts: 92
well, i was thinking about making a sort of semi-vis with the VU meters--I would dynamically create bars when the sound was high, remove them when low, etc. Kinda like OHE3's vis.
AndrewMackowski is offline   Reply With Quote
Old 5th September 2002, 05:16   #4
SOOPRcow
Senior Member
 
Join Date: Dec 2001
Location: San Diego, CA USA
Posts: 125
Send a message via AIM to SOOPRcow
Why not just use an animated layer and use a formula like:

Quote:
aniVisLayer.gotoFrame((system.getLeftVuMeter() * (aniVisLayer.getLength() - 1)) / 255);
You could just leave all the "quiet" like frames blank (100% alpha).

This method would also require much less processor power as you don't need to keep creating and deleting the layer.

I have a good example of this. If you would like it just e-mail me or just post here (e-mail would be better 'cause I may not check back here

David Serrano :: Winamp5 Skining Guru
SOOPRcow is offline   Reply With Quote
Old 5th September 2002, 23:04   #5
AndrewMackowski
Member
 
Join Date: Mar 2002
Posts: 92
Hmm, that's a great idea! However, it won't be as suitable for larger VIS's, because having many many frames of a large picture would take up space.

However, I finished doing something else before I read your post: I created a region that covered the "vis" layer, and offsetted the region dynamically to give the appearance that more or fewer bars are showing.
AndrewMackowski is offline   Reply With Quote
Old 5th September 2002, 23:19   #6
frisbeemonkey
Major Dude
 
frisbeemonkey's Avatar
 
Join Date: Jun 2002
Posts: 851
I was gonna have a component that did something similar, changing frames depending on the values of the VU Meters. I made a simple test case not to long ago. Have either of you actually done this? It uses 90-100% of my CPU when running! I've messed around with the polling(how often my timer tells it to check the VUs) and you have to sacrifice any semblance of real-time just to get acceptable CPUsage. I'm hoping you find a better way to do this, but I may just scrap the idea for my component.
~FrisbeeMonkey
frisbeemonkey is offline   Reply With Quote
Old 6th September 2002, 02:47   #7
PeaceMaker
Major Dude
 
PeaceMaker's Avatar
 
Join Date: Oct 2001
Location: Australia
Posts: 1,276
Send a message via Yahoo to PeaceMaker
how fast's ur system tho frisbeemonkey?
PeaceMaker is offline   Reply With Quote
Old 6th September 2002, 05:02   #8
frisbeemonkey
Major Dude
 
frisbeemonkey's Avatar
 
Join Date: Jun 2002
Posts: 851
Admittedly my system is not the fastest thing out there, far from it in fact, but I think there is something wrong with a component that makes your CPU usage go from 5% to 95%, regardless of specs.
How is your region method working, Andrew? How often do you read values from the VU?
SOOPRcow, what kind of delay are you using for your timer?
myTimer.setDelay(?);
I've tried values from 500(too slow) to 50(nice but eats CPU). Maybe I'll include a menu so the user can set the delay, thus allowing users of all speeds to enjoy it.
~FrisbeeMonkey
frisbeemonkey is offline   Reply With Quote
Old 6th September 2002, 07:55   #9
SOOPRcow
Senior Member
 
Join Date: Dec 2001
Location: San Diego, CA USA
Posts: 125
Send a message via AIM to SOOPRcow
Right now I'm using 45 but I’m going to give people some options and such. Although the frames in the animation I'm using are only 5x20 with 25 frames. This works out just fine on my computer and doesn't eat up anymore ram (noticeably) and I'm updating 16 bars per onTimer().

If you want I can send you the source to to the addon test script I made.

David Serrano :: Winamp5 Skining Guru
SOOPRcow is offline   Reply With Quote
Old 6th September 2002, 11:35   #10
will
Nullsoft Newbie (Moderator)
 
will's Avatar
 
Join Date: Mar 2001
Location: Sheffield, England
Posts: 5,569
Why not use regioning?

1) create a map image of a black and white gradient. load this as an element.

2) use layer.setregionfrommap() or something. set the tolerance as per the VU meter.

This will show/hide more or less of your image with a higher or lower VU.

DO NOT PM ME WITH TECH SUPPORT QUESTIONS
will is offline   Reply With Quote
Old 6th September 2002, 14:20   #11
Naamloos
Forum King
 
Naamloos's Avatar
 
Join Date: Mar 2001
Location: irc.tehflap.org/*******
Posts: 3,085
http://bugzilla.spinner.com:3430/show_bug.cgi?id=1541

b0rked
Naamloos is offline   Reply With Quote
Old 6th September 2002, 17:58   #12
frisbeemonkey
Major Dude
 
frisbeemonkey's Avatar
 
Join Date: Jun 2002
Posts: 851
For what I need, regions won't work, I have to use animations. For those familiar with my project, it is going to be Rumble pounding his piledrivers with the music. Basically it will be a few animated frames for each arm, not something I can just cover and uncover.
Also, it is not ram that I was running out of, my processor was just maxing out. I have noticed that it is only an issue in XP though, probably because my vid card needs help with the desktop alpha? In 98 I can't use desktop alpha, and my processor isn't nearly so burdened.
For now I think I am just gonna focus on the graphics of Rumble, then I'll worry about the finer details of making him work. Maybe by the time I get around to the coding, I'll have upgraded my system, haha.
~FrisbeeMonkey
frisbeemonkey is offline   Reply With Quote
Old 6th September 2002, 23:58   #13
AndrewMackowski
Member
 
Join Date: Mar 2002
Posts: 92
Yeah, my way is working, I can show you the script if you email me. I tested and found that having the vis enabled only used about 5% more CPU.
AndrewMackowski is offline   Reply With Quote
Old 7th September 2002, 06:23   #14
Hollow
Major Dude
 
Hollow's Avatar
 
Join Date: Oct 2001
Location: Baker Lab, Ithaca NY
Posts: 1,128
Send a message via AIM to Hollow
look at evis. it's in my sig, and it does almost exactly what you want. If it doesn't work, sorry, it was designed for one of the earlier betas, and i can't test it from here. but i think it does what you want to do.

The moon is made of cheese.
Oh for some tasty moon cheese.
www.redtetrahedron.org
Hollow 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