add VmcExtConfig

This commit is contained in:
Cassandra de la Cruz-Munoz 2023-12-30 11:56:22 -05:00
parent dbb208dfc4
commit a98faa2319

View File

@ -1141,3 +1141,25 @@ impl MessageBehavior for VmcExtSettingWin {
return Ok(result); return Ok(result);
} }
} }
struct VmcExtConfig {
path: String,
}
impl MessageBehavior for VmcExtConfig {
fn to_osc_message(&self) -> OscMessage {
return OscMessage {
addr: String::from("/VMC/Ext/Config"),
args: vec![OscType::from(self.path.to_owned())],
};
}
fn from_osc_message(msg: OscMessage) -> Result<Self, String> {
if msg.addr.len() != 1 {
return Err(String::from("arg count invalid"));
}
match &msg.args[0] {
OscType::String(s) => return Ok(VmcExtConfig { path: s.to_owned() }),
_ => return Err(String::from("arg type invalid")),
}
}
}