Skip to content

Commit

Permalink
#757 Make complex feedback probably work
Browse files Browse the repository at this point in the history
  • Loading branch information
helgoboss committed Jun 2, 2023
1 parent e1cc03b commit 0b9890c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion main/lib/helgoboss-learn
4 changes: 2 additions & 2 deletions main/src/domain/eel_midi_source_script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ impl MidiSourceScript for EelMidiSourceScript {
AbsoluteValue::Continuous(v) => v.get(),
AbsoluteValue::Discrete(f) => f.actual() as f64,
},
// TODO-medium Make this work by using EEL string support.
FeedbackValue::Textual(t) => t.text.as_ptr() as isize as f64,
// Rest not supported for EEL
_ => f64::MIN,
};
let (slice, address) = unsafe {
self.eel_unit.y.set(y_value);
Expand Down
5 changes: 5 additions & 0 deletions main/src/domain/lua_midi_source_script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ impl<'a> MidiSourceScript for LuaMidiSourceScript<'a> {
.text
.to_lua(self.lua.as_ref())
.map_err(|_| "couldn't convert string to Lua string")?,
FeedbackValue::Complex(v) => self
.lua
.as_ref()
.to_value(&v.value)
.map_err(|_| "couldn't convert complex value to Lua value")?,
};
// Set input data as variables "y" and "context".
self.env
Expand Down
8 changes: 5 additions & 3 deletions main/src/domain/lua_script_commons.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use helgoboss_learn::{
AbsoluteValue, FeedbackStyle, FeedbackValue, NumericFeedbackValue, RgbColor,
TextualFeedbackValue, UnitValue,
AbsoluteValue, ComplexFeedbackValue, FeedbackStyle, FeedbackValue, NumericFeedbackValue,
RgbColor, TextualFeedbackValue, UnitValue,
};

#[derive(Clone, serde::Serialize, serde::Deserialize)]
Expand Down Expand Up @@ -35,7 +35,9 @@ impl ScriptFeedbackEvent {
Some(ScriptFeedbackValue::Text(t)) => {
FeedbackValue::Textual(TextualFeedbackValue::new(style, t.into()))
}
Some(ScriptFeedbackValue::Complex(_)) => todo!(),
Some(ScriptFeedbackValue::Complex(v)) => {
FeedbackValue::Complex(ComplexFeedbackValue::new(style, v))
}
}
}
}
Expand Down

0 comments on commit 0b9890c

Please sign in to comment.