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
FlowStone 3.0.2 Released
22 posts
• Page 3 of 3 • 1, 2, 3
Re: FlowStone 3.0.2 Released
Hi nix,
There are a couple of things that don't look right in that code.
- You are calling 'init' from inside the 'event' method. So if @samples and @samplerate are, as I guess, labels for external inputs, they are getting reset to the 'init' defaults every time there is an event. If they are input labels, then the schematic will store their values when you save the schematic, so you probably don't need to initialise them.
- Where is @in_id coming from?
It looks as if you are trying to use it as an input filter (I use that variable name a lot in my own 'event' methods, so I guess you saw it there). To be able to test which input triggered, it needs to be the first parameter of the 'event' declaration, and must be a local variable (no '@')....
def event (in_id)
(NB - the dev's examples usually use 'i', but the name is not important so long as it is the first parameter - actually I'm not keen on their Ruby coding style at all, but that's another story!)
Since your 'event' method has no parameters defined, and 'init' sets @in_id to zero, the 'if' test is always true, so will fire for a change on any input.
-
There's no feedback within the code, so is this being done externally using links?
-
Not sure what you mean, there isn't a default 'checkInited' method, is this somewhere in the code you removed?
To test if an instance ('@') variable has been declared, use the '.nil?' test, e.g...
<do something> if @variable.nil?
Note that this only works for instance variables; local variables (without '@') will cause an error if they are used before they are declared.
Instance variables exist anywhere within the primitive, but local variables are only valid inside the "def ... end" of the method where they are created.
You could also use the special "or equals" method...
@variable ||= value
If @variable is not declared yet it gets the value - but if it already has a value, the old value gets kept.
I don't see anything that could lead to a namespace clash, so my guess it that when "is playing" is on (which it only can be inside a host), something is causing a nasty feedback loop - probably because the input testing is not filtering out events that it should be. But without seeing the full schematic, it's hard to be sure. Maybe make a new thread with some attachments so that we can get to the bottom of it.-
There are a couple of things that don't look right in that code.
- You are calling 'init' from inside the 'event' method. So if @samples and @samplerate are, as I guess, labels for external inputs, they are getting reset to the 'init' defaults every time there is an event. If they are input labels, then the schematic will store their values when you save the schematic, so you probably don't need to initialise them.
- Where is @in_id coming from?
It looks as if you are trying to use it as an input filter (I use that variable name a lot in my own 'event' methods, so I guess you saw it there). To be able to test which input triggered, it needs to be the first parameter of the 'event' declaration, and must be a local variable (no '@')....
def event (in_id)
(NB - the dev's examples usually use 'i', but the name is not important so long as it is the first parameter - actually I'm not keen on their Ruby coding style at all, but that's another story!)
Since your 'event' method has no parameters defined, and 'init' sets @in_id to zero, the 'if' test is always true, so will fire for a change on any input.
-
nix wrote:This my timer, the output gets fed back into the input.
There's no feedback within the code, so is this being done externally using links?
-
nix wrote:So I am looking at the way checkInited is set up by RDSP
Not sure what you mean, there isn't a default 'checkInited' method, is this somewhere in the code you removed?
To test if an instance ('@') variable has been declared, use the '.nil?' test, e.g...
<do something> if @variable.nil?
Note that this only works for instance variables; local variables (without '@') will cause an error if they are used before they are declared.
Instance variables exist anywhere within the primitive, but local variables are only valid inside the "def ... end" of the method where they are created.
You could also use the special "or equals" method...
@variable ||= value
If @variable is not declared yet it gets the value - but if it already has a value, the old value gets kept.
I don't see anything that could lead to a namespace clash, so my guess it that when "is playing" is on (which it only can be inside a host), something is causing a nasty feedback loop - probably because the input testing is not filtering out events that it should be. But without seeing the full schematic, it's hard to be sure. Maybe make a new thread with some attachments so that we can get to the bottom of it.-
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: FlowStone 3.0.2 Released
thanks so much for ur post trog.
I'll let this thread stay on topic,
and post all my Ruby coding in a new thread.
Will go over all your points and make sure I am doing the right thing.
Removing that module I forgot about has meant that Orion doen't crash,
it's functional again-
but yeah, I will post up my examples in the other thread.
It could have been a feedback error.
Yes, the feedback is a tick link,
not coded.
To start with I will remove the init from all my events
I'll let this thread stay on topic,
and post all my Ruby coding in a new thread.
Will go over all your points and make sure I am doing the right thing.
Removing that module I forgot about has meant that Orion doen't crash,
it's functional again-
but yeah, I will post up my examples in the other thread.
It could have been a feedback error.
Yes, the feedback is a tick link,
not coded.
To start with I will remove the init from all my events
-
nix - Posts: 817
- Joined: Tue Jul 13, 2010 10:51 am
22 posts
• Page 3 of 3 • 1, 2, 3
Who is online
Users browsing this forum: No registered users and 54 guests