Skip to content

Commit

Permalink
Change process() InputProcessor super trait method to pass the OSC ad…
Browse files Browse the repository at this point in the history
…dress. Different OSC addresses of various systems require differernt processing logic.
  • Loading branch information
SutekhVRC committed Jan 1, 2024
1 parent d893f25 commit bd248d0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
12 changes: 8 additions & 4 deletions src-tauri/src/toy_handling/handling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -657,9 +657,10 @@ pub async fn toy_management_handler(
.pen_system
.as_mut()
.unwrap()
.process(ModeProcessorInputType::Float(
float_level,
))
.process(
msg.addr.as_str(),
ModeProcessorInputType::Float(float_level),
)
{
// Send to mode processor if specified (Raw = no mode processing)
if let ProcessingMode::Raw = feature
Expand Down Expand Up @@ -701,7 +702,10 @@ pub async fn toy_management_handler(
.pen_system
.as_mut()
.unwrap()
.process(ModeProcessorInputType::Boolean(b))
.process(
msg.addr.as_str(),
ModeProcessorInputType::Boolean(b),
)
{
// Send to mode processor if specified (Raw = no mode processing)
if let ProcessingMode::Raw = feature
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/toy_handling/input_processor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub mod penetration_systems;
*/

pub trait InputProcessor: DynClone + Debug + Send + Sync {
fn process(&mut self, input: ModeProcessorInputType) -> Option<f64>;
fn process(&mut self, addr: &str, input: ModeProcessorInputType) -> Option<f64>;
fn is_parameter(&self, param: &String) -> bool;
}
dyn_clone::clone_trait_object!(InputProcessor);
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl InputProcessor for SPSProcessor {
self.parameter_list.contains(param)
}

fn process(&mut self, _input: ModeProcessorInputType) -> Option<f64> {
fn process(&mut self, _addr: &str, _input: ModeProcessorInputType) -> Option<f64> {
todo!()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl InputProcessor for TPSProcessor {
self.parameter_list.contains(param)
}

fn process(&mut self, _input: ModeProcessorInputType) -> Option<f64> {
fn process(&mut self, _addr: &str, _input: ModeProcessorInputType) -> Option<f64> {
todo!()
}
}

0 comments on commit bd248d0

Please sign in to comment.