Support

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

Ruby cablepatcher

Post any examples or modules that you want to share here

Re: Ruby cablepatcher

Postby glitchcpt » Fri Oct 31, 2014 8:26 am

How would I add sources/destinations?
maybe i'm missing something
glitchcpt
 
Posts: 54
Joined: Wed Oct 01, 2014 3:42 pm

Re: Ruby cablepatcher

Postby Nubeat7 » Fri Oct 31, 2014 9:15 am

@glitchcp

oh i just saw that it doesn't update when adding new sources or tartegs, i reuploaded the fixed version.

just add them to the sources or targets in the properties panel, also don't forget to add them in the bus part inside the routing matrix, there you need to add single bus extracts in the targets extract module, this is needed because if i extract all targets with one bus extract busnames with the same name don't get added together.

also take care that you add enough targets, you will see how much you need to add at the sources bus extract,

it automatically adds all possible connections (sources x targets)
User avatar
Nubeat7
 
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna

Re: Ruby cablepatcher

Postby djbrynte » Fri Oct 31, 2014 10:44 am

there is a bugg great work!. HMm when changing the positions the cables doeset follow the changed positions.
djbrynte
 
Posts: 613
Joined: Mon Jun 22, 2009 10:51 am

Re: Ruby cablepatcher

Postby Nubeat7 » Fri Oct 31, 2014 11:40 am

its no bug, you need to delete the connection and make a new one, but i will have a look if i can implement this,

maybe it would make sense to use rightclick and drag to change the destination and double rightclick to delete it, or use leftclick on the target slot to disconnect and drag it to another target and leave the single rightclick to delete the connection?

what you think?
User avatar
Nubeat7
 
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna

Re: Ruby cablepatcher

Postby tulamide » Fri Oct 31, 2014 12:07 pm

Very nice, Nubeat7! A cool Ruby start to something as complex as analog patching!

Hopefully you won't lose control over the complexity with future revisions. Your question is quite interesting. I instantly thought of Reason, where no multiple ins or outs are allowed, though. There, leftclicking on an already existing connection frees the cable to be patched with another input/output. And releasing the mouse while the cable is floating (connected just to one end) deletes it. It's an intuitive and fast workflow.

(Multiple ins or outs are managed through a seperate module called splitter/merger)
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Ruby cablepatcher

Postby Nubeat7 » Fri Oct 31, 2014 11:47 pm

thanks Tulamide for your feedback, the reason way sounds good but i want to change connections with the right mousebutton when the mouse is over the cable,
after a target could have more connections it would be needed to select the right connection you want to change,
the right mouse button is because cables sometimes are hanging over some knob and then it could happen easily to disconnect a cable when you just want to set a knob value,

sadly i ran into some troubles with the rightmouseclicks and the mousecapturing, which fucked the whole idea up for now
look here: viewtopic.php?f=2&t=2925

about the complexity, yeah its not so bad atm but sure it would look much better to pack all the stuff into classes, sadly i'm not used to do classes and its really difficult for me to write some, maybe this would be a good idea for the FS guru to provide a simple tutorial how to write and use classes in FS, i really don't get it by myself :(
but for sure it would make things much easier to use class objects then multidimensional arrays with strings and numbers inside which makes it often complicated to follow, i also don't like some ways i've programmed it;

only the faczt that i use 3 multidimensional arrays to get everything under one hat (connections, cablepoints and the preset array) is really ugly and uncomfortable to use, specially for other people to follow.. :?
User avatar
Nubeat7
 
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna

Re: Ruby cablepatcher

Postby tulamide » Sat Nov 01, 2014 12:15 am

For the issue have a look at my answer there.

Classes in Ruby are pretty much straight-forward.

Code: Select all
class Myclass
# class names have to start with a capital letter
end


There you are. You're very own class. You get an instance of it by calling

Code: Select all
myclass = Myclass.new


When .new is called, Ruby looks for a method inside the class called 'initialize', so you can init values and the like.
Code: Select all
class Myclass
    def initialize
        @myvar = 1.0
    end

    def getvalue
        @myvar
    end
end


Now the class is initialized with @myvar set to 1.0, but you can't access the instance variable (its scope is the class), so you define a method to get access to the value.

Code: Select all
myclass = Myclass.new
value = myclass.getvalue
#value is now 1.0


To set a value, you again define a method
Code: Select all
def setvalue=(n)
    #The '=' directly after the method name defines a 'setter'-function. You can now call it the math way: setvalue = n
    @myvar = n
end


To use it, do this:
Code: Select all
myclass = Myclass.new
myclass.setvalue = 3.5
value = myclass.getvalue
#value is now 3.5


But I will see if I can do a little more intense tutorial soon.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Ruby cablepatcher

Postby Nubeat7 » Sat Nov 01, 2014 10:22 am

thank you tulamide for this little instruction, seems to be pretty easy, i always thought that ruby classes needed attractors and (forgot how the others are called)...

some tutorial would be very appreciated :)

i remember the day i started to write my own methodes and understood how great this is to use, i think with classes its the same, once you understood it and you did some by yourself it starts to be an easy thing and it is as normal to use as using methodes.
User avatar
Nubeat7
 
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna

Re: Ruby cablepatcher

Postby TheOm » Sat Nov 01, 2014 1:20 pm

You are probably talking about attr_accessor, attr_reader and attr_writer
These are just shorthands for generating basic getters and setters because its very annoying to some programmers(me) to write these getters and setters when you really just want a public field.
As the names suggest attr_reader generates only getters attr_writer generates setters and attr_accessor generates both at once. The names of the member variables must be given as :symbols.
Here's a simple example:
Code: Select all
class Point
    attr_accessor :x, :y
end

is just much quicker than
Code: Select all
class Point
    def x
        @x
    end

    def x= v
        @x = v
    end

    def y
        @y
    end

    def y= v
        @y = v
    end
end
TheOm
 
Posts: 103
Joined: Tue Jan 28, 2014 7:35 pm
Location: Germany

Re: Ruby cablepatcher

Postby djbrynte » Sat Nov 01, 2014 1:25 pm

how do i change the area of the cable patcher.
djbrynte
 
Posts: 613
Joined: Mon Jun 22, 2009 10:51 am

PreviousNext

Return to User Examples

Who is online

Users browsing this forum: No registered users and 34 guests