Work-in-progress repo for ambisonics extensions for OM-SoX
Alexander Nguyen
20 hours ago ff1d9f1b689ebdea536530dfca6fbed5f0068f34
commit | author | age
92c40d 1 ;*********************************************************************
AN 2 ; OM-SoX, (c) 2011-2013 Marlon Schumacher (CIRMMT/McGill University) *
3 ;             http://sourceforge.net/projects/omsox/                 *
4 ;                                                                    *
5 ;  Multichannel Audio Manipulation and Functional Batch Processing.  *
6 ;        DSP based on SoX - (c) C.Bagwell and Contributors           *
7 ;                  http://sox.sourceforge.net/                       *
8 ;*********************************************************************
9 ;
10 ;This program is free software; you can redistribute it and/or
11 ;modify it under the terms of the GNU General Public License
12 ;as published by the Free Software Foundation; either version 2
13 ;of the License, or (at your option) any later version.
14 ;
15 ;See file LICENSE for further informations on licensing terms.
16 ;
17 ;This program is distributed in the hope that it will be useful,
18 ;but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 ;GNU General Public License for more details.
21 ;
22 ;You should have received a copy of the GNU General Public License
23 ;along with this program; if not, write to the Free Software
24 ;Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,10 USA.
25 ;
26 ;Authors: M. Schumacher
27
28 (in-package :om)
29
30 ; ==== SOX-SPLIT ========================
31
32 ; might become a subclass of sox-remix
33 (defclass! sox-split (sox-input)
34            (
35             (gains :accessor gains :initarg :gains :initform nil :documentation *sox-gain-doc*)
36             (channels :accessor channels :initarg :channels :initform nil :documentation *sox-channel-matrix-doc*)
37             )
38            (:icon 17) 
39            (:documentation "Split multichannel audio into individual channels. 
40
41 <channels> optionally allows to specify combinations and order of input-channels (default: all channels in ascending order).")
42            )
43
44 ; redundancy between sox-remix and sox-split here?
45 (defmethod initialize-instance :after ((self sox-split) &rest args)
46   (declare (ignore args))
47   (sox-init-gains self)
48   (when (sound self)
49       (let* ((thechannels (or (channels self) (arithm-ser 1 (sox-sound-channels (sound self)) 1)))  
50 ;check whether the gains are taken care of in sox-input
51              (newgains (if (equal (length (gains self)) (length thechannels))
52                            (gains self)
53                          (repeat-n (gains self) (length thechannels))))
54              )
55         (setf (channels self) thechannels)
56         (setf (gains self) (flat newgains))
57         ))
58   (sox-init-sound self 'atom)       
59         )
60
61 ; (when (> (list-max channels) (sox-sound-channels (sound self)))
62 ; (om-msg-beep "Channels not existent in input source."))