Page 1 of 1

Ruby Counter

Posted: Thu Jun 12, 2014 6:23 am
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?

Re: Ruby Counter

Posted: Thu Jun 12, 2014 8:03 am
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..

Re: Ruby Counter

Posted: Fri Jun 13, 2014 6:48 am
by billv
Trog's Ruby Counter for reference...
http://www.dsprobotics.com/support/view ... 1378#p5310

Re: Ruby Counter

Posted: Fri Jun 13, 2014 10:12 am
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.