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

Any use for this?

Post any examples or modules that you want to share here

Re: Any use for this?

Postby trogluddite » Fri Nov 16, 2012 4:04 am

MyCo wrote:but with global variables you could do this the other way around, too (polling a global variable and then change the output)

...and with a global Module, you get this...
Wreless Class 001.fsm
(5.95 KiB) Downloaded 1316 times

Kind of a virtual wireless patchbay for Ruby modules, including the ability for updating a parameter to pass the value and trigger multiple inputs or outputs anywhere in the schematic. The storage of the links values inside the module means that it should be possible to save the link data to HDD and restore it again.
Experimental still, and not one you'd use every day, I think - normal connections would be more efficient than a load of method calls - but maybe useful for a big 'global preferences network".

Oh, and another thing to ponder...
Remember the warning in the manual about the shared namespace if you have multiple schematics open?
Well, it is the same for exported plugins too - only one instance of Ruby is opened for all running FS3 VSTs.
Good or Bad? Hmmm.
Lots of chances for weird bugs once we all start using Ruby in our plugins. Ruby seems pretty good at dealing with variable scopes etc. - but it will still take some effort from programmers to avoid namespace clashes, and to resist the temptation to take shortcuts by re-defining methods that everyone else relies on.
OTOH - you can send values between plugins. I haven't tested extensively to look at timing yet, so maybe only good for preferences etc., but the values definitely get back and forth - even Modules and Classes defined in one plugin are available in the others.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1727
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Any use for this?

Postby Tronic » Fri Nov 16, 2012 2:09 pm

Trog have also investigated?
Modules and Classes have been declared as private, still present in other instance?
Tronic
 
Posts: 539
Joined: Wed Dec 21, 2011 12:59 pm

Re: Any use for this?

Postby trogluddite » Fri Nov 16, 2012 2:53 pm

Tronic wrote:Trog have also investigated?
Modules and Classes have been declared as private, still present in other instance?

I'm looking into this now - before I go any further with making new classes etc., I want to get clear in my minds how all that stuff works. Because I'm new to object programming, concepts like private, protected, singleton this-and-that, are all a bit alien to me.
For sure, each Ruby prim is an individual instance - so temp variables and @instance variables will always stay completely within their own block It's only when you start introducing new classes and modules that there is any problem, so for most day-to-day stuff, where Ruby is just treated as a "green" substitute, I don't think people will run into problems.
But a way to reliably include new classes in the schematic (or 'require' them reliably at startup) opens up too many exciting possibilities to ignore - so I will carry on investigating. I've just starting making my own Ruby plugins for the SketchUp 3D software too - and that has been really helpful, as there is a whole community there that have had lots of experience with exactly the same kind of issues. There are some plugins for that software that are very powerful, yet are best avoided because they re-define methods in ways which affect other installed plugins - but the guys there have found some good programming practices that they use to avoid the pitfalls. When I've had a chance for their wisdom to sink in a little bit, I'll post up some of their recommendations.

Here's a link to the SketchUcation forum's Ruby resources page - not all of it useful to us, as some references are specific to the SketchUp API, but there is plenty of good advice to read if you sift through the Developers forum a little bit.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1727
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Any use for this?

Postby rlr » Thu Nov 29, 2012 4:15 pm

When inspecting the ObjectSpace as suggested by tronic to my surprise I found that IO, Dir and File are available!

This works:
Code: Select all
@f=File.new("c:/tmp/xx.txt", "w+")
@f.write ("hello world");
@f.close

even binary:
Code: Select all
@binary_file="C:/Program Files (x86)/DSPRobotics/FlowStone/msvcr90-ruby191.dll"

@fb = File.open(@binary_file, 'rb')
@buf = @fb.read()
@fb.close
output @buf.unpack("C*")


There are some more:
- Fiber seems to work
- Thread doesn't (error: excessive processing detected), or I'm doing it wrong.



Now: how to get a HWND Windows handle out of the View object?
rlr
 
Posts: 27
Joined: Tue Jul 13, 2010 9:17 pm

Re: Any use for this?

Postby trogluddite » Thu Nov 29, 2012 8:15 pm

I would expect threads to be a trickyy one - FS will need to rely on Ruby running on a particular thread in order to interface with the inputs/outputs to the rest of the system (in Ruby 1.9.x they are genuine CPU threads, as opposed to Ruby 1.8.x where they were 'simulated' threads). As soon as Ruby is running a task on a different thread, FS loses track of it, and the 'protection' assumes an error - as seen by DWB in his experiments.
Indeed, there have been bugs (fixed) in the past in SM due to MIDI and green not sharing the same thread, and some obscure green-stream timing issues are caused by the same thing.

The other classes you mentioned are indeed part of the Ruby core. You can see the full listing on the official API docs site (an essential bookmark! - it is VERY useful). You can see at the top the tabs for 'Core' (all present in FS3 AFAIK) and 'Std Libs' (the libraries, of which we only have win32api' as standard).

Re; HWND. All FS3 views will share the same HWND, as they are just 2D graphics all drawn within the same window - no idea how you'd do it in Ruby, but you'd only be able to get a single HWND for the plugin or .exe window as a whole.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1727
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Previous

Return to User Examples

Who is online

Users browsing this forum: No registered users and 22 guests