Ruby Counter

For general discussion related FlowStone
Post Reply
User avatar
JB_AU
Posts: 171
Joined: Tue May 21, 2013 11:01 pm

Ruby Counter

Post by JB_AU »

Is there some definitive book on Ruby that works wholly with Flowstone?

Code: Select all

def event i,v
   if !defined? @count
      @count = 127
   end
   if @in0 == True
   @count = @count + 1
   end
   if @in1 == True
   @count = @count - 1
   end   
   output @count
end


Where am i going wrong?
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

Albert Einstein
User avatar
Nubeat7
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna
Contact:

Re: Ruby Counter

Post by Nubeat7 »

Code: Select all

def event i,v
   if @count == nil
      @count = 127
   end
   if i==@in0
   @count = @count + 1
   end
   if i==@in1
   @count = @count - 1
   end   
   output @count
end

this should work.. you can use triggers for @in0 and @in1

btw after its nothing to do with dsp it should be posted in the general section..
billv
Posts: 1165
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia
Contact:

Re: Ruby Counter

Post by billv »

User avatar
JB_AU
Posts: 171
Joined: Tue May 21, 2013 11:01 pm

Re: Ruby Counter

Post by JB_AU »

Didn't find a Ruby section, this seemed a logical spot, will do.

Billv, thanks mate! That's infattically & exactly what i wanted to do, cheers mate.
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

Albert Einstein
Post Reply