atem-connection-rs/atem-connection-rs/src/state/audio.rs

74 lines
2.0 KiB
Rust

use std::collections::HashMap;
use crate::enums::{AudioMixOption, AudioSourceType, ExternalPortType};
use derive_getters::Getters;
use derive_new::new;
pub type AudioChannel = ClassicAudioChannel;
pub type AudioMasterChannel = ClassicAudioMasterChannel;
pub type AtemAudioState = AtemClassicAudioState;
#[derive(Clone, PartialEq, Getters, new)]
pub struct ClassicAudioChannel {
source_type: AudioSourceType,
pub port_type: ExternalPortType,
pub mix_option: AudioMixOption,
pub gain: f64,
pub balance: f64,
supports_rca_to_xlr_enabled: bool,
pub rca_to_xlr_enabled: bool,
}
#[derive(Clone, PartialEq, Getters, new)]
pub struct ClassicAudioMasterChannel {
pub gain: f64,
pub balance: f64,
pub follow_fade_to_black: bool,
}
#[derive(Clone, PartialEq, Getters, new)]
pub struct ClassicAudioMonitorChannel {
pub enabled: bool,
pub gain: f64,
pub mute: bool,
pub solo: bool,
pub solo_source: f64,
pub dim: bool,
pub dim_level: f64,
}
#[derive(Clone, PartialEq, Getters, new)]
pub struct ClassicAudioHeadphoneOutputChannel {
pub gain: f64,
pub program_out_gain: f64,
pub sidetone_gain: f64,
pub talkback_gain: f64,
}
#[derive(Clone, PartialEq, Getters)]
pub struct AtemClassicAudioState {
number_of_channels: u8,
has_monitor: bool,
pub channels: HashMap<u64, ClassicAudioChannel>,
pub monitor: Option<ClassicAudioMonitorChannel>,
pub headphones: Option<ClassicAudioHeadphoneOutputChannel>,
pub master: Option<ClassicAudioMasterChannel>,
pub audio_follow_video_crossfade_transition_enabled: bool,
}
impl AtemClassicAudioState {
pub fn new(number_of_channels: u8, has_monitor: bool) -> Self {
Self {
number_of_channels,
has_monitor,
channels: Default::default(),
monitor: Default::default(),
headphones: Default::default(),
master: Default::default(),
audio_follow_video_crossfade_transition_enabled: false,
}
}
}