From: Kostya Shishkov Date: Tue, 23 May 2017 17:09:30 +0000 (+0200) Subject: more utility code for formats.rs X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=10a00d5246e055230d666ed0455b5cf18aa00505;p=nihav.git more utility code for formats.rs --- diff --git a/src/formats.rs b/src/formats.rs index 03e6411..aa053b2 100644 --- a/src/formats.rs +++ b/src/formats.rs @@ -59,7 +59,7 @@ impl fmt::Display for NASoniton { } } -#[derive(Debug,Clone,Copy)] +#[derive(Debug,Clone,Copy,PartialEq)] pub enum NAChannelType { C, L, R, Cs, Ls, Rs, Lss, Rss, LFE, Lc, Rc, Lh, Rh, Ch, LFE2, Lw, Rw, Ov, Lhs, Rhs, Chs, Ll, Rl, Cl, Lt, Rt, Lo, Ro } @@ -142,6 +142,11 @@ impl NAChannelMap { pub fn add_channel(&mut self, ch: NAChannelType) { self.ids.push(ch); } + pub fn add_channels(&mut self, chs: &[NAChannelType]) { + for i in 0..chs.len() { + self.ids.push(chs[i]); + } + } pub fn num_channels(&self) -> usize { self.ids.len() }