]> git.nihav.org Git - nihav.git/commitdiff
core: add allocation of 32-bit integer audio to alloc_audio_buffer()
authorKostya Shishkov <kostya.shishkov@gmail.com>
Mon, 31 Aug 2020 12:35:16 +0000 (14:35 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Mon, 31 Aug 2020 12:35:16 +0000 (14:35 +0200)
nihav-core/src/frame.rs

index 80f1adf4c4b8b6b5e3511b0610ee104e47089492..9423b0ee8e475e5a87086a808fdb37cc9d4a1517 100644 (file)
@@ -661,6 +661,10 @@ pub fn alloc_audio_buffer(ainfo: NAAudioInfo, nsamples: usize, chmap: NAChannelM
                 let data: Vec<i16> = vec![0; length];
                 let buf: NAAudioBuffer<i16> = NAAudioBuffer { data: NABufferRef::new(data), info: ainfo, offs, chmap, len: nsamples, stride, step };
                 Ok(NABufferType::AudioI16(buf))
+            } else if ainfo.format.get_bits() == 32 && ainfo.format.is_signed() {
+                let data: Vec<i32> = vec![0; length];
+                let buf: NAAudioBuffer<i32> = NAAudioBuffer { data: NABufferRef::new(data), info: ainfo, offs, chmap, len: nsamples, stride, step };
+                Ok(NABufferType::AudioI32(buf))
             } else {
                 Err(AllocatorError::TooLargeDimensions)
             }