Waves RGB Matrix Script

Archive of the non-categorized posts related to the QLC+ technical support.
Please do not create new threads here, instead, use the categories above !
Post Reply
User avatar
nedmech
Posts: 83
Joined: Sat Jun 20, 2015 12:39 am
Real Name: Nathan Durnan

Hi all, and thanks to the team who have made this such a great program.

I wanted to have a line of splash lights fire off in a configurable wave pattern during a live performance and was getting frustrated by the limitations of using sequences and chasers to manage this. Someone pointed me in the direction of the RGB Matrix, and it opened up a huge realm of possibilities. None of the preconfigured scripts quite matched what I wanted, so I dove in and made my own.

Waves is a configurable RGB Matrix Script that is similar to the Strips/StripsFromCenter scripts, with the addition of being able to define the width of the tail following the wave, and whether the tail fades or is solid.

So far, I has four direction presets:
  • to the Right
  • to the Left
  • from both sides IN to the center
  • and from the center OUT to the sides
It can also be set to Vertical or Horizontal orientation. And of course it picks up the Start/End colors.

I'm only using this in a linear array, but it works just as well with a full 2D matrix. I'm thinking about adding some diagonal modes if anyone is interested. Hopefully someone will find this useful.
Attachments
Waves.js
(5.5 KiB) Downloaded 81 times
User avatar
mcallegari
Posts: 4826
Joined: Sun Apr 12, 2015 9:09 am
Location: Italy
Real Name: Massimo Callegari
Contact:

Thank you very much Nathan !
I'll test it as soon as I can
User avatar
mcallegari
Posts: 4826
Joined: Sun Apr 12, 2015 9:09 am
Location: Italy
Real Name: Massimo Callegari
Contact:

Just tested it. It's excellent ! Thank you :)

I've added it to QLC+.

I just noticed the switch/case block doesn't have a break for each case. Is that wanted or a mistake ?
User avatar
nedmech
Posts: 83
Joined: Sat Jun 20, 2015 12:39 am
Real Name: Nathan Durnan

Thanks for looking at it and considering adding it to the library!

Yes, the lack of breaks is intentional. It took me a bit to remember why since I've slept since I last looked at the code. :oops:

The first case of each pair (1 = Left, 3 = Out) modifies the relative stepPos variable for the direction difference. Then it falls thru into the second case (0 = Right, 2 = In) to determine if that pixel gets filled for the relative stepPos. It was my tricky way of trying to keep the lines of code down and reduce repeated code. :geek:
janosvitok
Posts: 1331
Joined: Mon Apr 13, 2015 7:05 am
Location: Bratislava, Slovakia
Real Name: Jano Svitok
Contact:

In this case C/C++ people usually add "// no break" comment to mark that the missing break is intentional (in the place where break would be).
User avatar
nedmech
Posts: 83
Joined: Sat Jun 20, 2015 12:39 am
Real Name: Nathan Durnan

janosvitok wrote:In this case C/C++ people usually add "// no break" comment to mark that the missing break is intentional (in the place where break would be).
Ah, my apologies. I wasn't aware of that convention. I'll make sure to do that from now on. Thanks for teaching me something!
User avatar
mcallegari
Posts: 4826
Joined: Sun Apr 12, 2015 9:09 am
Location: Italy
Real Name: Massimo Callegari
Contact:

Well, I asked if that was wanted because it is an allowed coding (at least in C/C++) but you need to be sure of what you're doing.
In most cases it produces unwanted behaviours.

Placing a break in every case makes sure you confine the code in a single case, otherwise the compiler will continue to evaluate the other cases if it doesn't find a break statement.

Anyway I left the code as you've written it (I've just replaced tabs with spaces) and the script seems to be working fine.
If you want, you can send a Pull Request on GitHub with any update/fix. (or for new scripts ;) )

Thanks
User avatar
tornel
Posts: 22
Joined: Sun Apr 12, 2015 2:54 pm
Location: GB
Real Name: miGagXD
Contact:

Nathan,
The wave script is great!!!!
However it is acting a little strange when setted with Direction "IN" and the Fade Tail "On".
Edit: added more info
It happens both in Windows (8.1) and Ubuntu (14.10), QLC+ 4.9.1 GIT (just compiled from sources)
User avatar
nedmech
Posts: 83
Joined: Sat Jun 20, 2015 12:39 am
Real Name: Nathan Durnan

Luis,
Thanks for the feedback! I thought I tested all the direction/fade combinations, but I guess I missed that one. I rearranged the code for code for that part and it should be fixed now. I've put in a Pull Request on GitHub with the changes. I've also attached the file here if you want to try it out before it gets into the next release.
Attachments
waves.js
(6.63 KiB) Downloaded 43 times
User avatar
tornel
Posts: 22
Joined: Sun Apr 12, 2015 2:54 pm
Location: GB
Real Name: miGagXD
Contact:

Thnak
I'll test it tonight or tomorrow nd let you know. Thanks!
Post Reply