Contents
. 2. Midithing Objects
.. 2.1. IO  
 
 
Next 2.1.2. IO.Sync

2.1.1. IO.Clock

The Clock object is a fixed property of the IO object and is automatically created when you ask for an IO object. A Clock does not do more than periodically send a pulse to the IO's sync which in turn will drive it's Song's to play their Events through the IO object.

At its creation, the Clock object will first try to become root to use Linux' real time clock chip driver, if this option was compiled in. The RTC provides the most accurate source of a high-frequency pulse. If the RTC cannot be obtained, the Clock will use the poll(2) system call as a timing source.

NB: Some distribution kernels seem to have support for /dev/rtc compiled in, but don't generate the device file. If yours is missing it, try

# mknod /dev/rtc c 10 135

before resorting to rolling a new kernel. It is however advisable to build a custom kernel using patches that reduce scheduling latency to obtain the best timing accuracy. You'll find more information on this subject on http://www2.linuxaudiodev.org/audio/lad/.

See also IO

Methods

set_resolution (hz)

sets the resolution of the clock in Hz.

There are some things to be aware of when changing the Clock's resolution.
If you are using the RTC (RealTime Clock chip driver) provided by Linux on Alpha and i386, the resolution must be an integer power of two, up to 8192. Frequencies above 64 Hz are accessible only if midithing is run as root.
If you use the standard (non-RTC) clock, it will make no sense to set the resolution to a value larger than the kernel scheduler's HZ, which in Linux/i386 is 100.

start()

starts the clock. The clock is normally running from the moment on it is created.

stop()

stops the clock.

Properties

running

Type: int
Default: 1

This property is read only.

Next is IO.Sync

midithing 0.3.22 documentation © Tim Goetze Nov. 06 2001