From a590ad25dc2fa20301f47b7b6c84e5f176e36db2 Mon Sep 17 00:00:00 2001
From: Alexander Nguyen <alexander.nguyen@stud.hfm-karlsruhe.de>
Date: Sat, 25 Jan 2025 21:48:25 +0100
Subject: [PATCH] Update

---
 sources/classes/sox-hoaencode.lisp |    4 ++--
 sources/sox-process.lisp           |   28 ++++++++++++++++++++--------
 2 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/sources/classes/sox-hoaencode.lisp b/sources/classes/sox-hoaencode.lisp
index e7d1bf7..537acbc 100644
--- a/sources/classes/sox-hoaencode.lisp
+++ b/sources/classes/sox-hoaencode.lisp
@@ -125,9 +125,9 @@
                                     (lambda (xyz) (multiple-value-list (om:xyz->aed (first xyz) (second xyz) (third xyz)))) 
                                     positions
                                 )))))
-                (t (error "Input must contain lists of length 2 (ae) or 3 (xyz)."))
+                (t (error "Positions must consist of lists of length 2 (ae) or 3 (xyz)."))
             ))
-        (t (error "Input must be 3dc or list."))))
+        (t (error "Positions must be of type 3dc or list."))))
 
 ; High-level API
 ; Returns the gain value (linear, -1 to 1) for a single ACN-channel
diff --git a/sources/sox-process.lisp b/sources/sox-process.lisp
index 4f54088..da3a27b 100644
--- a/sources/sox-process.lisp
+++ b/sources/sox-process.lisp
@@ -183,13 +183,22 @@
 (defmethod! sox-process ((sox-input sox-hoaencode) (sox-effect string) &key output filetype samplerate bitdepth recursive batch-mode)
     (if (probe-file *sox-path*)
         (progn
+            (when 
+                (not (listp (sound sox-input)))
+                (om-message-abort "sound must be a list.")
+            )
+            (when 
+                (not 
+                    (or 
+                        (subtypep (type-of (positions sox-input)) '3dc)
+                        (and (subtypep (type-of (positions sox-input)) 'list) (> (length (positions sox-input)) 0) (subtypep (type-of (first (positions sox-input))) 'list) (> (length (first (positions sox-input))) 1)))
+                )
+                (om-message-abort "positions must be of type 3dc, or a list of lists.")
+            )
             (let* 
                 (
                     (sound 
-                        (if (> (length (positions sox-input)) (length (list! (sound sox-input)))) 
-                            (repeat-n (first (list! (sound sox-input))) (length (positions sox-input)))
-                            (sound sox-input)
-                        )
+                        (sound sox-input)
                     )
                     (positions-ae 
                         (sox-hoaencode-auto-convert-positions (positions sox-input))
@@ -201,8 +210,8 @@
                 )
                 (let* 
                     (
-                        (outfile (create-path nil output filetype))
                         (filenames (loop for soundfile in sound collect (namestring soundfile)))
+                        (outfile (create-path nil output filetype))
                     )
                     (setf str (format nil " ~s ~a" (namestring *sox-path*) *sox-options*))
                     (if (= (length filenames) 1)
@@ -262,9 +271,12 @@
                     )
                     (setf str 
                         (cond 
-                            ((equal output "realtime") (sox-samplebits (string+ str " -q ") bitdepth samplerate *sox-audio-device*))
-                            ((equal output "pipe") (sox-samplebits str bitdepth samplerate "-p"))
-                            (t (sox-samplebits str bitdepth samplerate outfile))
+                            ((equal output "realtime") 
+                                (sox-samplebits (string+ str " -q ") bitdepth samplerate *sox-audio-device*))
+                            ((equal output "pipe") 
+                                (sox-samplebits str bitdepth samplerate "-p"))
+                            (t 
+                                (sox-samplebits str bitdepth samplerate outfile))
                         )
                     )
                     (setf str (string+ str sox-effect))

--
Gitblit v1.9.1