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;
11pub use audio_settings::LIVE_SETTINGS;
12
13mod audio_pipeline;
14pub use audio_pipeline::Audio;
15pub use audio_pipeline::{AudioDeviceInfo, AvailableAudioDevices};
16pub use audio_pipeline::{ensure_devices_initialized, resolve_device};
17// TODO(audio) replace with input test functionality in the audio crate
18pub use audio_pipeline::RodioExt;
19pub use audio_pipeline::init;
20pub use audio_pipeline::{open_input_stream, open_test_output};
21
22#[derive(Debug, Copy, Clone, Eq, Hash, PartialEq)]
23pub enum Sound {
24    Joined,
25    GuestJoined,
26    Leave,
27    Mute,
28    Unmute,
29    StartScreenshare,
30    StopScreenshare,
31    AgentDone,
32}
33
34impl Sound {
35    fn file(&self) -> &'static str {
36        match self {
37            Self::Joined => "joined_call",
38            Self::GuestJoined => "guest_joined_call",
39            Self::Leave => "leave_call",
40            Self::Mute => "mute",
41            Self::Unmute => "unmute",
42            Self::StartScreenshare => "start_screenshare",
43            Self::StopScreenshare => "stop_screenshare",
44            Self::AgentDone => "agent_done",
45        }
46    }
47}