cc/main [ Modules ]

[ Top ] [ Modules ]

Name

 cc

File

 all.lsp

Description

 The main and entry module, responsible for:
 - Definition of the comic-package
 - Definition of globals
 - Configuration, error, warn and test functions
 - Loading modules

Classes

 named-object
 timed-object
 placed-object

main/+cc-data+ [ Variables ]

[ Top ] [ main ] [ Variables ]

Name

 +cc-data+

File

 all.lisp

Description

 +cc-data+ holds an association list with all global information
 needed in comic. Data can be accessed using cc-get and set
 using cc-set. However, this should usually not be necassary to
 do by hand.

 Default keys:
 :event-slots -> all slots an event-object has. Can be extended
                 using (add-event-slot)
 :output-types -> different types of output (:sound, :video, etc.)
 :render-modes -> a list of all available render-modes. modes are
                  automatically added when created using
                  make-render-mode.
 :protagonists -> a list of all available protagonists. objects
                    are automatically added when created using
                    make-protagonist.
 :superheros -> a list of all available supereros, objects are
                automatically addrd when created using
                make-superhero
 :current-project-name -> name of current project. can be set
                          manually and will be set to comic-name
                          during render.
 :external-program-call -> function for calling external programs
                           (default: #'sb-ext:run-program)
 :current-mix (used internally only)
 :external-software -> list of external software names and paths.
                       software can be added using add-software-path
 :output-dir -> output directory, default: "/tmp/"
 :tmp-dir -> directory for storing temporary files,
             default: "/tmp/"
 :src-dir -> source-directory, automatically set when loading

Synopsis

(defparameter +cc-data+
  ;; available output-types and their default file-formats:
  `((:preferences (:render-mode-files nil)
                  (:software-paths nil)
                  (:output-dir . "/tmp/")
                  (:tmp-dir . "/tmp/")
                  (:external-program-call . sb-ext:run-program))
    (:output-types . (:sound)) ; (mix) depends on :clm
    ;; all defined render-modes will be collected here:
    (:render-modes . nil)
    ;; all defined protagonists will be collected here:
    (:protagonists . nil)
    ;; all defined superheros will be collected here:
    (:superheros . nil)
    ;; all available event-slots
    (:event-slots . ((name symbol)
                     (id number)
                     (start-time numeric-unit (number secs))
                     (duration numeric-unit (number secs))
                     (render-modes list render-mode symbol)
                     (pitch numeric-unit (number hz))
                     (amplitude numeric-unit
                                (number amp)
                                dynamic-symbol
                                (symbol dynamic-symbol))
                     (location number list)
                     (expansion number list)
                     (text string unit)
                     (soundfile soundfile string)
                     (videofile videofile string)
                     (events event list)))
    ;; name of current comic during render:
    (:current-project-name . nil)
    ;; implementation-based call for running external programs,
    ;; default for sbcl
    (:external-program-call . #'sb-ext:run-program)
    ;; list of internal names and
    ;; filespecs for external program calls:
    (:external-software . ((open . "/usr/bin/xdg-open")))
    ;; the default output directory:
    (:output-dir . "/tmp/")
    ;; the default output directory for temporary files:
    (:tmp-dir . "/tmp/")
    ;; A place, where temporary files are collected.
    ;; Render will delete all current tmp-files
    (:temporary-files . nil)
    ;; The source-directory:
    (:src-dir . ,(namestring
                  (truename 
                   (directory-namestring (or *load-truename* "./")))))
    ;; shared setting for various processes whether to print detailed
    ;; or only basic information to std-out.
    (:verbose . nil)))

main/add-software-path [ Functions ]

[ Top ] [ main ] [ Functions ]

Name

 add-software-path

File

 all.lsp

Description

 Add an external software path to Comic. It will be stored in 
 +cc-data+ and is accessible via its name (a symbol). Using
 (run), a software can be called directly by that symbol, e.g. 
 when writing a render-mode.

 When setting up Comic, it is required to call this function
 for every program that is a dependency of a render-mode that
 one wants to use. It is not necassary to get every available
 render-mode up and running in order to use Comic, so the paths
 to add will be different for each individual project. The 
 render-function will signal an error when any dependency of 
 a render-mode given is not available.

Arguments

 name: A symbol, the name of the program.
 path: An absolute path to the software. On a unix system, the
       path to a program can be found using the whereis-command.

Return Value

 boolean, indicating whether the specified path is a file.
 The function will not test if the program works properly or if
 it is executable at all.

Synopsis

(defun add-software-path (name path)

Example

(add-software-path 'ffmpeg "/usr/bin/ffmpeg")

main/cc-get [ Functions ]

[ Top ] [ main ] [ Functions ]

Name

 cc-get

File

 all.lsp

Description

 Access global data stored in +cc-data+. For a list of possible
 keys see documentation of +cc-data+.

Arguments

 key: The key to look for in +cc-data+

Return Value

 Any data

Example

(cc-get :src-dir) --> "/home/simon/comic/"

main/cc-push [ Functions ]

[ Top ] [ main ] [ Functions ]

Name

 cc-set

File

 all.lsp

Description

 Modify global data stored in +cc-data+. For a list of possible
 keys see documentation of +cc-data+.

 This function is a syntactic sugar, build upon cc-set and
 cc-get. Assuming that the value of a given key is a list
 (or nil), the new value will be pushed into the list. 

Arguments

 value: The new value to push into the list.
 key: The key to look for in +cc-data+

Return Value

 The new value

Example

(cc-set :src-dir "/home/simon/comic/") --> "/home/simon/comic/"

main/cc-reload [ Functions ]

[ Top ] [ main ] [ Functions ]

Name

 cc-reload

File

 all.lsp

Description

 Reload the comic-package. Can be usefull to reset everything
 without heaving to restart lisp.

Arguments

 None

Return Value

 t

main/cc-set [ Functions ]

[ Top ] [ main ] [ Functions ]

Name

 cc-set

File

 all.lsp

Description

 Modify global data stored in +cc-data+. For a list of possible
 keys see documentation of +cc-data+.

Arguments

 key: The key to look for in +cc-data+

Return Value

 The modified value associated with the given key.

Example

(cc-set :src-dir "/home/simon/comic/") --> "/home/simon/comic/"

main/load-comic [ Functions ]

[ Top ] [ main ] [ Functions ]

Name

 load-comic

File

 load.lsp

Description

 Loads the main part of comic after checking all external
 software. The standard way to load comic is:
 (load "/path-to-comic-src/all.lsp")
 (in-package :comic)
 (load-comic OPTIONS)

 All dependencies (lisp-packages and external software) must be
 loaded before calling load-comic. The all.lsp file may be loaded
 at anytime during the load-process.

 It is necessary to load comic in two steps in order to make sure
 that only the functionality is loaded that can be used with the
 given dependencies. Without any external software, most
 render-modes will not be loaded!

Synopsis

(defun cc-soft-reload ()

Example

(load-comic :path-to-ffmpeg "path/to/ffmpeg")

main/when-verbose [ Functions ]

[ Top ] [ main ] [ Functions ]

Name

 when-verbose

File

 all.lsp

Description

 Check if :verbose is set to t in +cc-data+. If so, return t,
 else nil. If a string-to-print is given, print it to std-out.

Optional Arguments

 - string-to-print
 - format arguments: Arguments used in string-to-print in a
   format-manner

Return Value

 boolen

Synopsis

(defun when-verbose (&optional string-to-print
                     &rest format-arguments)