From: Kostya Shishkov Date: Wed, 28 Jan 2026 17:56:03 +0000 (+0100) Subject: nihav_core/formats: add another helper function for NAChannelType X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=b78a7062cb2b696e976f64091dbdf58133661067;p=nihav.git nihav_core/formats: add another helper function for NAChannelType --- diff --git a/nihav-core/src/formats.rs b/nihav-core/src/formats.rs index 722bd18..967ac73 100644 --- a/nihav-core/src/formats.rs +++ b/nihav-core/src/formats.rs @@ -172,6 +172,17 @@ impl NAChannelType { NAChannelType::Rhs | NAChannelType::Rl | NAChannelType::Rt | NAChannelType::Ro) } + /// Returns binaural channel pair corresponding to the provided centre channel (or `None` otherwise). + pub fn get_pair(self) -> Option<(Self, Self)> { + match self { + NAChannelType::C => Some((NAChannelType::L, NAChannelType::R)), + NAChannelType::Ch => Some((NAChannelType::Lh, NAChannelType::Rh)), + NAChannelType::Cl => Some((NAChannelType::Ll, NAChannelType::Rl)), + NAChannelType::Cs => Some((NAChannelType::Ls, NAChannelType::Rs)), + NAChannelType::Chs => Some((NAChannelType::Lhs, NAChannelType::Rhs)), + _ => None + } + } } impl FromStr for NAChannelType {