Advanced Scene Switcher

Advanced Scene Switcher 1.28.1

AaronD

Active Member
Going way out on a limb here, maybe add a Python tab for completely arbitrary behavior? How would that, plus a code generator, compare to where the Macro tab is heading?
A user may not know the syntax or system management to be able to type out something new, hence the CodeGen, but they can probably read and understand existing (clean!) code well enough, and modify it from there. That's definitely where I am with Python, yet I made an auto-producer work between two instances of OBS, by "script-kiddy-ing" two examples together that both worked on their own as-is.

If I were to take this over (not planning to), I'd be tempted to still maintain the various "starting point" tabs, as long as they stay within their named functions, and replace the Macro tab with an arbitrary-text-based thing. Plus a CodeGen to get people started with it. You can recycle most of the Macro's UI to make the CodeGen, it's just that the output is different: Python source code instead of your own byte code.

---

The reason I say this is because I effectively had an equivalent of the Macro tab in a custom theatrical lighting rig. I spent a TON of effort on it, and by the time I got it to do everything I wanted, it was slow to run and hard to use. It looks to me like you're going down the same path, trying to balance increasingly arbitrary functionality, all of which has a good reason to support, with ease of maintenance and a sensible graphical UI from both sides of the screen. I've been there, and it's nearly impossible to actually do that. You have to sacrifice something, be it functionality, user experience, or backend maintenance.

I decided that if I were to do it again, I would replace both my bytecode interpreter and the mouse/touch-based GUI editor, with a decent text editor and a *really good* code generator. Maybe even use C++ in there, include the g++ compiler with the software, and spend my efforts to make the whole process appear seamless. The accept button recompiles the code, and if successful, updates the pointer to the new void user_main(struct all_data* data); // (struct all_data {...}; is in a read-only header file)......

That next version never happened, but if I do end up doing something similar, I really want to try that approach. C++ is probably a bit much for most users, and the compilation and linking steps would also add some difficulty; but Python might just take off and fly, as an already-optimized interpreted language that doesn't need those steps and has a huge userbase already for support.

If you did that, then you could have a code generator that is optimized for user experience and backend maintenance at the expense of functionality, and then get that functionality back by running the CG's output through a user-modification step in a standard language. (the user can simply accept it as-is if desired, which is always valid code) Then it's *that* code that runs, not necessarily the CG's direct output.

Thoughts?
 

khaver

Member
Warmuptill, I just tried your latest Github version and it worked as expected, but with a slight modification to my macros. On the 2nd macro that unpauses the 3rd macro (the one that stops the recording after some time of silence), I had to have it pause the 1st macro so it wouldn't just keep pausing the 3rd macro and the stop recording after silence condition would never be met.

Also, it seems when a macro is paused, it's state in the macro list becomes disabled. If a macro is in a paused state and OBS is closed, that macro gets saved as disabled, so when OBS is reopened, that macro stays disabled. Is pausing supposed to be the same as disabling? Seems to me just pausing a macro shouldn't disable it, but whenever OBS is opened, all macros should start in an enabled state unless specifically unchecked in a previous session by the user. Is this possible?

The problem I see now is if for some reason the mic never gets muted so the silence is never detected and the user instead stops the recording manually, the 1st macro is still in a paused (and disabled) state when OBS is closed. The next Sunday when OBS is started again, the 1st macro that pauses the 3rd macro is now disabled and the 3rd macro will start testing for silence immediately, and I'm back to my original problem. This logic stuff can sometimes lead to an never ending rabbit hole.
 

AaronD

Active Member
The problem I see now is if for some reason the mic never gets muted so the silence is never detected and the user instead stops the recording manually, the 1st macro is still in a paused (and disabled) state when OBS is closed. The next Sunday when OBS is started again, the 1st macro that pauses the 3rd macro is now disabled and the 3rd macro will start testing for silence immediately, and I'm back to my original problem. This logic stuff can sometimes lead to an never ending rabbit hole.

Yeah, this pausing stuff looks increasingly like a complicated minefield to me. Nice idea, and I can see the reasoning behind it, but probably an XY solution to be honest.
 

khaver

Member
Okay I think I found a way for my auto sermon recording to work the way I want it to with the pause and unpause logic being the same as unchecking and checking the boxes in the macro list.

First I got rid of the 1st macro that paused the 3rd macro on OBS startup. Instead I just make sure the 3rd macro (the last macro) is unchecked. And on the last macro, the one that stops the recording after a minute of silence, I've add an "Or" condition for if the recording has stopped, and added an action for it to also pause itself after stopping the recording.

Then in the General Tab, I changed the plugin startup rule to only start the plugin when recording has started.

So here's how my auto sermon recording will work.

1) OBS loads automatically Sunday morning when the computer is logged into (The computer is also used for projecting song lyrics, announcements, and bible verses using another program).
2) At 10:50AM every Sunday, recording starts (this gives the recording a leeway of around 10 minutes before the sermon actually starts). I use my own LUA script to do this.
2a) The ASS plugin also starts, with the silence checking macro unchecked (paused).
3) After 20 minutes (well into the sermon) the macro that checks for 2 minutes of silence is unpaused by the 1st macro.
4) After the sermon, the mic is muted and after 2 minutes of silence the macro stops the recording and pauses itself (uncheck itself).
4a) If the mic is not muted and the recording continues, the user can stop the recording manually, and because of the added "Or" condition for when the recording is stopped, the macro will still pause itself (uncheck itself).
5) OBS can be shut down and all the macros will be ready to go again when OBS is started the next Sunday.

I hope this is clear what I'm trying to achieve. I will try to test it this coming Sunday.
 

lindenkron

Member
Just to clarify you are talking about the spelling issue, right? :)
Or is the functionality broken?


This action is used to globally enable and disable sources.
If you just want to show / hide a source on a particular scene you can use the following action:
View attachment 76825
Yes, the spelling. Sorry if I was being ambigious! :)

Ah, I see. I still get confused with source/scene item and which what is used it appears.

Honestly, having a great time automating my things with Advanced Scene Switcher - the only thing I've really run into (since you pointed out the above) that I miss, would be a way to set audio in a fade-like manner instead of hard jumping to X%.

Unfortunately there's no native way of doing this; and it would have to be Advanced Scene Switcher setting the audio multiple times over a period of time.

Thanks for your hard work on this! It's quite feature rich, and can be a little daunting to go through at first :D
 

Warmuptill

Active Member
First of all, sorry about the delayed response!

If *every* condition has an both inverse and a timer, and you never need the *combination* to be true for X time regardless of the individual times, then I think you're right. But there are things you can do with an overall timer that can't be done with a combination of individual timers and vice-versa. To continue to use khaver's example, there could be a 2-minute difference between
[recording for 20min] AND [quiet for 2min]
and
[(recording for 20min) AND quiet] for 2min
The first of these uses two individual timers; the second uses one individual timer and one overall timer. Depending on the details of the situation, that difference could be inconsequential, significant, or critical.
This can be achieved using time constraints also as you can add macros themselves as individual conditions inside macros.
NestedMacro.PNG

Much easier for a user to define their condition the way that makes direct sense and then say NOT at the end, which is what the inverse or false action does.
The above also applies here as you can invert the complete macro by just using a "if not", "and not", etc.
But I do get your point that I might not be intuitive for some users. :)
Going way out on a limb here, maybe add a Python tab for completely arbitrary behavior?
That is definitively an interesting idea, although not something I will manage to implement any time soon, unfortunately.
I will definitively keep it in mind!

Okay I think I found a way for my auto sermon recording to work the way I want it to with the pause and unpause logic being the same as unchecking and checking the boxes in the macro list.

First I got rid of the 1st macro that paused the 3rd macro on OBS startup. Instead I just make sure the 3rd macro (the last macro) is unchecked. And on the last macro, the one that stops the recording after a minute of silence, I've add an "Or" condition for if the recording has stopped, and added an action for it to also pause itself after stopping the recording.

Then in the General Tab, I changed the plugin startup rule to only start the plugin when recording has started.

So here's how my auto sermon recording will work.

1) OBS loads automatically Sunday morning when the computer is logged into (The computer is also used for projecting song lyrics, announcements, and bible verses using another program).
2) At 10:50AM every Sunday, recording starts (this gives the recording a leeway of around 10 minutes before the sermon actually starts). I use my own LUA script to do this.
2a) The ASS plugin also starts, with the silence checking macro unchecked (paused).
3) After 20 minutes (well into the sermon) the macro that checks for 2 minutes of silence is unpaused by the 1st macro.
4) After the sermon, the mic is muted and after 2 minutes of silence the macro stops the recording and pauses itself (uncheck itself).
4a) If the mic is not muted and the recording continues, the user can stop the recording manually, and because of the added "Or" condition for when the recording is stopped, the macro will still pause itself (uncheck itself).
5) OBS can be shut down and all the macros will be ready to go again when OBS is started the next Sunday.

I hope this is clear what I'm trying to achieve. I will try to test it this coming Sunday.
Glad to hear that the test build seems to work as expected an you found a solution to your problem! :)

Yes, the spelling. Sorry if I was being ambigious! :)

Ah, I see. I still get confused with source/scene item and which what is used it appears.

Honestly, having a great time automating my things with Advanced Scene Switcher - the only thing I've really run into (since you pointed out the above) that I miss, would be a way to set audio in a fade-like manner instead of hard jumping to X%.

Unfortunately there's no native way of doing this; and it would have to be Advanced Scene Switcher setting the audio multiple times over a period of time.

Thanks for your hard work on this! It's quite feature rich, and can be a little daunting to go through at first :D
I am always open to suggestions in regards to the naming of functionality.
"Scene item visibility" is just the best I have come up with so far. :P

The audio fading has been requested a few times already, so I will make sure to prioritize it a bit more, if I should have the time to look into adding new features.
Thanks for the suggestion!
 

lindenkron

Member
I am always open to suggestions in regards to the naming of functionality.
"Scene item visibility" is just the best I have come up with so far. :P

The audio fading has been requested a few times already, so I will make sure to prioritize it a bit more, if I should have the time to look into adding new features.
Thanks for the suggestion!

To be fair, I think the main confusion isn't necessarily your fault. Scene Items are the correct term for Items in a scene. The fact that OBS calls them "Sources" on their UI is what confuses people a lot, because back-end 'sources' are things such as audio input/output etc.

Seeing as you reply fairly fast, I wanted to take this moment to ask you if I'm missing something or if this functionality isn't here:

I can't seem to find a way to determine in a macro "If Scene Z with Scene Item X is visible/not visible then do Y". I can find some way more complex functionality like "If scene item transform", but a simple check for a Scene Items visibility doesn't seem to be there.

There's "Source" which appears to be a mix of actual OBS sources, and some scene items? But I couldn't find for example my Nested Scene Scene Items.
1636674427969.png


I understand these plugins take hell of time to maintain and make. It's really well done :)

-Lind
 

Warmuptill

Active Member
To be fair, I think the main confusion isn't necessarily your fault. Scene Items are the correct term for Items in a scene. The fact that OBS calls them "Sources" on their UI is what confuses people a lot, because back-end 'sources' are things such as audio input/output etc.

Seeing as you reply fairly fast, I wanted to take this moment to ask you if I'm missing something or if this functionality isn't here:

I can't seem to find a way to determine in a macro "If Scene Z with Scene Item X is visible/not visible then do Y". I can find some way more complex functionality like "If scene item transform", but a simple check for a Scene Items visibility doesn't seem to be there.

There's "Source" which appears to be a mix of actual OBS sources, and some scene items? But I couldn't find for example my Nested Scene Scene Items.
View attachment 76972

I understand these plugins take hell of time to maintain and make. It's really well done :)

-Lind
You did not miss it - it was just not implemented :)
I quickly added the requested functionality:
Visibility.PNG


You can find a build with this functionality here in a few minutes:
Note that you have to be logged into GitHub to be able to download this build.
If that is an issue for you let me know and I can try to provide it via other means.
 
Last edited:

Warmuptill

Active Member
@lindenkron I now also added the option to fade in/out volume changes.
AudioFade.PNG

A build with this change can be found here in a few minutes:
Same as the previous build, you will need to be logged into GitHub to be able to download it.

But note that the audio changes and scene visibility changes were made on separate branches so this new build will not contain the changes above.
If you urgently need a build with the combined changes let me know, otherwise I would wait for your feedback before merging them.
 
Last edited:

CodeYan

Member
In the macro pane, there is a bug when trying to delete a specific action in a macro. If you have 2 actions and you try to delete the second one, it will delete the first one instead.
 

Warmuptill

Active Member
In the macro pane, there is a bug when trying to delete a specific action in a macro. If you have 2 actions and you try to delete the second one, it will delete the first one instead.
Thanks for reporting the issue!
Can you give more details on how to reproduce it?
I cannot seem to replicate it on my end for some reason.

And just to be sure: You are using the most recent version of the plugin, are you not?
 

CodeYan

Member
Thanks for reporting the issue!
Can you give more details on how to reproduce it?
I cannot seem to replicate it on my end for some reason.

And just to be sure: You are using the most recent version of the plugin, are you not?
Yes, I am using 1.16.3 and had just recently updated it.

Works even with an empty scene collection.
1. Add a macro
2. Select that macro and add two actions (in the lower box).
3. Change the type of the second one to "Audio" (just to make it distinct from the first action).
4. Hover over the second action to bring up the buttons specific to it. Click the delete button.
5. Action 2 (the "Audio" type) will remain, even if it is the one you deleted.

Second case:
1. Add two actions.
2. Change first one to "Audio".
3. Change second one to "Macro".
4. Delete second one.
5. The second one will remain.

Third case (no bug):
1. Add two actions.
2. Change first one to "Audio" (leave second one alone).
3. Delete second one.
4. The first one remains.

Upon further testing, it seems that it happens when you try to delete the last action, as it happened when I tried with three actions and deleted the last one. It deleted the first one instead.

On even further testing, it becomes unpredictable when you start changing action properties. Sometimes, there's no bug, sometimes there is.

Fourth case with bug:
1. Add three actions (they should all be "Switch Scene" type).
2. Change first one to Cut (leave the other properties alone).
3. Change second to Fade.
4. Change third to audio type.
5. Delete third. The first one will be deleted.

Some tests I did make me think that the bug is happening when you change the Macro action type. Perhaps the action order does not get updated properly when the action type is changed.

Fifth case with bug (this time, I'm deleting the middle one):
1. Add three actions.
2. Change them to "Current transition", "Cut", and "Fade" respectively (to distinguish them).
3. Change SECOND one to Audio type.
4. Delete second one. The first one will be deleted instead.

This happens even with four actions. just change either of the middle ones and delete it.
 

droco01

New Member
Hey!
I can't figure out how to implement the action:
There are scenes, they are all randomly repeated, each scene has media (rtsp webcam links).
How to make sure that if the connection with the camera is lost, the scene will automatically disappear from the random?
And it automatically appeared when a connection with a webcam appeared)

Sorry for the text, it is translated from the cyrillic)
Thanks! :)
 

Warmuptill

Active Member
Yes, I am using 1.16.3 and had just recently updated it.

Works even with an empty scene collection.
1. Add a macro
2. Select that macro and add two actions (in the lower box).
3. Change the type of the second one to "Audio" (just to make it distinct from the first action).
4. Hover over the second action to bring up the buttons specific to it. Click the delete button.
5. Action 2 (the "Audio" type) will remain, even if it is the one you deleted.

Second case:
1. Add two actions.
2. Change first one to "Audio".
3. Change second one to "Macro".
4. Delete second one.
5. The second one will remain.

Third case (no bug):
1. Add two actions.
2. Change first one to "Audio" (leave second one alone).
3. Delete second one.
4. The first one remains.

Upon further testing, it seems that it happens when you try to delete the last action, as it happened when I tried with three actions and deleted the last one. It deleted the first one instead.

On even further testing, it becomes unpredictable when you start changing action properties. Sometimes, there's no bug, sometimes there is.

Fourth case with bug:
1. Add three actions (they should all be "Switch Scene" type).
2. Change first one to Cut (leave the other properties alone).
3. Change second to Fade.
4. Change third to audio type.
5. Delete third. The first one will be deleted.

Some tests I did make me think that the bug is happening when you change the Macro action type. Perhaps the action order does not get updated properly when the action type is changed.

Fifth case with bug (this time, I'm deleting the middle one):
1. Add three actions.
2. Change them to "Current transition", "Cut", and "Fade" respectively (to distinguish them).
3. Change SECOND one to Audio type.
4. Delete second one. The first one will be deleted instead.

This happens even with four actions. just change either of the middle ones and delete it.
Thank you very very much for the detailed reproduction steps!
This made it much easier to track down the problem.
I really appreciate it!

>Some tests I did make me think that the bug is happening when you change the Macro action type.
That was indeed the case.
Whenever the condition or action type was changed the index was incorrectly set to "0".

I was no longer able to reproduce the problems after correctly setting the indices on action / condition type change.

A build with a fix will be available here in a few minutes:
You will have to be logged into GitHub to be able to download it. Let me know if that is an issue for you and I can share it via other means if necessary.

I will probably release an update for the plugin next weekend to make sure this gets fixed.
Thanks again for pointing this out!
 

Warmuptill

Active Member
Hey!
I can't figure out how to implement the action:
There are scenes, they are all randomly repeated, each scene has media (rtsp webcam links).
How to make sure that if the connection with the camera is lost, the scene will automatically disappear from the random?
And it automatically appeared when a connection with a webcam appeared)

Sorry for the text, it is translated from the cyrillic)
Thanks! :)
Unfortunately at the moment I don't think this is possible.
There is a way to detect the image being frozen using the "video" condition, but there is no way to individually disable entries on the "random" tab.
I will try to think of a way to make a setup like the one you described possible (probably by adding more functionality to the macro tab), but I cannot promise that I will get around to it soon.

So thanks for the suggestion!
 
This is looking amazing... but how can I just trigger a scene group to start switching? I couldn't find that in the macros anywhere, although I did get a macro to work (more or less). I just want to start/stop scene group loops with hotkeys.
 

Warmuptill

Active Member
This is looking amazing... but how can I just trigger a scene group to start switching? I couldn't find that in the macros anywhere, although I did get a macro to work (more or less). I just want to start/stop scene group loops with hotkeys.
I assume by scene groups you mean a sequence of scene that you want to automatically switch to, correct?
If so creating a macro similar to this one should do the trick:

SampleSequence.PNG


Corresponding hotkeys to pause / unpause the macro will then automatically be registered in the OBS settings menu.

SampleSequenceHotkey.PNG


Unfortunately I just noticed that the 1.16.3 version of this plugin seems to have a bug where the macro hotkeys are not working correctly.
I will make sure release an update during the weekend as a bunch of other fixes are also ready.

If you want to use a build with the fix for un-/pause hotkeys already you can use the following build: (It should be available in a few minutes)
Note that you have to be logged into GitHub to be able to download it - if that is an issue let me know.
 

lindenkron

Member
@lindenkron I now also added the option to fade in/out volume changes.
View attachment 76989
A build with this change can be found here in a few minutes:
Same as the previous build, you will need to be logged into GitHub to be able to download it.

But note that the audio changes and scene visibility changes were made on separate branches so this new build will not contain the changes above.
If you urgently need a build with the combined changes let me know, otherwise I would wait for your feedback before merging them.
Wow, actual legend.

I was not expecting anything to happen this fast. Both this and the scene item visibility - sorry it took this long to get back to you.

This fade feature is going to automate the majority of all my things now. I'll test the built out with the fade and get back to you. Seeing as I'm testing it on already set up scene collections and that feature is the largest improvement.

I'd love to test both if building one that has both Scene Item visibily & Audio fade isn't too much of a hassle?

Again, legend. Thanks.
-Lind
 

Warmuptill

Active Member
Wow, actual legend.

I was not expecting anything to happen this fast. Both this and the scene item visibility - sorry it took this long to get back to you.

This fade feature is going to automate the majority of all my things now. I'll test the built out with the fade and get back to you. Seeing as I'm testing it on already set up scene collections and that feature is the largest improvement.

I'd love to test both if building one that has both Scene Item visibily & Audio fade isn't too much of a hassle?

Again, legend. Thanks.
-Lind
You can find a build with both features (and a bunch of unrelated of fixes) here:
 

lindenkron

Member
You can find a build with both features (and a bunch of unrelated of fixes) here:
So far I haven't run into major issues.

I do have a pondering question though. For some reason, it's taking 2-2.5 sec for it to run this sequence. The transition is a 1000ms fade - but since 'Wait for Transition' is unchecked; I'd imagine it should run the blur filter immediately - yet it isn't:
1637273283945.png


It's set to check on 200ms interval, but it didn't seem to make a difference from 300ms.

Thanks!

Edit:
I'm seeing like 2000 memory leaks in my Logs but I'm uncertain which plugin is causing it. Just thought I'd mention.
 
Top