If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
5 code lines polynomial waweshapr (green)
4 posts
• Page 1 of 1
5 code lines polynomial waweshapr (green)
The simplest form of a polynomial waveshaper for green floats. Version 0.1 Alpha
TODO:
.- Convert to Mono
.- Allow more math primitives
TODO:
.- Convert to Mono
.- Allow more math primitives
Free your memory, .. with a free(). Like a pointer
Cast a pointer into an integer and it becomes the integer...
Cast a pointer into a struct and it becomes the struct...
A pointer can overflow... or can crash...
Be a pointer my friend
Cast a pointer into an integer and it becomes the integer...
Cast a pointer into a struct and it becomes the struct...
A pointer can overflow... or can crash...
Be a pointer my friend
- unkargherth
- Posts: 29
- Joined: Fri Apr 08, 2005 9:46 pm
Re: 5 code lines polynomial waweshapr (green)
I'm getting this error.
I don't know what I'm doing,
I haven't learned waveshaping
-
nix - Posts: 817
- Joined: Tue Jul 13, 2010 10:51 am
Re: 5 code lines polynomial waweshapr (green)
Looks like t's telling you that you haven't give the variable @x a value yet. Undeclared variables always return nil.
What is probably happening is that when you retype code, the whole primitive is parsed again, and this sometimes clears the values in the input variables. Ruby primitives don't "request" values from upstream modules like green does, you have to push a value in from outside, so after an edit you sometimes need to refresh the input values by triggering them. This also means that input values don't default to zero like they do in green - if you haven't triggered an input yet, it will always show nil - this is catching me out all the time too.
Best thing to do is to put a test in the code, e.g.
The raise command send an error message to the console - using this inside your method definitions will make bug tracing 100% easier.
What is probably happening is that when you retype code, the whole primitive is parsed again, and this sometimes clears the values in the input variables. Ruby primitives don't "request" values from upstream modules like green does, you have to push a value in from outside, so after an edit you sometimes need to refresh the input values by triggering them. This also means that input values don't default to zero like they do in green - if you haven't triggered an input yet, it will always show nil - this is catching me out all the time too.
Best thing to do is to put a test in the code, e.g.
- Code: Select all
if @x
#do some stuff with @x#
else
raise "@x is not set yet in MyMethod"
end
The raise command send an error message to the console - using this inside your method definitions will make bug tracing 100% easier.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Don't stagnate, mutate to create!
-
trogluddite - Posts: 1730
- Joined: Fri Oct 22, 2010 12:46 am
- Location: Yorkshire, UK
Re: 5 code lines polynomial waweshapr (green)
OK. my mistake. Seems to be solved if the line reading
is changed to
- Code: Select all
output eval(@toEval)
is changed to
- Code: Select all
output eval(@toEval) if (@toEval && @x)
Free your memory, .. with a free(). Like a pointer
Cast a pointer into an integer and it becomes the integer...
Cast a pointer into a struct and it becomes the struct...
A pointer can overflow... or can crash...
Be a pointer my friend
Cast a pointer into an integer and it becomes the integer...
Cast a pointer into a struct and it becomes the struct...
A pointer can overflow... or can crash...
Be a pointer my friend
- unkargherth
- Posts: 29
- Joined: Fri Apr 08, 2005 9:46 pm
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 62 guests