cc/event [ Modules ]
Name
event
File
event.lsp
Description
Events are the core of composing with comic: There slots hold properties that will be passed to render-modes to create the final piece. Property-slots can also be added to the class using (add-unit). Purpose: - Definition of the event-class - Definition associated creation and accessor functions - function for dynamically adding new slots to the class and redefining it (add-unit)
Classes
event
event/add-event-slot [ Functions ]
[ Top ] [ event ] [ Functions ]
Name
add-event-slot
File
event.lsp
Description
Adds a new unit-slot to (cc-get :event-slots) and redefines (make-event) and all accessor functions.
Arguments
slot-name: name of the new slot, a symbol list-of-types (optional, default: t): a list of type names that is checked
Return Value
t
Synopsis
(defun add-event-slot (slot-name &optional default-unit (list-of-types '(t)))
Example
;;; (add-event-slot 'dance-move (symbol string))
event/add-events [ Methods ]
Name
add-events
File
event.lsp
Description
Adds events to an event.
Arguments
event: the event to add events to events: an event or a list of events to add
Optional Arguments
id: If event is a comic and id is set, the events are added to the event with given ID.
Return Value
boolean (t if events were added, else nil)
Synopsis
(defmethod add-events ((event event) events &optional id)
Example
(add-events my-event list-of-events) --> t
event/clone [ Methods ]
Name
clone
File
event.lsp
Description
Method for cloning events (including comics). Also clones all events in the events-slot recursively.
Arguments
event: an event-object
Return Value
the clone
Example
;;; (clone my-event) --> clone-of-my-event
event/count-events [ Functions ]
[ Top ] [ event ] [ Functions ]
Name
count-events
File
event.lsp
Description
Returns the amount of subevents of an event.
Arguments
event: the event
Return Value
number
Synopsis
(defun count-events (event) "counts the number of subevents of an event."
event/doevents [ Functions ]
[ Top ] [ event ] [ Functions ]
Name
doevents
File
event.lsp
Description
Executes its body for each event in events. Also applies for all subevents recursively. Inside the body code, var is bound to the current event. The return value is t, but can conditionally be turned to nil using (return nil) in the body.
Arguments
var: variable for current event in loop-cycle events: the events, can be a list of events or a single event (or comic) loop-body (&body): The lisp-forms to execute
Return Value
t
Synopsis
(defmacro doevents ((var events) &body body)
event/event [ Classes ]
Name
event
File
event.lsp
Description
Definition of the event-class. Everything organised in time is is an event, including the entire comic, which has the event-class as its super-class.
Slots
name, id, events, duration, start-time, pitch, amplitude location, expansion, notation, text, soundfile, videofile render-modes N.B.: Slots can be added dynamically. For an up-to-date list of slot-names and value-types, run (cc-get :event-slots).
event/eventp [ Functions ]
[ Top ] [ event ] [ Functions ]
Name
eventp
File
event.lsp
Description
returns t if the specified object is an event
Arguments
obj: any object
Return Value
boolean
Example
;;; (eventp my-event) --> t
event/filter-events [ Functions ]
[ Top ] [ event ] [ Functions ]
Name
filter-events
File
event.lsp
Description
Filter events by a given predicate/function. Only if (funcall predicate e) returns t, e is returned. The function is applied on all subevents, but returnes a flat list!
Arguments
predicate rest: events
Return Value
a list of events
Synopsis
(defun filter-events (predicate &rest events)
Example
(filter-events 'pitch (make-event :pitch (hz 100)) (make-event)) --> (#<EVENT, PITCH: #<100.0 HZ>>)
event/get-dimensions [ Methods ]
Name
get-dimensions
File
event.lsp
Description
Returns the maximum amount of dimensions an event has (= length of lists in location and expansion slots). All subevents are considered.
Arguments
obj: an event
Return Value
integer
Synopsis
(defmethod get-dimensions ((obj event))
Example
(get-dimensions (event :location '(0 1 0))) --> 3
event/get-events-by-start-time [ Functions ]
[ Top ] [ event ] [ Functions ]
Name
get-events-by-start-time
File
event.lsp
Description
Returns all events with a start-time greater than or equal to time1 and lesser than or equal to time2. If time2 is not set, It will default to time1, meaning: Only events with a start-time equal to time1 will be returned. N.B.: The function goes through all subevents, but returns a flat list of all matches. As it will only look at the slot values of each single event, this can lead to unexpected behaviour when the events are not flattened.
Arguments
events: A list of events, a single event or a comic time1: First start-time to match Optional Arguments: time2: Last start-time to match
Return Value
list of events
Synopsis
(defun get-events-by-start-time (events time1 &optional time2) "return all events the start at time1 or between time1 and time2"
event/get-events-in-time-range [ Functions ]
[ Top ] [ event ] [ Functions ]
Name
get-events-in-time-range
File
event.lsp
Description
Returns all events in a given time range, even if they start earlier or last longer. N.B.: The function goes through all subevents, but returns a flat list of all matches. As it will only look at the slot values of each single event, this can lead to unexpected behaviour when the events are not flattened.
Arguments
events: A list of events, a single event or a comic t1, t2: two times, either numbers or unit-objects
Return Value
list of events
Synopsis
(defun get-events-in-time-range (t1 t2 &rest events) "Returns all events in a given time range, even if they start earlier or last longer."
event/get-total-duration [ Functions ]
[ Top ] [ event ] [ Functions ]
Name
get-total-duration
File
event.lsp
Description
Returns the total duration of an event (with subevents), a comic or a list of events.
Arguments
event: the event
Return Value
a unit object (secs)
Synopsis
(defun get-total-duration (&rest events) "determine the total duration of a comic or list of events"
event/loop-make-event [ Functions ]
[ Top ] [ event ] [ Functions ]
Name
loop-make-event
File
event.lsp
Description
Creates multiple events and returns them in a list. The clauses of the loop-macro can be used like this: :pitch from 0 to 10 :duration in '(1 2 3), etc. Static values can also be supplied (:pitch (hz 100)). The loop terminates when the first of its clauses is finished (as usually). N.B.: This function can not yet handle unit-objects as values in event-slots!
Arguments
&body keywords-and-forms
Return Value
list of events
Synopsis
(defmacro loop-make-event (&body keywords-and-forms) "Some sugar around loop for creating lots of comic-events"
Example
#| (loop-make-event :duration from 1 to 3) -> ([EVENT, dur: 1] [EVENT, dur: 2] [EVENT, dur: 3]) (loop-make-event :duration in '(1 2 3)) -> ([EVENT, dur: 1] [EVENT, dur: 2] [EVENT, dur: 3]) (loop-make-event :duration in '(1 2 3) :pitch to 1000) -> ([EVENT, pitch: 0, dur: 1] [EVENT, pitch: 1, dur: 2] [EVENT, pitch: 2, dur: 3]) (loop-make-event :pitch (hz 100)) -> ([EVENT, pitch (HZ 100)]) (loop-make-event) -> ([EVENT]) |# ;;; ;;; Errors ;;; (loop-make-event :duration nil for n below 10) --> ERROR ;;; (loop-make-event for n below 10) --> ERROR
event/make-event [ Functions ]
[ Top ] [ event ] [ Functions ]
Name
make-event
File
event.lsp
Description
Creates an event. All values given for event-slots will be type-checked.
Arguments
All event-slot-names as &key-arguments. For a complete list, refere to +cc-data+ or run (cc-get :event-slots). Return value event
Example
;;; (make-event) --> <#EVENT>
event/permutate-make-event [ Functions ]
[ Top ] [ event ] [ Functions ]
Name
permutate-make-event
File
event.lsp
Description
Creates multiple events and returns them in a list. For all arguments in lists, it iterates over the items in that list to create all possible permutations of the given values.
Arguments
&body keywords-and-forms
Return Value
list of events
Synopsis
(defun permutate-make-event (&rest args) "takes list-values for key-args to make-event and outputs a list of all possible permutations of events with given values."
Example
#| (loop-permutate-event :duration '(1 2 3) :start-time '(5 4 5)) -> ([EVENT, START-TIME: 5, DURATION: 1] [EVENT, START-TIME: 5, DURATION: 2] [EVENT, START-TIME: 5, DURATION: 3] [EVENT, START-TIME: 4, DURATION: 1] [EVENT, START-TIME: 4, DURATION: 2] [EVENT, START-TIME: 4, DURATION: 3] [EVENT, START-TIME: 5, DURATION: 1] [EVENT, START-TIME: 5, DURATION: 2] [EVENT, START-TIME: 5, DURATION: 3])
event/print-events [ Functions ]
[ Top ] [ event ] [ Functions ]
Name
print-events
File
event.lsp
Description
Prints a complete list of event and all subevents.
Arguments
event
Optional Arguments
stream: The stream to print to. (default: t) Return value nil
Synopsis
(defun print-events (event &optional (stream t))
event/set-dimensions [ Methods ]
Name
set-dimensions
File
event.lsp
Description
Sets the amount of dimensions of an event and all subevents (= cuts the length of lists in location and expansion or fills it with 0s).
Arguments
obj: a placed-object
Return Value
integer
Synopsis
(defmethod set-dimensions ((obj event) dimensions)
Example
(set-dimensions (event :location '(0 1 0)) 2) --> location: '(0 1) (set-dimensions (event :location '(0 1 0)) 4) --> location: '(0 1 0 0)
event/value [ Methods ]
Name
event
File
event.lsp
Description
Accesses the value of a unit-object stored in the slot of an event and returns it, converted to the specified unit.
Arguments
object: The object unit: unit to convert to. error is signaled if conversion fails. unit-name: The name of the unit to access. Only used object is an event
Synopsis
(defmethod value ((object event) &optional unit slot-name)
Example
(value (make-event :pitch (midinote 60)) 'hz 'pitch) -> 261.62555