1pub enum AudioMethod {
7 PutInputAudio,
8 StartInputInjection,
9 StopInputInjection,
10
11 StartOutputSave,
12 StopOutputSave,
13 GetOutputAudio,
14
15 PlaySound,
16}
17
18impl std::str::FromStr for AudioMethod {
19 type Err = anyhow::Error;
20
21 fn from_str(method: &str) -> Result<Self, Self::Err> {
22 match method {
23 "PutInputAudio" => Ok(AudioMethod::PutInputAudio),
24 "StartInputInjection" => Ok(AudioMethod::StartInputInjection),
25 "StopInputInjection" => Ok(AudioMethod::StopInputInjection),
26
27 "StartOutputSave" => Ok(AudioMethod::StartOutputSave),
28 "StopOutputSave" => Ok(AudioMethod::StopOutputSave),
29 "GetOutputAudio" => Ok(AudioMethod::GetOutputAudio),
30 "PlaySound" => Ok(AudioMethod::PlaySound),
31 _ => return Err(format_err!("invalid Audio Facade method: {}", method)),
32 }
33 }
34}