Work-in-progress repo for ambisonics extensions for OM-SoX
Marlon Schumacher
4 days ago 6ae8ed47dd6caf4ff4df39f1195b87d02e2537f0
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 ; This file contains editors for the sox-input-classes
31
32 (defparameter soxconsole-trackw 100)
33
34
35 ;%%%%%%% Editor for SOX-INPUT %%%%%%%%%%%%%%%%%%%%%
36
37 (defmethod class-has-editor-p ((self sox-input)) t)
38
39 (defclass sox-console-editor (editorview) 
40   ((track-panels :initform nil :accessor track-panels :type list)))
41
42 (defclass sox-track-panel (om-view) 
43   ((sox-object :accessor sox-object :initarg :sox-object :initform nil)
44    (tracknum :accessor tracknum :initarg :tracknum :initform 0)))
45
46 (defmethod get-editor-class ((self sox-input)) 'sox-console-editor)
47
48 (defmethod get-win-ed-size ((self sox-input)) 
49   (om-make-point (+ 2 (* (+ soxconsole-trackw 2) (max 1 (min 32 (length (list! (sound self))))))) 150))
50
51 (defmethod initialize-instance :after ((self sox-console-editor) &rest l)
52    (declare (ignore l))
53    (om-set-bg-color self *om-dark-gray-color*)
54    (initialize-panels self)) ; typo or correct?
55
56 (defmethod initialize-panels ((self sox-console-editor))
57   (om-with-delayed-redraw self
58     (setf (track-panels self)
59           (loop for i from 0 to (1- (length (list! (sound (object self))))) collect
60                 (om-make-view 'sox-track-panel
61                               :tracknum i
62                               :sox-object (object self)
63                               :bg-color *om-light-gray-color*
64                               :position (om-make-point (+ 2 (* i (+ soxconsole-trackw 2))) 2) 
65                               :size (om-make-point soxconsole-trackw (- (h self) 4)))))
66     
67     (apply 'om-add-subviews (cons self (track-panels self)))
68     (let ((size (get-win-ed-size (object self))))
69       (oa::set-not-resizable (window self) (om-point-h size) (om-point-v size))) 
70     ))
71
72 (defmethod update-editor-after-eval ((self sox-console-editor) val)
73   (setf (object self) val)
74   (initialize-panels self))
75
76 (defmethod add-pan-controls ((self sox-track-panel) (object t) posy) nil)
77
78 (defmethod initialize-instance :after ((self sox-track-panel) &rest l)
79   (let ((pos 0) pantxt gaintxt)
80     (setf pos (+ pos 5))
81     (om-add-subviews self (setf pantxt (om-make-dialog-item 'om-static-text
6ae8ed 82                                                             (om-make-point 5 pos) 
92c40d 83                                                             (om-make-point soxconsole-trackw 16)
AN 84                                                             (string+ (pathname-name (nth (tracknum self) (list! (sound (sox-object self)))))
85                                                                      "." (pathname-type (nth (tracknum self) (list! (sound (sox-object self))))))
86                                                             :font *om-default-font1b*
87                                                             )))
88     (setf pos (+ pos 25))    
89     (add-pan-controls self (sox-object self) pos)
6ae8ed 90     ;(add-azi-controls self (sox-object self) pos)
MS 91     ;(add-ele-controls self (sox-object self) pos)
92     ;(add-order-controls self (sox-object self) pos)
93     
92c40d 94
AN 95     (om-add-subviews self (om-make-view 'graphic-numbox 
96                                         :position (om-make-point 30 pos) 
97                                         :size (om-make-point 45 100)
98                                         :pict (om-load-and-store-picture "fader" 'di)
99                                         :nbpict 77
100                                         :pict-size (om-make-point 31 94)
101                                         :di-action (om-dialog-item-act item
102                                                             (om-set-dialog-item-text gaintxt 
103                                                                                      (format nil "  dB: ~4f" (* (- (value item) 120) 0.5)))
104                                                             (setf (nth (tracknum self) (gains (sox-object self))) (* (- (value item) 120) 0.5))
105                                                             (report-modifications (om-view-container self)))
106                                         :font *om-default-font2*
107                                         :value (+ (* (nth (tracknum self) (gains (sox-object self))) 2) 120)
108                                         :min-val 0
109                                         :max-val 132
110                      ))
111
112         (om-add-subviews self (setf gaintxt (om-make-dialog-item 'om-static-text
113                                              (om-make-point 20 (+ pos 99))
114                                              (om-make-point 60 16)
115                                              (format nil "  dB: ~4f" (nth (tracknum self) (gains (sox-object self))))
116                                              :font *om-default-font1*
117                                              )))
118     ))
119
120 ;%%%%%%% Editor for SOX-PAN %%%%%%%%%%%%%%%
121
122 (defmethod get-win-ed-size ((self sox-pan)) 
6ae8ed 123   (om-make-point (+ 2 (* (+ soxconsole-trackw 2) (max 1 (min 32 (length (list! (sound self))))))) 200)) ; should not have a case for lists
92c40d 124
AN 125 (defmethod add-pan-controls ((self sox-track-panel) (object sox-pan) posy)
126   (let ((pantxt (om-make-dialog-item 'om-static-text
127                                      (om-make-point 28 (+ posy 148)) 
128                                      (om-make-point 65 16)
129                                      (string+ "pan: " (number-to-string (om-round (panning object) 3)))
130                                      :font *om-default-font1*
131                                      )))
132     (om-add-subviews self pantxt (om-make-view 'graphic-numbox
133                                                :position (om-make-point 40 (+ posy 124))
134                                                :size (om-make-point 26 26) 
135                                                :pict (om-load-and-store-picture "dial" 'di)
136                                                :nbpict 65
137                                                :pict-size (om-make-point 24 24)
138                                                :di-action (om-dialog-item-act item
139                                                             ; perhaps this could be made more efficient by manipulating min-val and max-val rather then as a let statement
140                                                             (let ((val (+ 1 (* (value item) 0.02))))
141                                                               (om-set-dialog-item-text pantxt (format nil "pan: ~3f" val))
142                                                               ;(om-set-dialog-item-text pantxt (string+ "pan: " (number-to-string (om-round val 2))))
143                                                               (setf (panning object) val)
144                                                               (report-modifications (om-view-container self))))
145                                                :font *om-default-font2*
146                                                :value (* 50 (1- (panning object)))
147                                                :min-val 0
148                                                :max-val (max 10 (* 50 (1- (numchannels object))))))
149     ))
150
6ae8ed 151 ;%%%%%%% Editor for SOX-HOAENCODE %%%%%%%%%%%%%%%
MS 152
153 (defmethod get-editor-class ((self sox-hoaencode)) 'sox-console-editor)
154
155 (defmethod get-win-ed-size ((self sox-hoaencode)) 
156   (om-make-point (+ 2 (+ soxconsole-trackw 2)) 328))
92c40d 157
AN 158
6ae8ed 159 (defmethod add-azi-controls ((self sox-track-panel) (object sox-hoaencode) posy)
MS 160   (let ((azitxt (om-make-dialog-item 'om-static-text
161                                      (om-make-point 28 (+ posy 156)) 
162                                      (om-make-point 65 16)
163                                      (string+ "azi: " (number-to-string (om-round (azimuth object) 3)))
164                                      :font *om-default-font1*
165                                      )))
166     (om-add-subviews self azitxt (om-make-view 'graphic-numbox
167                                                :position (om-make-point 40 (+ posy 132))
168                                                :size (om-make-point 26 26) 
169                                                :pict (om-load-and-store-picture "dial" 'di)
170                                                :nbpict 65
171                                                :pict-size (om-make-point 24 24)
172                                                :di-action (om-dialog-item-act item   
173                                                             (let ((val (float (value item))))
174                                                               (om-set-dialog-item-text azitxt (format nil "azi: ~3f" val))
175                                                               (setf (azimuth object) val)
176                                                               (report-modifications (om-view-container self))))
177                                                :font *om-default-font2*
178                                                :value (/ (azimuth object) 360)
179                                                :min-val 0 :max-val 360)
180                      )
181     )
182   )
183
184 (defmethod add-ele-controls ((self sox-track-panel) (object sox-hoaencode) posy)
185   (let ((eletxt (om-make-dialog-item 'om-static-text
186                                      (om-make-point 28 (+ posy 208)) 
187                                      (om-make-point 65 16)
188                                      (string+ "ele: " (number-to-string (om-round (elevation object) 3)))
189                                      :font *om-default-font1*
190                                      )))
191     (om-add-subviews self eletxt (om-make-view 'graphic-numbox
192                                                :position (om-make-point 40 (+ posy 184))
193                                                :size (om-make-point 26 26) 
194                                                :pict (om-load-and-store-picture "dial" 'di)
195                                                :nbpict 65
196                                                :pict-size (om-make-point 24 24)
197                                                :di-action (om-dialog-item-act item   
198                                                             (let ((val (float (value item))))
199                                                               (om-set-dialog-item-text eletxt (format nil "ele: ~3f" val))
200                                                               (setf (elevation object) val)
201                                                               (report-modifications (om-view-container self))))
202                                                :font *om-default-font2*
203                                                :value (/ (elevation object) 360)
204                                                :min-val 0 :max-val 360)
205                      )
206     )
207   )
208
209 (defmethod add-order-controls ((self sox-track-panel) (object sox-hoaencode) posy)
210     (let ((ordertxt (om-make-dialog-item 'om-static-text
211                                      (om-make-point 28 (+ posy 248)) 
212                                      (om-make-point 65 16)
213                                      (string+ "order: " (number-to-string (order object)))
214                                      :font *om-default-font1*
215                                      )))
216       (om-add-subviews self (om-make-dialog-item 'edit-numbox
217                                                  (om-make-point 36 (+ posy 248)) 
218                                                  (om-make-point 36 18) 
219                                                  (format nil " ~2D" (order object))
220            
221                                                  :di-action (om-dialog-item-act item   
222                                                             (let ((val (value item)))
223                                                             (om-set-dialog-item-text ordertxt (format nil "order: ~1d" val))
224                                                               (setf (order object) val)
225                                                               (report-modifications (om-view-container self))))
226                              
227                                                  :value (order object)
228                                                  :font *om-default-font1*
229                                                  :incr 1
230                                                  :min-val 0 :max-val 5
231                                                  ))
232       )
233     )
234
235
236       
92c40d 237 ;%%%%%%% Editor for SOX-MIX-CONSOLE %%%%%%%%%%%%%%%
AN 238
239 (defmethod get-win-ed-size ((self sox-mix-console)) 
240   (om-make-point (+ 2 (* (+ soxconsole-trackw 2) (max 1 (min 32 (length (list! (sound self))))))) 200))
241
242 (defmethod add-pan-controls ((self sox-track-panel) (object sox-mix-console) posy)
243   (let ((pantxt (om-make-dialog-item 'om-static-text
244                                      (om-make-point 28 (+ posy 148)) 
245                                      (om-make-point 65 16)
246                                      (string+ "pan: " (number-to-string (om-round (nth (tracknum self) (panning object)) 2)))
247                                      :font *om-default-font1*
248                                      )))
249     (om-add-subviews self pantxt (om-make-view 'graphic-numbox
250                                                :position (om-make-point 40 (+ posy 124))
251                                                :size (om-make-point 26 26) 
252                                                :pict (om-load-and-store-picture "dial" 'di)
253                                                :nbpict 65
254                                                :pict-size (om-make-point 24 24)
255                                                :di-action (om-dialog-item-act item
256                                                             ; perhaps this could be made more efficient by manipulating min-val and max-val rather then as a let statement
257                                                             (let ((val (+ 1 (* (value item) 0.02))))
258                                                               (om-set-dialog-item-text pantxt (format nil "pan: ~3f" val))
259                                                               ;(om-set-dialog-item-text pantxt (string+ "pan: " (number-to-string (om-round val 2))))
260                                                               (setf (nth (tracknum self) (panning object)) val)
261                                                               (report-modifications (om-view-container self))))
262                                                :font *om-default-font2*
263                                                :value (* 50 (1- (nth (tracknum self) (panning object))))
264                                                :min-val 0
265                                                :max-val (max 10 (* 50 (1- (numchannels object))))))
266     ))
267
268
269 ;%%%%%%% Editor for SOX-REMIX %%%%%%%%%%%%%%%%%%%%%
270
271 (defclass sox-remix-editor (editorview) 
272   ((channel-panels :initform nil :accessor channel-panels :type list)))
273
274 (defclass sox-channel-panel (om-view) 
275   ((sox-object :accessor sox-object :initarg :sox-object :initform nil)
276    (panel-id :accessor panel-id :initarg :panel-id :initform nil)
277    (channel :accessor channel :initarg :channel :initform nil)
278    (gain :accessor gain :initarg :gain :initform nil)))
279
280 (defmethod get-editor-class ((self sox-remix)) 'sox-remix-editor)
281
282 (defmethod get-win-ed-size ((self sox-remix))
283   (om-make-point  (+ 2 (* 102 (max 1 (min 32 (length (channel-matrix self))))))
284                   (+ 0 (* (+ soxconsole-trackw 2) (max 1 (min 32 (or (list-max 
285                                                                       (loop for item in (channel-matrix self) collect
286                                                                             (length item))) 0)
287                                                               ))
288
289                           ))))
290
291 (defmethod initialize-instance :after ((self sox-remix-editor) &rest l)
292    (declare (ignore l))
293    (om-set-bg-color self *om-dark-gray-color*)
294    (initialize-panels self))
295
296 (defmethod initialize-panels ((self sox-remix-editor))
297   ;(if (sound (object self))
298  (om-with-delayed-redraw self
299    (when (sound (object self))
300       (setf (channel-panels self)
301             (loop for subchannellist in  (channel-matrix (object self))
302                   for subgainlist in (gain-matrix (object self))
303                   for i from 0 to (length (channel-matrix (object self))) collect ; i = y position
304                   
305                   (loop for channel in subchannellist
306                         for gain in subgainlist
307                         for j from 0 to (length subchannellist) collect ; j = x position
308                         
309                         (om-make-view 'sox-channel-panel
310                                       :channel channel ; maybe 'panel-nr' would be less ambiguous here
311                                       :gain gain
312                                       :panel-id (list i j) ; i = rows, j = columns
313                                       :sox-object (object self)
314                                       :bg-color *om-light-gray-color*
315                                       :position (om-make-point (+ 2 (* i (+ soxconsole-trackw 2))) (* j (+ soxconsole-trackw 2)))
316                                     ;(om-make-point (+ 2 (* j (+ soxconsole-trackw 2))) (* i (+ soxconsole-trackw 2)))
317                                       :size (om-make-point soxconsole-trackw 101 )) ;4 (- (h self) 205)
318                         )
319                   )
320             )
321       )
322     (loop for panel in (channel-panels self) do
323           (apply 'om-add-subviews (cons self panel)))
324
325     (let ((size (get-win-ed-size (object self))))
326       (oa::set-not-resizable (window self) (om-point-h size) (om-point-v size)))
327     )
328     ;(om-beep-msg "Please specify a sound to be processed"))
329     )
330
331 (defmethod update-editor-after-eval ((self sox-remix-editor) val)
332   (setf (object self) val)
333   (initialize-panels self))
334
335 (defmethod initialize-instance :after ((self sox-channel-panel) &rest l)
336   (let ((pos 0)
337         label
338         gaintxt)
339
340 #|
341     (setf pos (+ pos 5))
342     (om-add-subviews self (setf label (om-make-dialog-item 'om-static-text
343                                                             (om-make-point 15 pos) 
344                                                             (om-make-point soxconsole-trackw 16) ;16
345                                                             (string+ (pathname-name (sound (sox-object self)))
346                                                                      "." (pathname-type (sound (sox-object self)))
347                                                                      )
348                                                             :font *om-default-font1b*
349                                                             )))
350 |#
351
352     (setf pos (+ pos 5))
353     (om-add-subviews self (setf label (om-make-dialog-item 'om-static-text
354                                                            (om-make-point 20 pos) 
355                                                            (om-make-point soxconsole-trackw 16) ;16
356                                                            (string+ "Channel-" (number-to-string (channel self)))
357                                                            :font *om-default-font1b*
358                                                            )))
359
360     (setf pos (+ pos 30))
361     (om-add-subviews self (om-make-view 'graphic-numbox 
362                                         :position (om-make-point 35 pos) 
363                                         :size (om-make-point 35 35)
364                                         :pict (om-load-and-store-picture "dial" 'di)
365                                         :nbpict 65
366                                         :pict-size (om-make-point 24 24)
367                                         :di-action (om-dialog-item-act item
368                                                      (om-set-dialog-item-text gaintxt 
369                                                                                       ;(format nil "  dB: ~4f" (* (- (value item) 240) 0.25)))
370                                                                               (string+ "  dB: " (number-to-string (om-round (* (value item) 0.5) 2))))
371                                                      (setf (nth (second (panel-id self)) (nth (first (panel-id self)) (gain-matrix (sox-object self)))) (* (value item) 0.5))
372                                                      (report-modifications (om-view-container self)))
373                                         :font *om-default-font2*
374                                         :value (* (gain self) 2)
375                                         :min-val -72
376                                         :max-val 72
377                                         ))
378
379     (om-add-subviews self (setf gaintxt (om-make-dialog-item 'om-static-text
380                                                              (om-make-point 20 80) ;(+ pos 99)
381                                                              (om-make-point 70 16)
382                                                              (format nil "  dB: ~4f" (gain self))
383                                                              :font *om-default-font1*
384                                                              )))
385     
386     ))
387
388
389
390 ;%%%%%%% Editor for SOX-SPLIT %%%%%%%%%%%%%%%%%%%%%%
391
392 (defclass sox-split-console-editor (editorview) 
393   ((track-panels :initform nil :accessor track-panels :type list)))
394
395 (defclass sox-split-panel (om-view) 
396   ((sox-object :accessor sox-object :initarg :sox-object :initform nil)
397    (panel-id :accessor panel-id :initarg :panel-id :initform nil)
398    (channel :accessor channel :initarg :channel :initform nil)
399    (gain :accessor gain :initarg :gain :initform nil)))
400
401 (defmethod get-editor-class ((self sox-split)) 'sox-split-console-editor)
402
403 (defmethod get-win-ed-size ((self sox-split)) 
404   (om-make-point (+ 2 (* (+ soxconsole-trackw 2) (max 1 (min 32 (length (channels self)))))) 150))
405
406 (defmethod initialize-instance :after ((self sox-split-console-editor) &rest l)
407    (declare (ignore l))
408    (om-set-bg-color self *om-dark-gray-color*)
409    (when (sound (object self))
410    (initialize-panels self)))
411
412 (defmethod initialize-panels ((self sox-split-console-editor))
413   (om-with-delayed-redraw self
414     (setf (track-panels self)
415           (loop for channel in (channels (object self)) 
416                 for gain in (gains (object self)) 
417                 for i from 0 to (- (length (channels (object self))) 1) collect       
418                 (om-make-view 'sox-split-panel
419                               :channel channel ; maybe 'panel-nr' would be less ambiguous here
420                               :gain gain
421                               :panel-id i ; i = rows, j = columns
422                               :sox-object (object self)
423                               :bg-color *om-light-gray-color*
424                               :position (om-make-point (+ 2 (* i (+ soxconsole-trackw 2))) 2)
425                                     ;(om-make-point (+ 2 (* j (+ soxconsole-trackw 2))) (* i (+ soxconsole-trackw 2)))
426                               :size (om-make-point soxconsole-trackw (- (h self) 4) )) ;4 (- (h self) 205)
427                 ))
428     (apply 'om-add-subviews (cons self (track-panels self)))
429     (let ((size (get-win-ed-size (object self))))
430       (oa::set-not-resizable (window self) (om-point-h size) (om-point-v size))) 
431     ))
432
433 (defmethod initialize-instance :after ((self sox-split-panel) &rest l)
434   (let ((pos 0) pantxt gaintxt)
435
436     (setf pos (+ pos 5))
437     (om-add-subviews self (setf label (om-make-dialog-item 'om-static-text
438                                                             (om-make-point 20 pos) 
439                                                             (om-make-point soxconsole-trackw 16) ;16
440                                                             (string+ "Channel-" (number-to-string (channel self)))
441                                                             :font *om-default-font1b*
442                                                             )))
443
444     (setf pos (+ pos 25))    
445     (om-add-subviews self (om-make-view 'graphic-numbox 
446                                         :position (om-make-point 30 pos) 
447                                         :size (om-make-point 45 100)
448                                         :pict (om-load-and-store-picture "fader" 'di)
449                                         :nbpict 77
450                                         :pict-size (om-make-point 31 94)
451                                         :di-action (om-dialog-item-act item
452                                                             (om-set-dialog-item-text gaintxt 
453                                                                                      (format nil "  dB: ~4f" (* (- (value item) 120) 0.5)))
454                                                             (setf (nth (panel-id self) (gains (sox-object self))) (* (- (value item) 120) 0.5))
455                                                             (report-modifications (om-view-container self)))
456                                         :font *om-default-font2*
457                                         :value (+ (* (nth (panel-id self) (gains (sox-object self))) 2) 120)
458                                         :min-val 0
459                                         :max-val 132
460                      ))
461
462         (om-add-subviews self (setf gaintxt (om-make-dialog-item 'om-static-text
463                                              (om-make-point 20 (+ pos 99))
464                                              (om-make-point 60 16)
465                                              (format nil "  dB: ~4f" (nth (panel-id self) (gains (sox-object self))))
466                                              :font *om-default-font1*
467                                              )))
468     ))
469
470
471 ;###########################
472 ;; the editor for SOX-RECORD
473
474 (defmethod class-has-editor-p ((self sox-record)) t); not a subclass of sox-input
475
476 (defclass sox-record-console-editor (editorview) 
477   ((track-panels :initform nil :accessor track-panels :type list)))
478
479 (defclass sox-record-channel-panel (om-view) 
480   ((sox-object :accessor sox-object :initarg :sox-object :initform nil)
481    (panel-id :accessor panel-id :initarg :panel-id :initform nil)
482    (channel :accessor channel :initarg :channel :initform nil)
483    (gain :accessor gain :initarg :gain :initform nil)))
484
485 (defmethod get-editor-class ((self sox-record)) 'sox-record-console-editor)
486
487 (defmethod get-win-ed-size ((self sox-record)) 
488   (om-make-point (+ 2 (* (+ soxconsole-trackw 2) (max 1 (min 32 (length (list! (gains self))))))) 100))
489
490 (defmethod initialize-instance :after ((self sox-record-console-editor) &rest l)
491    (declare (ignore l))
492    (om-set-bg-color self *om-dark-gray-color*)
493    (initialize-panels self))
494
495 (defmethod initialize-panels ((self sox-record-console-editor))
496   (om-with-delayed-redraw self
497     (setf (track-panels self)
498           (loop for channel in (channels (object self)) 
499                 for gain in (gains (object self)) 
500                 for i from 0 to (- (length (channels (object self))) 1) collect       
501                 (om-make-view 'sox-record-channel-panel
502                               :channel channel ; maybe 'panel-nr' would be less ambiguous here
503                               :gain gain
504                               :panel-id i ; i = rows, j = columns
505                               :sox-object (object self)
506                               :bg-color *om-light-gray-color*
507                               :position (om-make-point (+ 2 (* i (+ soxconsole-trackw 2))) 2)
508                                     ;(om-make-point (+ 2 (* j (+ soxconsole-trackw 2))) (* i (+ soxconsole-trackw 2)))
509                               :size (om-make-point soxconsole-trackw (- (h self) 4) )) ;4 (- (h self) 205)
510                 ))
511     (apply 'om-add-subviews (cons self (track-panels self)))
512     (let ((size (get-win-ed-size (object self))))
513       (oa::set-not-resizable (window self) (om-point-h size) (om-point-v size))) 
514     ))
515
516 (defmethod initialize-instance :after ((self sox-record-channel-panel) &rest l)
517   (let ((pos 0)
518         label
519         gaintxt)
520
521     (setf pos (+ pos 5))
522     (om-add-subviews self (setf label (om-make-dialog-item 'om-static-text
523                                                            (om-make-point 20 pos) 
524                                                            (om-make-point soxconsole-trackw 16) ;16
525                                                            (string+ "Channel-" (number-to-string (channel self)))
526                                                            :font *om-default-font1b*
527                                                            )))
528
529     (setf pos (+ pos 30))
530     (om-add-subviews self (om-make-view 'graphic-numbox 
531                                         :position (om-make-point 35 pos) 
532                                         :size (om-make-point 35 35)
533                                         :pict (om-load-and-store-picture "dial" 'di)
534                                         :nbpict 65
535                                         :pict-size (om-make-point 24 24)
536                                         :di-action (om-dialog-item-act item
537                                                      (om-set-dialog-item-text gaintxt 
538                                                                                       ;(format nil "  dB: ~4f" (* (- (value item) 240) 0.25)))
539                                                                               (string+ "  dB: " (number-to-string (om-round (* (value item) 0.5) 2))))
540                                                      (setf (nth (panel-id self) (gains (sox-object self))) (* (value item) 0.5))
541                                                      (report-modifications (om-view-container self)))
542                                         :font *om-default-font2*
543                                         :value (* (gain self) 2)
544                                         :min-val -72
545                                         :max-val 72
546                                         ))
547
548     (om-add-subviews self (setf gaintxt (om-make-dialog-item 'om-static-text
549                                                              (om-make-point 20 80) ;(+ pos 99)
550                                                              (om-make-point 70 16)
551                                                              (format nil "  dB: ~4f" (gain self))
552                                                              :font *om-default-font1*
553                                                              )))
554     
555     ))