Skip to content

Commit

Permalink
get-sndfiles can now insist on a list of 'or' patterns rather than ju…
Browse files Browse the repository at this point in the history
…st 'all'
  • Loading branch information
Michael Edwards committed Jul 1, 2024
1 parent 1ff8b99 commit deefbeb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
13 changes: 10 additions & 3 deletions src/sndfile-palette.lsp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
;;;
;;; Creation date: 18th March 2001
;;;
;;; $$ Last modified: 12:25:25 Thu Mar 21 2024 CET
;;; $$ Last modified: 17:10:00 Sat Jun 29 2024 CEST
;;;
;;; SVN ID: $Id$
;;;
Expand Down Expand Up @@ -1062,7 +1062,9 @@ SNDFILE: path: /music/hyperboles/snd/cello/samples/1/g4-III-4-004.aif,
;;; - A single pattern (string) or list of patterns that the sound
;;; file name must have--just the filename, excluding path/folders and
;;; extension. If a list then all patterns must be in the file name, not
;;; just one of them. Default = NIL.
;;; just one of them, unless (hack alert!) the first element of the list is
;;; the symbol or, in which case only one of the patterns must be
;;; present. Default = NIL.
;;; - Sim. to :insist except this/these are patterns none of which can
;;; be in the file name. Default = NIL.
;;;
Expand Down Expand Up @@ -1096,7 +1098,12 @@ SNDFILE: path: /music/hyperboles/snd/cello/samples/1/g4-III-4-004.aif,
"aif\"" "wav\"" "aiff\""
"snd\"")
:test #'string=)
(seq-has-all insist name)
;; MDE Sat Jun 29 17:08:17 2024, Heidhausen -- this is a bit
;; of a hack but I don't want to destroy existing
;; functionality and it is somehow fitting
(if (eq (first insist) 'or)
(seq-has-some (rest insist) name)
(seq-has-all insist name))
(seq-has-none resist name))
collect file))

Expand Down
8 changes: 7 additions & 1 deletion src/utilities.lsp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
;;;
;;; Creation date: June 24th 2002
;;;
;;; $$ Last modified: 16:16:48 Thu Mar 21 2024 CET
;;; $$ Last modified: 17:01:31 Sat Jun 29 2024 CEST
;;;
;;; ****
;;; Licence: Copyright (c) 2010 Michael Edwards
Expand Down Expand Up @@ -5657,6 +5657,12 @@ RETURNS:
(incf count))
finally (return (= count (length patterns)))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun seq-has-some (patterns sequence)
(loop for p in patterns do
(when (search p sequence)
(return t))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; MDE Thu Oct 1 16:29:34 2015 -- T or NIL depending on whether sequence has
;;; _any_ of the patterns.
Expand Down

0 comments on commit deefbeb

Please sign in to comment.