Skip to content

Add opt-in blackout while no music is playing#124

Merged
codingjoe merged 2 commits into
codingjoe:mainfrom
suplstfdo:feature/blackout-on-silence
Jul 15, 2026
Merged

Add opt-in blackout while no music is playing#124
codingjoe merged 2 commits into
codingjoe:mainfrom
suplstfdo:feature/blackout-on-silence

Conversation

@suplstfdo

Copy link
Copy Markdown
Contributor

Adds a global "Blackout on Silence" toggle to the main control window, below the Next Effect button. When enabled, the stage fades to black within one second after the input level stayed below the minimum level threshold for a 1.5s grace period, and resumes as soon as music is audible again. The toggle is off by default, so existing behaviour is unchanged, and it is persisted through the regular settings save/load.

The effect list and its per-effect RND/settings columns move down to make room for the toggle, and the window grows slightly so all entries still fit.

Disclosure: This PR was created with help of AI coding assistance, but thoughtfully reviewed by me

Adds a global "Blackout on Silence" toggle to the main control window,
below the Next Effect button. When enabled, the stage fades to black
within one second after the input level stayed below the minimum level
threshold for a 1.5s grace period, and resumes as soon as music is
audible again. The toggle is off by default, so existing behaviour is
unchanged, and it is persisted through the regular settings save/load.

The effect list and its per-effect RND/settings columns move down to
make room for the toggle, and the window grows slightly so all entries
still fit.

@codingjoe codingjoe left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, it looks promising. It's a really cool idea! I had a few comments, but nothing major. Ping me when you are doing and I will give it a final review. Cheerse! Joe

Comment thread MusicBeam/Stage.pde Outdated
Comment on lines +44 to +45
float fade = ctrl.silenceFade();
if (fade <= 0)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not a big fan of early returns. Please consider inverting the logic and only executing the subsequent code if the conditions are met.

Comment thread MusicBeam/Stage.pde Outdated
Comment on lines +51 to +59
if (fade < 1) {
// additive blending cannot darken, so switch to normal blending
// for a translucent black overlay while fading out
blendMode(BLEND);
noStroke();
fill(0, 0, 0, (1-fade)*100);
rect(-width/2, -height/2, width, height);
blendMode(ADD);
}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently the time-based blackout is separate from the blackout effect. Maybe those should be be unified. It would also be a nice indication in the interface if the effect is toggled on silence.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am unsure about this one. I dont see the sense in the Blackout Effect. Blackout is already the case if no Effect is selected, so why does it exist in the first place? Integrating that thing I dont quite understand deeper into this feature feels wrong. Also it feels wrong to interact with the Blackout Effect from the stage, I think they should stay rather decoupled.
If we really need to make it more clear to the user that "Blackout on silence" is currently kicking in, I would rather suggest to add some kind of indication to the button activating the feature itself. I don't see the necessity though.

Comment thread MusicBeam/MusicBeam.pde Outdated
Comment on lines +353 to +357
if (!blackoutOnSilenceToggle.getState())
return 1;
int quiet = millis()-lastAudibleMillis;
if (quiet <= 1500)
return 1;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again,not a fan of early returns. return 1 should be the last statement if all other blocks were not executed and didn't return.

@suplstfdo
suplstfdo force-pushed the feature/blackout-on-silence branch from 97f0cfd to 81faf41 Compare July 15, 2026 17:03
@suplstfdo

Copy link
Copy Markdown
Contributor Author

@codingjoe consider pinged :)

I adressed the early returns. Regarding the blackout effect topic i need further clarification.

@codingjoe

Copy link
Copy Markdown
Owner

Nice, LGTM!

@codingjoe
codingjoe merged commit fcef14a into codingjoe:main Jul 15, 2026
0 of 3 checks passed
@suplstfdo
suplstfdo deleted the feature/blackout-on-silence branch July 17, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants