From 197ce0f724aa567c7401f63dc889e7861ed8c0aa Mon Sep 17 00:00:00 2001
From: Marlon Schumacher <schumacher@hfm-karlsruhe.de>
Date: Mon, 24 Feb 2025 16:12:45 +0100
Subject: [PATCH] fix: smaller fixes, comments and cleanups

---
 sources/classes/sox-hoaencode.lisp |   39 ++++++++++++++++++++++++++-------------
 1 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/sources/classes/sox-hoaencode.lisp b/sources/classes/sox-hoaencode.lisp
index 537acbc..cdefebe 100644
--- a/sources/classes/sox-hoaencode.lisp
+++ b/sources/classes/sox-hoaencode.lisp
@@ -4,8 +4,8 @@
 ; 1) Sounds must have identical sample rate; otherwise, SoX fails silently, literally.
 
 ; Questions:
-; 1) Is there a built-in (flatten lst)-function?
-; 2) Implement up to which order? <=> CLI issues to be expected (e.g., maximum command character length)?
+; 1) Is there a built-in (flatten lst)-function? Yes, om:flat
+; 2) Implement up to which order? <=> CLI issues to be expected (e.g., maximum command character length)? max character length for CLI should be changeable 
 
 (in-package :om)
 
@@ -34,8 +34,9 @@
     )
 )
 
-; Ambisonics
-(defun sox-hoaencode-sn3d-factor (order degree)
+;  ### Ambisonics ###
+
+(defun sox-hoaencode-sn3d-factor (order degree) ; andere Nomenklatur, "degree" w�re besser "order" um Verwechslung mit Winkeln zu vermeiden
     (ecase order
         (0 1)
         (1 1)
@@ -96,13 +97,14 @@
         )
     ))
 
-; Convenience functions
+; #### Utility functions ####
 
-; Ensures that positions are given as '((azimuth elevation) ...) (in degrees), i.e.
-; 1) if list of list of three values, input is assumed to be '(x y z) coordinates and will be transformed to '(azimuth elevation) coordinates (in the navigational spherical coordinate system).
-; 2) if list of list of two values, input is assumed to be '(azimuth elevation) coordinates and won't be transformed any further.
-; 3) if 3dc, input is transformed to '(azimuth elevation) coordinates.
 (defun sox-hoaencode-auto-convert-positions (positions)
+"Ensures that positions are given as '((azimuth elevation) ...) (in degrees), i.e.
+1) if list of list of three values, input is assumed to be '(x y z) coordinates and will be transformed to '(azimuth elevation) coordinates (in the navigational spherical coordinate system).
+2) if list of list of two values, input is assumed to be '(azimuth elevation) coordinates and won't be transformed any further.
+3) if 3dc, input is transformed to '(azimuth elevation) coordinates.
+"
     (cond 
         ((subtypep (type-of positions) '3dc)  
             (progn ; convert xyz->aed, keep azimuth and elevation only.
@@ -129,9 +131,13 @@
             ))
         (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
+
+
+; ####### High-level API ########## 
+
+
 (defun sox-hoaencode-gain-single-component (order degree azimuth_deg elevation_deg)
+  "Returns the gain value (linear, -1 to 1) for a single ACN-channel"
     (let
         (
             ; It is assumed that azimuth_deg follows the implementation details of SpatDIF, 
@@ -146,13 +152,18 @@
             (sox-hoaencode-elevation-factor order degree elevation_deg)))
     )
 
-; Returns the gain values for all components at a specific order
+; (sox-hoaencode-gain-single-component 1 1 45 0)
+; what is the difference between "order" and "degree"?
+
+
 (defun sox-hoaencode-gains-by-order (order azimuth_deg elevation_deg)
+  "Returns the gain values for all components at a specific order"
     (loop for degree from (* -1 order) to order collect 
         (sox-hoaencode-gain-single-component order degree azimuth_deg elevation_deg)))
 
-; Returns the gain values for all components up to a specific order
+
 (defun sox-hoaencode-gains-up-to-order (order azimuth_deg elevation_deg)
+  "Returns the gain values for all components up to a specific order"
     (sox-hoaencode-double-to-float 
         (flatten
             (loop for ord from 0 to order collect 
@@ -176,3 +187,5 @@
         (sox-init-sound self 'list)
     )
 )
+
+

--
Gitblit v1.9.1