DSSetClock

Sets the DataStreamer clock.

Synopsis

int32 DSSetClock (DSStreamCBPtr streamCBPtr, uint32 newStreamClock)

Description

Sets the DataStreamer clock to the specified time. Clock time is measured relative to the start of a stream. DSSetClock() sets the clock by resetting the DataStreamer clock offset to the specified value.

DSSetClock() also sets to TRUE the STRM_CLOCK_VALID and STRM_CLOCK_WAS_VALID flags of the streamFlags field in the stream context block of the specified stream. These flags indicate, respectively, that the current clock time is correct and that the clock has been set at least once since the stream was opened or since the last time it was stopped.

Clock time in the DataStreamer is measured in standard Portfolio audio clock ticks (the DataStreamer does not change the rate of the audio clock or the duration of audio ticks). Since the DataStreamer does not own the audio clock, however, external tasks can affect the DataStreamer clock by altering the state of the audio clock. (By default, the audio clock is set to 240 ticks per second.)

Since the DataStreamer and acquisition threads determine stream positioning and data flushing by the DataStreamer clock, resetting the clock can affect the loading of streamed data chunks adversely. The DataStreamer clock is normally reset only when a new stream is opened. Streams can be started and stopped without requiring the DataStreamer clock to be reset (see DSStartStream() and DSStopStream()).

Arguments

streamCBPtr
Pointer to the stream context block.
newStreamClock
New clock time, measured relative to the start of the stream specified by streamCBPtr.

Return Value

Value
Error Condition
kDSNoErr
None
kDSNotRunning
Stream not running

Associated Files

DataStreamLib.h

See Also

DSGetClock, DSStartStream, DSStopStream, OwnAudioClock