1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-01-12 07:35: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)))

View File

@@ -1,7 +1,7 @@
;nyquist plug-in
;version 3
;version 4
;type process
;preview enabled
;preview linear
;categories "http://lv2plug.in/ns/lv2core#HighpassPlugin"
;name "High Pass Filter..."
;action "Performing High Pass Filter..."
@@ -10,7 +10,7 @@
;; highpass.ny by Dominic Mazzoni
;; Modified by David R. Sky
;; Updated by Steve Daulton June 2012
;; Updated by Steve Daulton June 2012, 2015.
;; Released under terms of the GNU General Public License version 2:
;; http://www.gnu.org/licenses/old-licenses/gpl-2.0.html .
@@ -20,6 +20,7 @@
;;control q "Filter quality (Q) for 12 dB rolloff" real "" 0.7071 .1 20
;control frequency "Cutoff frequency (Hz)" real "" 1000 1 20000
(cond
((> frequency (/ *sound-srate* 2))
(format nil
@@ -35,4 +36,4 @@
(T
(funcall
(nth rolloff '(hp highpass2 highpass4 highpass6 highpass8))
s frequency)))
*track* frequency)))

View File

@@ -1,7 +1,7 @@
;nyquist plug-in
;version 3
;version 4
;type process
;preview enabled
;preview linear
;categories "http://lv2plug.in/ns/lv2core#LowpassPlugin"
;name "Low Pass Filter..."
;action "Performing Low Pass Filter..."
@@ -35,4 +35,4 @@
(T
(funcall
(nth rolloff '(lp lowpass2 lowpass4 lowpass6 lowpass8))
s frequency)))
*track* frequency)))