add VmcExtSetPeriod message
This commit is contained in:
		
							parent
							
								
									290dc17d3e
								
							
						
					
					
						commit
						37298e3958
					
				
							
								
								
									
										58
									
								
								src/lib.rs
									
									
									
									
									
								
							
							
						
						
									
										58
									
								
								src/lib.rs
									
									
									
									
									
								
							| 
						 | 
					@ -1208,3 +1208,61 @@ impl MessageBehavior for VmcThru {
 | 
				
			||||||
        return Ok(VmcThru { addr: msg.addr, arg1 , arg2  })
 | 
					        return Ok(VmcThru { addr: msg.addr, arg1 , arg2  })
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct VmcExtSetPeriod {
 | 
				
			||||||
 | 
					    status: i32,
 | 
				
			||||||
 | 
					    root: i32,
 | 
				
			||||||
 | 
					    bone: i32,
 | 
				
			||||||
 | 
					    blendshape: i32,
 | 
				
			||||||
 | 
					    camera: i32,
 | 
				
			||||||
 | 
					    devices: i32
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					impl MessageBehavior for VmcExtSetPeriod {
 | 
				
			||||||
 | 
					    fn to_osc_message(&self) -> OscMessage {
 | 
				
			||||||
 | 
					        return OscMessage { addr: String::from("/VMC/Ext/Set/Period"), args: vec![
 | 
				
			||||||
 | 
					            OscType::from(self.status),
 | 
				
			||||||
 | 
					            OscType::from(self.root),
 | 
				
			||||||
 | 
					            OscType::from(self.bone),
 | 
				
			||||||
 | 
					            OscType::from(self.blendshape),
 | 
				
			||||||
 | 
					            OscType::from(self.camera),
 | 
				
			||||||
 | 
					            OscType::from(self.devices),
 | 
				
			||||||
 | 
					        ] }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    fn from_osc_message(msg: OscMessage) -> Result<Self, String> {
 | 
				
			||||||
 | 
					        if msg.args.len() != 6 {
 | 
				
			||||||
 | 
					            return Err(String::from("arg count invalid"));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        let status: i32;
 | 
				
			||||||
 | 
					        let root: i32;
 | 
				
			||||||
 | 
					        let bone: i32;
 | 
				
			||||||
 | 
					        let blendshape: i32;
 | 
				
			||||||
 | 
					        let camera: i32;
 | 
				
			||||||
 | 
					        let devices: i32;
 | 
				
			||||||
 | 
					        match msg.args[0] {
 | 
				
			||||||
 | 
					            OscType::Int(i) => status = i,
 | 
				
			||||||
 | 
					            _ => return Err(String::from("arg type invalid"))
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        match msg.args[1] {
 | 
				
			||||||
 | 
					            OscType::Int(i) => root = i,
 | 
				
			||||||
 | 
					            _ => return Err(String::from("arg type invalid"))
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        match msg.args[2] {
 | 
				
			||||||
 | 
					            OscType::Int(i) => bone = i,
 | 
				
			||||||
 | 
					            _ => return Err(String::from("arg type invalid"))
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        match msg.args[3] {
 | 
				
			||||||
 | 
					            OscType::Int(i) => blendshape = i,
 | 
				
			||||||
 | 
					            _ => return Err(String::from("arg type invalid"))
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        match msg.args[4] {
 | 
				
			||||||
 | 
					            OscType::Int(i) => camera = i,
 | 
				
			||||||
 | 
					            _ => return Err(String::from("arg type invalid"))
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        match msg.args[5] {
 | 
				
			||||||
 | 
					            OscType::Int(i) => devices = i,
 | 
				
			||||||
 | 
					            _ => return Err(String::from("arg type invalid"))
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return Ok(VmcExtSetPeriod { status, root, bone, blendshape, camera, devices})
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user