Hello again Karim, sorry for a lot of questions!
Can you help me understand how to put external folders in OM6?
I want a variable path like outpath or infiles.
Thank you again!
Hello again Karim, sorry for a lot of questions!
Can you help me understand how to put external folders in OM6?
I want a variable path like outpath or infiles.
Thank you again!
Hi Charles,
If I understand you well, you need to define an extra Path to use in OM beside the Outfiles and Infiles Path. You can always define a temp folder in the preferences. But i might not get your question right. Can you be more specific?
Best
K
Yes,
I want to use a library of samples, so I am doing a lot of objects that read these samples through the midicents. This is the code!
(lambda (note)
(probe-file
(string+ SAMPLES-FOLDER “01 Flute/key-click/” “Fl-key-cl-” (ckn-mc->n note) “-f” “.aif”)))
I need to put in the OM external a way to define the path of the SAMPLES-FOLDER. I do not want to use the outfile because it will mess up my samples archives.
But when I use this code (of omlily). I am not able to define a folder path, I just can define a file path. Can you understand?
(defvar SAMPLES-FOLDER “path to Ircam instruments folder”)
(pushr 'ircam-instruments external-prefs)
(defmethod get-external-name ((module (eql 'ircam-instruments))) “Ircam Instruments”)
(defmethod get-external-module-path ((module (eql 'ircam-instruments)) modulepref) (get-pref modulepref :ircam-instruments))
(defmethod set-external-module-path ((module (eql 'ircam-instruments)) modulepref path)
(set-pref modulepref :ircam-instruments path))
(defmethod save-external-prefs ((module (eql 'ircam-instruments)))
`(:ircam-instruments ,(om-save-pathname (namestring SAMPLES-FOLDER))))
(defmethod put-external-preferences ((module (eql 'ircam-instruments)) moduleprefs)
(when (get-pref moduleprefs :ircam-instruments) (setf SAMPLES-FOLDER (find-true-external (get-pref moduleprefs :ircam-instruments)))) t)
Dear Charles,
I don’t think this is a good idea. Externals are for external binaries, not folders. If you need to define a wild folder to reference, why don’t you use simply the in-directory method:
You can choose any folder, and this will return the folder’s path…
Now if you are “designing” a library (as i suspect ) you should model your extra-preferences panel as with the default om folders (/code/kernel/graphics/default-prefs.lisp)
Best
K
PS in your code above, your should use :
external-prefs and not external-prefs (i imagine it is a copy paste issue in Discourse
… yo will find the in-directory code here:
(defmethod! in-directory (&key (unix nil) (recursive nil))
:icon '(250)
:indoc '(“unix format”)
:doc “Returns a directory pathname.
Opens a dialog window to choose the directory.
If is T then the output files is formatted for Unix and system commands.”
(let ((path
(if recursive
(recurse-dirs (om-choose-directory-dialog))
(om-choose-directory-dialog))))
(if unix
(namestring path)
path)))
From M. Schumacher’s OM-Sox library.
Great!
I did not know this function, sometimes the more simple functions!
Thank you for your help!