Old 28th January 2008, 12:40   #1
Mr_Nudge
Major Dude
 
Mr_Nudge's Avatar
 
Join Date: Apr 2004
Location: melbourne, australia
Posts: 655
code bug?

i've run into a problem that causes winamp to crash 100% of the time.
it's a simple enough texer and as far as i can see there's nothing wrong with the code so i'm hoping one of you senior codemonkeys can tell me what the hell's going on.
here it is;

init/
n=1;

frame/
nx=w/ix;
ny=h/iy;
xsc=2/nx;
ysc=2/ny;
x1=rand(nx)*xsc-1;
y1=rand(ny)*ysc-1;

/point
x=x1;
y=y1;

basically, it divides the screen height/width by the texer height/width to find the number of particles it can fit on screen dynamically. for some reason though, the division process causes winamp to crash. the strange thing is, i had it working at one stage.

Life's a game, break the rules
Click here
Mr_Nudge is offline   Reply With Quote
Old 28th January 2008, 15:12   #2
Grandchild
Senior Member
 
Grandchild's Avatar
 
Join Date: Oct 2005
Location: Germany
Posts: 333
that is dangerous stuff! o_O

but if i remeber correctly the image width/height ist iw/ih respectively, not ix/iy. let me check that...

yup, solves it
seems division by 0 is evil anywhere

code:
/frame/
nx=w/iw;
ny=h/ih;
xsc=2/nx;
ysc=2/ny;
x1=rand(nx)*xsc-1;
y1=rand(ny)*ysc-1;



gc
Grandchild is offline   Reply With Quote
Old 28th January 2008, 15:32   #3
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,363
/me throws in some bananas
Yathosho is offline   Reply With Quote
Old 29th January 2008, 01:10   #4
Mr_Nudge
Major Dude
 
Mr_Nudge's Avatar
 
Join Date: Apr 2004
Location: melbourne, australia
Posts: 655
cheers gc.
it's so frustrating how much one letter can fuck things up -_-

Life's a game, break the rules
Click here
Mr_Nudge is offline   Reply With Quote
Old 29th January 2008, 11:27   #5
Mr_Nudge
Major Dude
 
Mr_Nudge's Avatar
 
Join Date: Apr 2004
Location: melbourne, australia
Posts: 655
re-written and refined.
i'm sure someone else can find it useful.
and also a quick disco-ball preset i made with it.
comments?
Attached Files
File Type: zip mrnudge - 45d.zip (1.6 KB, 217 views)

Life's a game, break the rules
Click here
Mr_Nudge is offline   Reply With Quote
Old 30th January 2008, 00:28   #6
Grandchild
Senior Member
 
Grandchild's Avatar
 
Join Date: Oct 2005
Location: Germany
Posts: 333
first one is somewhat nice, don't like the disco ball too much though..
but here's mine
movement largely drawn on fsk's newer stuff [thanks heaps for these jan! ]
disable the convo-EL if you like...

who dares an improvement, huh?? come on...
Attached Files
File Type: zip mrnudge - 45 [grandchild's halfanhourretake].zip (1.1 KB, 235 views)
Grandchild is offline   Reply With Quote
Old 30th January 2008, 01:13   #7
Mr_Nudge
Major Dude
 
Mr_Nudge's Avatar
 
Join Date: Apr 2004
Location: melbourne, australia
Posts: 655
cheers gc. the first one was not really a preset, more just a "here's this scope i wrote" thing.
nice remix but the movement kinda takes away from the whole perfectly shaped grid look imo.
one of my submissions for wfc7 uses the grid for a background so keep an eye out for it.

Life's a game, break the rules
Click here
Mr_Nudge is offline   Reply With Quote
Old 11th February 2008, 12:53   #8
jheriko
Forum King
 
jheriko's Avatar
 
Join Date: Aug 2002
Location: a twist in the fabric of space
Posts: 2,150
Send a message via ICQ to jheriko
just to explain, division by zero does whats called "throwing a floating point exception". the cpu handles it in one of two ways depending on how it is set... it either carries on with a #NAN or #INF value and silently ignores it, or it catches the exception and "gracefully" stops execution.

I've yet to see a gracefully caught exception... probably because its so graceful I don't see it.

When you get a crash like this, look up the exception code (you can get it from the error box), e.g. 0xC0000005 is an invalid memory read/write (the most common one). Looking these up can actually help with debugging. e.g. I would assume you got a 0xC000008E, which if you google, pops up with some web pages about floating point divide by zero.

-- Jheriko

'Everything around us can be represented and understood through numbers'
jheriko is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Visualizations > AVS

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