PXSoundTransform3D Class Reference
| Inherits from | PXSoundTransform : NSObject |
| Conforms to | NSCopying PXPooledObject |
| Declared in | PXSoundTransform3D.h PXSoundTransform3D.m |
Overview
Represents the volume, pitch, position, velocity and distance formula for a 3D-ready PXSoundChannel.
The following code creates a sound transform with 120% volume and 80% pitch:
PXSoundTransform3D *transform = [[PXSoundTransform3D alloc] initWithVolume:1.2f pitch:0.8f];
// Volume will be 120% and pitch will be 80%, position[0,0,0] and
// velocity[0,0,0], reference distance and logarithmic exponent is set to
// the defaults described in sound listener. To access the sound listener
// use [PXSoundMixer soundListener].
Tasks
Other Methods
-
xThe horizontal coordinate.
property -
yThe vertical coordinate.
property -
zThe depth coordinate.
property -
velocityXThe horizontal coordinate change per second.
property -
velocityYThe vertical coordinate change per second.
property -
velocityZThe depth coordinate change per second.
property -
referenceDistanceThe reference for how the volume changes based on it’s distance from the listener.
property -
logarithmicExponentThe exponent for the logarithmic distance model described in PXSoundMixer. The exponent is ignored if the distance model is set to
propertyPXSoundMixerDistanceModel_Linear. For the forumla used please see the referenceDistance description. -
– setX:y:z:Sets the position to (x, y, z).
-
– setVelocityX:y:z:Sets the velocity to (x, y, z).
-
+ soundTransform3DWithVolume:pitch:Creates a 3D sound transform with the given
volumeandpitch.
Other Methods
-
– initWithVolume:pitch:Creates a new 3D sound transform with the given
volumeandpitch.
Properties
logarithmicExponent
The exponent for the logarithmic distance model described in
PXSoundMixer. The exponent is ignored if the distance model is
set to PXSoundMixerDistanceModel_Linear. For the forumla used
please see the referenceDistance description.
@property (nonatomic) float logarithmicExponentDiscussion
Default: [PXSoundMixer soundListener].defaultLogarithmicExponent
The logarithmic exponent can not be negative, the absolute value will be taken before use.
Declared In
PXSoundTransform3D.hreferenceDistance
The reference for how the volume changes based on it’s distance from the listener.
@property (nonatomic) float referenceDistanceDiscussion
If the distance model described in PXSoundMixer is set to
PXSoundMixerDistanceModel_Linear then the
logarithmicExponent is ignored and if a
PXSoundChannel is further then the reference distance away from
the listener, then the sound will not be heard. Anywhere in between will be
linearly distributed. So if the PXSoundChannel is 70% of the
reference distance away from the user, then the sound is played at 70%
volume.
If the distance model described in PXSoundMixer is set to
PXSoundMixerDistanceModel_Logarithmic then the distance volume
is calculated based on the following forumla:
distanceVolume = (distance / referenceDistance) ^ (-logarithmicExponent)
The actual volume is computed using the following formula:
playingVolume = volume * distanceVolume * [PXSoundMixer soundTransform].volume
Default: [PXSoundMixer soundListener].defaultReferenceDistance
The reference distance can not be negative, the absolute value will be taken before use.
Declared In
PXSoundTransform3D.hvelocityX
The horizontal coordinate change per second.
@property (nonatomic) float velocityXDiscussion
Default: 0.0f
Declared In
PXSoundTransform3D.hvelocityY
The vertical coordinate change per second.
@property (nonatomic) float velocityYDiscussion
Default: 0.0f
Declared In
PXSoundTransform3D.hvelocityZ
The depth coordinate change per second.
@property (nonatomic) float velocityZDiscussion
Default: 0.0f
Declared In
PXSoundTransform3D.hx
The horizontal coordinate.
@property (nonatomic) float xDiscussion
Default: 0.0f
Declared In
PXSoundTransform3D.hClass Methods
soundTransform3DWithVolume:pitch:
Creates a 3D sound transform with the given volume and
pitch.
+ (PXSoundTransform3D *)soundTransform3DWithVolume:(float)volume pitch:(float)pitchParameters
- volume
The amplitude of the sound.
- pitch
The frequency of the sound.
Return Value
The created sound transform.
Example:
PXSoundTransform3D *transform = [PXSoundTransform3D soundTransformWithVolume:1.2f pitch:0.8f];
// Volume will be 120% and pitch will be 80%, position[0,0,0] and
// velocity[0,0,0], reference distance and logarithmic exponent is set to
// the defaults described in sound listener. To access the sound listener
// use [PXSoundMixer soundListener].
See Also
Declared In
PXSoundTransform3D.mInstance Methods
initWithVolume:pitch:
Creates a new 3D sound transform with the given volume and
pitch.
- (id)initWithVolume:(float)_volume pitch:(float)_pitchParameters
- volume
The amplitude of the sound.
- pitch
The frequency of the sound.
Example:
PXSoundTransform3D *transform = [[PXSoundTransform3D alloc] initWithVolume:1.2f pitch:0.8f]; // Volume will be 120% and pitch will be 80%, position[0,0,0] and // velocity[0,0,0], reference distance and logarithmic exponent is set to // the defaults described in sound listener. To access the sound listener // use [PXSoundMixer soundListener].
See Also
Declared In
PXSoundTransform3D.msetVelocityX:y:z:
Sets the velocity to (x, y, z).
- (void)setVelocityX:(float)_x y:(float)_y z:(float)_zParameters
- x
The horizontal coordinate change per second.
- y
The vertical coordinate change per second.
- z
The depth coordinate change per second.
Example:
PXSoundTransform3D *transform = [PXSoundTransform3D new]; // transform will have a volume of 1.0f and pitch of 1.0f [transform setVelocityX:-10.0f y:4.1f z:0.0f]; // transform's velocity will now be (-10.0f, 4.1f, 0.0f)
Declared In
PXSoundTransform3D.msetX:y:z:
Sets the position to (x, y, z).
- (void)setX:(float)_x y:(float)_y z:(float)_zParameters
- x
The horizontal coordinate.
- y
The vertical coordinate.
- z
The depth coordinate.
Example:
PXSoundTransform3D *transform = [PXSoundTransform3D new]; // transform will have a volume of 1.0f and pitch of 1.0f [transform setX:5.0f y:7.0f z:0.0f]; // transform's position will now be (5.0f, 7.0f, 0.0f)
Declared In
PXSoundTransform3D.m