[Impromptu] callback to schedule

David Smith smithd at roughlight.com
Sun Jan 3 05:08:13 GMT 2010


Hi Andrew,

It might be better to provide means for a scheduler based on a linked  
list rather than just changing "callback" to "schedule".
I'm sure I am not the only one who may benefit from this structure  
type and that you are familiar with this, but I will describe it for  
general perusal:

A linked list is a list wherein each element consists of a pointer to  
the previous element, the content, and a pointer to the next element.
Respective pointers in the first and last elements are null.

An example using vectors as content:
(define event-list
              (llist #(rtime channel pitch volume)
                       #(rtime channel pitch volume)
                       #(rtime channel pitch volume)))
or maybe:
(define event-list
              (llist #(rtime channel pitch volume duration)
                       #(rtime channel pitch volume duration)
                       #(rtime channel pitch volume duration)))

The indexes could be hidden as they are not really human readable and  
change with memory allocation.
The advantage, besides access speed, is that contiguous groups of  
elements can be handled more or less wholesale.

It's much like a Touring machine in that elements  are accessed  
through four functions:
          (event-list first) (event-list next) (event-list previous) 
(event-list last) (event-list current).
"Previous" and "next" change the "current" pointer and are used to  
traverse the llist in addition to returning the contents.
The llist is edited through four more functions (insert-after)  
(insert-before) and (delete-next) and (delete-previous).

(event-list first) (event-list current) and (event-list last) would  
need to be state variables set when the llist is defined
and changed automatically when the list is appended or truncated at  
either end.

The delete functions reference (event-current) which is set to (event- 
first) when the llist is defined.
There is no (delete current) function since it would void the current  
pointer, a state variable.
I suppose any delete function would need to return an error if the  
element is "current" .

I realize implementing this would be non-trivial  :  )
but it  would facilitate large flexible schedules, and allow writing  
a really nice midi editor for example.

Happy solstice everyone!
Dave



On Dec 28, 2009, at 11:32 PM, Andrew Sorensen wrote:

> I'm thinking of changing the symbol name callback to schedule?
>
> callback will still work as an alias but documentation would start
> using schedule
>
> Any thoughts?
> Got a better name?
> Good idea, bad idea, don't care?
> _______________________________________________
> Impromptu mailing list
> Impromptu at lists.moso.com.au
> http://lists.moso.com.au/mailman/listinfo/impromptu



More information about the Impromptu mailing list