What's New in QuickTime 5

| Previous | Chapter Contents | Chapter Top | Next |

Sound Output Latency API

The following selector for the SoundComponentGetInfo function is used by QuickTime to retrieve the sound latency:

siOutputLatency (SoundComponentGetInfo)

Retrieves the audio latency from the specified sound output component.

#define siOutputLatency `olte'
siOutputLatency
Gets the audio latency from the Sound Output Component. The infoPtr parameter points to a time record.

DISCUSSION

The following code snippet shows an example implementation of this selector:

static pascal ComponentResult mySoundGetInfo(SoundComponentGlobalsPtr globals, SoundSource
                     sourceID, OSType selector, void *infoPtr)

{
    ComponentResult             result = noErr;
    PrefStructPtr               prefsPtr;

    prefsPtr = *(globals->prefsHandle);

    switch (selector) {

case siSampleSize:              // return current sample size
            *((short *) infoPtr) = (short)prefsPtr->sampleSize;
            break;

case siOutputLatency:                                               // return the sound output
latency
        // in this example, 25 ms
if (infoPtr != nil) {
                infoPtr->value.hi = 0;
                infoPtr->value.lo = 25;             // sound latency
                infoPtr->scale = 1000;              // 1 ms scale
                infoPtr->base = nil;
            }
            break;

. . .

}


© 2001 Apple Computer, Inc.

What's New in QuickTime 5

| Previous | Chapter Contents | Chapter Top | Next |