Skip to content

Commit

Permalink
get-sound-info now issues a warning if it would return a list of nils
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Edwards committed Jun 24, 2024
1 parent 289b2a2 commit f517b96
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
5 changes: 2 additions & 3 deletions src/reaper.lsp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
;;;
;;; Creation date: January 21st 2021
;;;
;;; $$ Last modified: 15:40:59 Sat Jun 22 2024 CEST
;;; $$ Last modified: 16:18:41 Sat Jun 22 2024 CEST
;;;
;;; SVN ID: $Id: sclist.lsp 963 2010-04-08 20:58:32Z medward2 $
;;;
Expand Down Expand Up @@ -91,8 +91,7 @@
;; make-reaper-file then before writing they'll be separated into tracks and
;; written into those. This can be any string though of course it makes sense
;; to put more than one item on a single track
(track :accessor track :type string :initarg :track
:initform "reaper-lisp")
(track :accessor track :type string :initarg :track :initform "reaper-lisp")
;; MDE Tue Nov 28 14:16:25 2023, Heidhausen --
;; this is the volume defined with the slider in media item properties
(slider-vol :accessor slider-vol :type number :initarg :slider-vol
Expand Down
35 changes: 22 additions & 13 deletions src/sndfile.lsp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
;;;
;;; Creation date: March 21st 2001
;;;
;;; $$ Last modified: 15:36:40 Sat Jun 22 2024 CEST
;;; $$ Last modified: 10:02:08 Mon Jun 24 2024 CEST
;;;
;;; ****
;;; Licence: Copyright (c) 2010 Michael Edwards
Expand Down Expand Up @@ -746,18 +746,27 @@ data: /path/to/sndfile-1.aiff
(clm::sound-length filename)
(clm::sound-framples filename))
#+ffprobe
(parse-ffprobe-string
(shell-to-string
(if (stringp ffprobe)
ffprobe
(get-sc-config 'ffprobe-command))
"-v" "quiet"
"-show_entries" "format=duration,size"
"-show_entries"
"stream=sample_rate,channels,r_frame_rate,width,height"
"-show_entries" "stream=bits_per_sample,codec_name"
"-of" "default=noprint_wrappers=1:nokey=0"
filename))
(let ((info (parse-ffprobe-string
(shell-to-string
(if (stringp ffprobe)
ffprobe
(get-sc-config 'ffprobe-command))
"-v" "quiet"
"-show_entries" "format=duration,size"
"-show_entries"
"stream=sample_rate,channels,r_frame_rate,width,height"
"-show_entries" "stream=bits_per_sample,codec_name"
"-of" "default=noprint_wrappers=1:nokey=0"
filename))))
;; MDE Mon Jun 24 09:53:45 2024, Heidhausen -- warn if not found or
;; not parsed, e.g. an existing file sometimes results in a list of
;; nils if the path starts with "~" on macos :/
(when (or (not info) (every #'not info))
(setq info nil)
(warn "sndfile::get-sound-info: ~a~%can't be parsed: maybe ~
the path isn't working ~%(e.g. begins with \"~~/\" on macos)"
filename))
info)
#-ffprobe
(error "sndfile::get-sound-info: this command needs ffprobe, ~%i.e. ~
the ffprobe-command defined in globals.lsp needs to exist ~%~
Expand Down

0 comments on commit f517b96

Please sign in to comment.