Skip to content

Commit

Permalink
#1311 Make targets that don't return a value cause at least minimum-v…
Browse files Browse the repository at this point in the history
…alue feedback
  • Loading branch information
helgoboss committed Nov 6, 2024
1 parent 9131101 commit 263fe49
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
17 changes: 16 additions & 1 deletion main/src/domain/mapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1132,12 +1132,27 @@ impl MainMapping {
// whether it wants numerical or textual feedback.
let prop_provider = MappingPropProvider::new(self, control_context);
let feedback_value = if self.core.mode.wants_advanced_feedback() {
// Advanced feedback (e.g. text expression)
self.core
.mode
.build_feedback(&prop_provider, control_context.mode_context)
} else {
// Normal numeric feedback
let style = self.core.mode.feedback_style(&prop_provider);
FeedbackValue::Numeric(NumericFeedbackValue::new(style, combined_target_value?))
// https://github.com/helgoboss/helgobox/issues/1311:
// Before falling back to UnitValue::MIN, targets that didn't return a value (e.g. actions with invocation
// mode trigger) wouldn't cause any feedback. That means nothing happens to the connected feedback element.
// It's like feedback is disabled.
// This behavior turns out to be weird as soon as you have a display source that wants to display something
// (e.g. text), no matter whether the target supports feedback or not: The display will just be empty,
// nothing will happen to it. It will not even be switched off, so old content stays there ...
// which is misleading.
// I think the best way to deal with it is to emit the minimum feedback value = 0%. Emitting 0% is different
// from off. "Off" means, the mapping and/or target is inactive. So emitting 0% makes the source aware that
// an active target is connected.
let final_target_value =
combined_target_value.unwrap_or(AbsoluteValue::Continuous(UnitValue::MIN));
FeedbackValue::Numeric(NumericFeedbackValue::new(style, final_target_value))
};
let cause = if self.core.is_echo() {
FeedbackCause::Echo
Expand Down
4 changes: 0 additions & 4 deletions main/src/infrastructure/ui/stream_deck_tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ pub fn create_stream_deck_compartment_reflecting_toolbar(
.flatten()
.flatten();
let reaper_resource_path = Reaper::get().resource_path();
// TODO-high CONTINUE How do we deal with targets that can't return a current value? Trigger-like targets?
// Those don't ever send feedback because there's no current value, and as such there's also no feedback value
// and the screen stays as it is.
let button_mappings = items.enumerate().map(|(i, item)| {
let action = Reaper::get()
.main_section()
Expand Down Expand Up @@ -97,7 +94,6 @@ pub fn create_stream_deck_compartment_reflecting_toolbar(
};
Some(cmd)
},
// TODO-high CONTINUE This should be Trigger for trigger-like actions, as soon as the feedback prob is solved
invocation: {
let invocation = match action_character {
ActionCharacter::Toggle => ActionInvocationKind::Absolute7Bit,
Expand Down

0 comments on commit 263fe49

Please sign in to comment.