SSpSource_CalcLocalization
You can use theSSpSource_CalcLocalizationfunction to determine the relative positions and velocities of a sound source and its listener.
OSStatus SSpSource_CalcLocalization ( SSpSourceReference inSourceReference, SSpListenerReference inListenerReference, SSpLocalizationData *outLocalization);
inSourceReference- A source reference.
inListenerReference- A listener reference.
outLocalization- On entry, a pointer to a 3D sound information structure. On exit, the structure is filled in with current information about the relative positions and velocities of the sound source and the listener.
- function result
- A result code.
DESCRIPTION
TheSSpSource_CalcLocalizationfunction returns, in the 3D sound information structure specified by theoutLocalizationparameter, the current relative positions and velocities of the sound source specified by theinSourceReferenceparameter and the listener specified by theinListenerReferenceparameter.
SSpSource_CalcLocalizationcomputes the actual velocity vectors of the source and listener independently, based on the most recent calls toSSpSource_SetVelocityandSSpListener_SetVelocity, and then combines those vectors to obtain a relative velocity. If you calledSSpSource_SetVelocityfor the specified source after the most recent call toSSpSource_CalcLocalization, then the new velocity is transformed (using the source transform matrix) to obtain the actual velocity of the source. If you calledSSpSource_SetPositionorSSpSource_SetTransformbut notSSpSource_SetVelocityafter the most recent call toSSpSource_CalcLocalization, then the actual velocity is set to the difference in transformed positions divided by the interval since the most recent call toSSpSource_CalcLocalization. In you haven't called any of these functions since the most recent call toSSpSource_CalcLocalization, then the actual source velocity is left unchanged. The listener's actual velocity is calculated in a similar manner.If
SSpSource_CalcLocalizationcompletes successfully, you should then execute the following code to change the sound being played:
SndSetInfo(myChannel, siSSpLocalization, &mySSpLocalizationData);