1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-01-14 00:25:51 +01:00

Update to non-real-time preview.

Fixes and updates on top of some code clean-up from Leland.
This commit is contained in:
Steve Daulton
2015-05-28 17:31:07 +01:00
parent ebb6709966
commit 5378b0a951
6 changed files with 108 additions and 71 deletions

View File

@@ -1,6 +1,8 @@
;nyquist plug-in
;version 3
;version 4
;type process
;preview linear
;preview selection
;categories "http://lv2plug.in/ns/lv2core#MixerPlugin"
;name "Adjustable Fade..."
;action "Applying Fade..."
@@ -22,6 +24,19 @@
;control preset " Handy Presets\n(override controls)" choice "None Selected,Linear In,Linear Out,Exponential In,Exponential Out,Logarithmic In,Logarithmic Out,Rounded In,Rounded Out,Cosine In,Cosine Out,S-Curve In,S-Curve Out" 0
(defun get-input (sig)
"When previewing, we only need to process preview length."
(if (get '*track* 'view) ;NIL if preview
sig
(multichan-expand #'trim-input sig)))
(defun trim-input (sig)
"Trim input when previewing."
(let ((dur (min (get-duration 1)
(get '*project* 'preview-duration))))
(setf sig (extract-abs 0 dur *track*))))
(setq err "")
; bad things may happen outside of the slider range.
(setq curve (min 1 (max -1 (/ curve 100.0))))
@@ -57,7 +72,7 @@
;;; select and apply fade
(defun fade (sig type curve g0 g1)
(mult sig
(mult (get-input sig)
(case preset
(0 (case type ; Custom fade
(0 (simple (min g0 g1) (max g0 g1) curve))
@@ -180,5 +195,5 @@
(check-values gain0 gain1)
(setf err (format nil "~a" (invalid-string gain0 gain1))))
(if (= (length err) 0)
(fade s type curve gain0 gain1)
(fade *track* type curve gain0 gain1)
(format nil "Error.~%~a." err)))