Carbon


SndChannel

Header: Sound.h

struct SndChannel {
    SndChannelPtr nextChan; 
    Ptr firstMod; 
    SndCallBackUPP callBack; 
    SInt32 userInfo; 
    SInt32 wait; 
    SndCommand cmdInProgress; 
    SInt16 flags; 
    SInt16 qLength; 
    SInt16 qHead; 
    SInt16 qTail; 
    SndCommand queue[128];
};
typedef SndChannel SndChannelPtr;

Field descriptions

nextChan

A pointer to the next sound channel in a single queue of channels that the Sound Manager maintains for all applications.

firstMod

Used internally.

callBack

A pointer to the callback function associated with the sound channel. See SndCallBackProcPtr for information on this callback function.

userInfo

A value that your application can use to store information.

wait

Used internally.

cmdInProgress

Used internally.

flags

Used internally.

qLength

Used internally.

qHead

Used internally.

qTail

Used internally.

queue

The sound commands pending for the sound channel.

The Sound Manager maintains a sound channel structure to store information about each sound channel that you allocate directly by calling the SndNewChannel function or indirectly by passing a NULL channel to a high-level Sound Manager function like the SndPlay function. The SndChannel data type defines a sound channel structure.

The only field of the sound channel structure that you are likely to need to access directly is the userInfo field. This field is useful if you need to pass a value to a Sound Manager callback function or completion function. For example, you might pass the value stored in the A5 register so that your callback function can access your application’s global variables. Or, you might store a handle to sound data here so that a function that disposes of an allocated channel can also release the sound data that the channel played.

In rarer instances, you might need to access the callBack field of the sound channel structure directly. Ordinarily, you set this field by specifying a callback function when you call the SndNewChannel function. However, you can change the callback function associated with a channel by changing this field directly. The Sound Manager will then execute the function you specify in this field whenever the channel processes a callBackCmd command.

You should not attempt to manipulate all open sound channels by using the nextChan field to walk the sound channel queue. The queue might contain channels opened by other applications. If you need to perform some operation on all sound channels that your application has allocated, you should maintain your own data structure that keeps track of your application’s channels.

You should use this data structure only if you need to access this information or to customize sound play.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)