bitfocus / companion-module-thelightingcontroller

MIT License
4 stars 1 forks source link

Disable BPM updates #6

Open shannonsavage opened 2 years ago

shannonsavage commented 2 years ago

Hi,

Great module, currently using it with a stream deck at our nightclub to allow the DJ to set off the strobe lights and Co2 cannons. Very nice!

However, the plugin is always setting the BPM in ShowXpress, but we have the BPM being set from another application which receives the exact BPM of the track via Pioneer PRO DJ Link and sets this in ShowXpress, so both are competing with each other to set the BPM.

Is there anyway to disable BPM updates on this module to allow the other software to set the correct BPM?

Thanks, Shannon

thargy commented 2 years ago

Sorry, I haven't really worked on this in nearly 3 years and I don't have ShowXpress, or companion set up on my dev machine, so bear with me!

I think, re-reading the code, and trying to remember, that ShowXpress/QuickDMX/TheLightingController (hereafter, TLC!) has a button which changes it between manual and auto mode (where TLC itself auto-detects BPM from the current speaker audio). When in 'manual' mode, you can tap a beat on TLC to set it.

TLC does not expose the current manual/auto BPM via the API, but it does allow you to set the BPM explicitly via the API.

As such when you are in manual mode on TLC, I got o auto mode in Companion and explicitly control the BPM. That way Companion and TLC stay in sync and Companion knows the BPM.

What I don't think I allowed is for some other software using the API to control ShowXPress.

It might take me some time to get a dev environment set up again, but I'll have a look for you.

shannonsavage commented 2 years ago

Hey, thanks for the quick reply, appreciate it!

The other program, also interacts with TLC via its API, therefore I have 2 programs competing with each other to set the BPM in TLC. The source of truth for BPM is coming from the other program which sets the BPM via the API for TLC, so I don't have a need for any sort of BPM control via Companion.

I'm just wondering if perhaps there was a line of code somewhere that I could just comment out effectively disable Companion/module from setting the BPM in TLC. I had a quick look around but couldn't work out how to review the actual code for the module within Companion and its files. I've had a quick poke around the code here on GitHub and will try a few things out but I want to execute it locally if possible.

Thanks again, Shannon

thargy commented 2 years ago

I'm just wondering if perhaps there was a line of code somewhere that I could just comment out effectively disable Companion/module from setting the BPM in TLC.

Yes, you can comment out this line: https://github.com/bitfocus/companion-module-thelightingcontroller/blob/cbc6569ef6ca46ed86e44a4ae7d18e340ec810bd/bpmCounter.js#L173

... and (probably not necessary, but) this line: https://github.com/bitfocus/companion-module-thelightingcontroller/blob/cbc6569ef6ca46ed86e44a4ae7d18e340ec810bd/internalAPI.js#L177

And it will no longer update TLC.

Obviously, commenting out lines will cause issues when you update, as the modifications may be overwritten!

I am trying to set up a dev environment to create add a feature to disable BPM functionality completely. One of the reasons I stopped working on the module was it's a nightmare getting everything set up (took longer to setup than code!). Sadly, that's not changed, and I'm currently stuck (see this issue). Once that's resolved, I might get time to have another look, but I'm moving house in the next couple of weeks so things are super busy.

thargy commented 2 years ago

OK, you will notice from the resolution of this issue that I cannot add new features to the v.2 version of the module, but have to update the module for the pending v.3 release of Companion, which will take me additional time.

This isn't technically a bug but an enhancement/feature request, and Bitfocus aren't accepting new module features until they are updated.

As such, hopefully, the workaround will help in the meantime.

thargy commented 2 years ago

This issue is dependent on #7 being completed first.

shannonsavage commented 2 years ago

Commenting out line 173 in bpmCounter.js was sufficient enough to stop BPM updates being sent to TLC.

Really appreciate the clear and concise help and instructions given, really appreciate it. We now have a perfect setup within Companion which compliments the other programs we use as well as our audio visual setup. Cannot thank you enough for this magical module, it is amazing.

Cheers and thanks again :)

thargy commented 2 years ago

Thanks, the greatest reward when writing OS software is to know it is being used and is useful. This case will stay open until I add the ability to disable Auto-BPM takeover.

Steffielight commented 8 months ago

Hi!

I found this comment see below. Where I have to change it? Where to found ( I am new )

Do I have to change it by the bitfocus software somewhere?

Like to read! Thanx before

I'm just wondering if perhaps there was a line of code somewhere that I could just comment out effectively disable Companion/module from setting the BPM in TLC.

Yes, you can comment out this line:

https://github.com/bitfocus/companion-module-thelightingcontroller/blob/cbc6569ef6ca46ed86e44a4ae7d18e340ec810bd/bpmCounter.js#L173

... and (probably not necessary, but) this line:

https://github.com/bitfocus/companion-module-thelightingcontroller/blob/cbc6569ef6ca46ed86e44a4ae7d18e340ec810bd/internalAPI.js#L177

And it will no longer update TLC.

Obviously, commenting out lines will cause issues when you update, as the modifications may be overwritten!

I am trying to set up a dev environment to create add a feature to disable BPM functionality completely. One of the reasons I stopped working on the module was it's a nightmare getting everything set up (took longer to setup than code!). Sadly, that's not changed, and I'm currently stuck (see this issue). Once that's resolved, I might get time to have another look, but I'm moving house in the next couple of weeks so things are super busy.

thargy commented 8 months ago

Hi!

I found this comment see below. Where I have to change it? Where to found ( I am new )

Do I have to change it by the bitfocus software somewhere?

Like to read! Thanx before

Option 1 (Correct way)

The safest way is to create an empty directory and set it as the Developer modules path(https://github.com/bitfocus/companion-module-base/wiki#5-launch-and-setup-companion); you can then clone this repo into that directory and make the changes to the relevant files as instructed.

How to do that is beyond the scope of this module, and you should seek help from the Companion developers if you wish to pursue that root.

Option 2 (Easy but untested)

Given that you are new to Github, I suspect you may struggle, so there is a hacky way that will probably work, but may be overwritten any time you update companion.

Locate your install directory, by default it's C:\Program Files\Companion, from there navigate to resources\module-legacy\manifests\companion-module-thelightingcontroller. There you will find a minified version of the codebase in index.js.

As it is minified then there is no guarantee on what the code looks like, but you will probably find that if you search for the following string (exactly, don't miss the trailing ,)

t.auto&&t.api.send("BPM",t.bpm)),

You will find exactly one instance. If you delete those characters, you should find that your BPM are no longer being updated.

Steffielight commented 7 months ago

Hello,

I appreciate your answer. I find it annoying to ask a lot. I am very eager to learn new things.

the index.js is empty. no details. what else can I do?

I cannot manage to connect buttons from quiq dmx tlc to the stream deck. can you show examples please. really appreciate it.

would be great. love to learn. thanks in advance for your understanding

Stefan

thargy commented 7 months ago

the index.js is empty. no details. what else can I do?

I have no idea why you have an empty file. How do you know it's empty? Have you verified that the file's length is 0, or have you opened it in a text editor? Are you sure you have the right file? Have you installed Companion correctly? Have you run it and added the TLC module first? Have you tried reinstalling Companion, paying careful attention to where you've installed it?

I'm afraid this isn't the appropriate forum for getting basic help on editing code, but in general, you should be braver and try more things before raising an issue. Have a go!

I cannot manage to connect buttons from quiq dmx tlc to the stream deck. can you show examples please. really appreciate it. would be great. love to learn. thanks in advance for your understanding Stefan

This is such an open-ended question, and I already addressed it here:

This is not the appropriate place to ask questions about using Companion; I encourage you to contact their Slack and forums.

Please read that comment, where I provide some additional guidance. As mentioned elsewhere, I have not personally used this software for many years, and not since Companion v. 3 was released — but others are successfully using it in v.3 with only a few issues. Sorry, but I am not prepared to install the software and try to get it working to create more examples and walkthroughs than I have already made available. Ultimately, this is Open Source and provided freely for others to use; I wrote the project for my own use and shared it here for the community to use as they see fit. It is not supported, and I have already volunteered many hours of time to help you and others.

Good luck.

Steffielight commented 7 months ago

Hi,

where did you found that line 173 ? comment out the bpm. I use notepad ++ to try to edit to turn off the BPM. i check in index.js

I have not a bpmCounter.js file. See my screenshot image.

I would like to turn off the BPM signal form companion. I see in index a lot of word bpm. I have not a BPM file

Like to read!

Schermafbeelding 2024-04-13 112732

thargy commented 7 months ago

@Steffielight you must make more effort to carefully read the comments on issues.

Your screenshot clearly shows an index.js file of 281kB, which is the correct size for the minified javascript file described in Option 2 of this comment. The .js extension is being hidden because of your windows settings, please Google how to show file extensions in windows explorer for more information.

I have not a bpmCounter.js file. See my screenshot image.

From the above mentioned comment:

There you will find a minified version of the codebase in index.js.

What this means is that all the javascript from this module is compressed into a single file. That is why you only have an index.js and no bpmCounter.js - which only exists in the un-minified form of the module (as seen in this repository). In the minified (i.e. compressed) version you have in your release build, all the code exists in the one file, in a hard to read format. That file is generated from the code in this repository during the release process.

Please follow the instructions in Option 2 to find the piece of minified code that needs removing. That is, search for and delete the following (exact string) from the index.js file shown in your screenshot of explorer: t.auto&&t.api.send("BPM",t.bpm)),

Finally, you have now raised multiple duplicate issues regarding this on multiple repositories. That is creating extra work for volunteers. We are here to help when we can, however, you must keep further conversation confined to this issue. I appreciate you are a new user and so are clearly unfamiliar with Open Source etiquette, however, if you continue to spam issues, you account will likely be blocked.