audio.rs

 1use std::time::Duration;
 2
 3use rodio::{ChannelCount, SampleRate, nz};
 4
 5pub const REPLAY_DURATION: Duration = Duration::from_secs(30);
 6pub const SAMPLE_RATE: SampleRate = nz!(48000);
 7pub const CHANNEL_COUNT: ChannelCount = nz!(2);
 8
 9mod audio_settings;
10pub use audio_settings::AudioSettings;
11
12mod audio_pipeline;
13pub use audio_pipeline::{Audio, VoipParts};
14pub use audio_pipeline::{AudioDeviceInfo, AvailableAudioDevices};
15pub use audio_pipeline::{ensure_devices_initialized, resolve_device};
16// TODO(audio) replace with input test functionality in the audio crate
17pub use audio_pipeline::RodioExt;
18pub use audio_pipeline::init;
19pub use audio_pipeline::{open_input_stream, open_test_output};
20
21#[derive(Debug, Copy, Clone, Eq, Hash, PartialEq)]
22pub enum Sound {
23    Joined,
24    GuestJoined,
25    Leave,
26    Mute,
27    Unmute,
28    StartScreenshare,
29    StopScreenshare,
30    AgentDone,
31}
32
33impl Sound {
34    fn file(&self) -> &'static str {
35        match self {
36            Self::Joined => "joined_call",
37            Self::GuestJoined => "guest_joined_call",
38            Self::Leave => "leave_call",
39            Self::Mute => "mute",
40            Self::Unmute => "unmute",
41            Self::StartScreenshare => "start_screenshare",
42            Self::StopScreenshare => "stop_screenshare",
43            Self::AgentDone => "agent_done",
44        }
45    }
46}