;*********************************************************************
|
; OM-SoX, (c) 2011-2013 Marlon Schumacher (CIRMMT/McGill University) *
|
; http://sourceforge.net/projects/omsox/ *
|
; *
|
; Multichannel Audio Manipulation and Functional Batch Processing. *
|
; DSP based on SoX - (c) C.Bagwell and Contributors *
|
; http://sox.sourceforge.net/ *
|
;*********************************************************************
|
;
|
;This program is free software; you can redistribute it and/or
|
;modify it under the terms of the GNU General Public License
|
;as published by the Free Software Foundation; either version 2
|
;of the License, or (at your option) any later version.
|
;
|
;See file LICENSE for further informations on licensing terms.
|
;
|
;This program is distributed in the hope that it will be useful,
|
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
;GNU General Public License for more details.
|
;
|
;You should have received a copy of the GNU General Public License
|
;along with this program; if not, write to the Free Software
|
;Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,10 USA.
|
;
|
;Authors: M. Schumacher
|
|
(in-package :om)
|
|
; ==== SOX-MIX-CONSOLE ========================
|
|
; there's basically 2 options:
|
; 1) Use sox-mix-console but in a way that there can be a list of effects which is applied internally to each of the components (drawback: inconsistent handling of polymorphism)
|
; 2) Write a 'macro' (as a patch) that does what sox-mix-console does, but explicitly 'fills' a sox-mix object with pipes from (sox-process '(sox-remixes) '(sox-pads))
|
|
(defclass! sox-mix-console (sox-input)
|
(
|
(gains :accessor gains :initarg :gains :initform nil :documentation *sox-gain-doc*)
|
(panning :accessor panning :initform nil :initarg :panning :documentation *sox-panning-doc*)
|
(numchannels :accessor numchannels :initform 2 :initarg :numchannels :documentation "Number of output channels for mixing process.")
|
)
|
(:icon 12) ;918
|
(:documentation "Sox-Mix-Console allows mixing and panning inputs on an array of output channels. Inputs do not need to have the same number of channels.
|
|
Multichannel inputs are first mixed into a single channel before panning/mixing with other soundfiles.
|
NB: Input audio must have the same samplerate.")
|
)
|
|
; pipe input not possible with this class
|
; why isn't this using sox-init-panning? not for lists?
|
|
(defmethod initialize-instance :after ((self sox-mix-console) &rest args)
|
(when (sound self)
|
(let* ((sound-length (length (list! (sound self))))
|
(linear-panning (om-scale (arithm-ser 1 sound-length 1) 1 (numchannels self)))
|
(panning-list (loop for sound in (list! (sound self))
|
for i from 0 to (- sound-length 1) collect
|
(if (soundp sound)
|
(if (equal (tracknum sound) 0)
|
(nth i linear-panning)
|
(+ (tracknum sound) (* 0.01 (pan sound))))
|
)
|
))
|
(nunumchannels (+ 1 (floor (list-max panning-list)))))
|
(unless (consp (panning self))
|
(setf (panning self) panning-list))
|
(sox-init-gains self)
|
(sox-init-sound self 'list)
|
(when (< (numchannels self) (list-max (panning self)))
|
(setf (numchannels self) nunumchannels)
|
)
|
)
|
)
|
)
|