PXSoundMixer Class Reference
| Inherits from | NSObject |
| Declared in | PXSoundMixer.h PXSoundMixer.m |
Tasks
-
+ warmUpInitializes the sound engine so that when you go to play a sound there is not the initial delay of setting up the engine. This is suggested to do at the start of your program if you are in need of playing sounds immediately within the duration of your app.
-
+ setSoundTransform:Changes the pitch and volume of every sound.
-
+ soundTransformReturns the global sound transform.
-
+ soundListenerReturns the global sound listener.
-
+ setSpeedOfSound:Sets the speed of sound, this is useful for the doppler effect.
-
+ speedOfSoundReturns the speed of sound.
-
+ setDistanceModel:Sets the distance model for the sound. This means that the further the sound gets from the listener, how it the volume will change. The two options available are either
PXSoundMixerDistanceModel_LinearorPXSoundMixerDistanceModel_Logarithmic. -
+ distanceModelReturns the current distance model, the two options are
PXSoundMixerDistanceModel_LinearorPXSoundMixerDistanceModel_Logarithmic. The default value isPXSoundMixerDistanceModel_Logarithmic. -
+ playAllPlays all sound channels.
-
+ pauseAllPauses all sound channels.
-
+ stopAllStops all sound channels.
-
+ rewindAllRewinds all sound channels.
Class Methods
distanceModel
Returns the current distance model, the two options are
PXSoundMixerDistanceModel_Linear or
PXSoundMixerDistanceModel_Logarithmic. The default value is
PXSoundMixerDistanceModel_Logarithmic.
+ (PXSoundMixerDistanceModel)distanceModelReturn Value
The distance model.
Example:
PXSoundMixerDistanceModel distanceModel = [PXSoundMixer distanceModel];
Discussion
The distance model is how the volume of a sound changes depending on how far
it is from the PXSoundListener.
Declared In
PXSoundMixer.msetDistanceModel:
Sets the distance model for the sound. This means that the further the
sound gets from the listener, how it the volume will change. The two
options available are either PXSoundMixerDistanceModel_Linear
or PXSoundMixerDistanceModel_Logarithmic.
+ (void)setDistanceModel:(PXSoundMixerDistanceModel)distanceModelParameters
- distanceModel
The distance model.
Example:
[PXSoundMixer setDistanceModel:PXSoundMixerDistanceModel_Logarithmic];
See Also
Default:
PXSoundMixerDistanceModel_Logarithmic
Declared In
PXSoundMixer.msetSoundTransform:
Changes the pitch and volume of every sound.
+ (void)setSoundTransform:(PXSoundTransform *)soundTransformParameters
- soundTransform
The sound transform to set.
Example:
PXSoundTransform *soundTransform = [[PXSoundTransform alloc] initWithVolume:0.5f pitch:2.0f]; [PXSoundMixer setSoundTransform:soundTransform]; // All sounds will now be at 50% volume from what they were, meaning if a // sound was at 30% volume, it is now at 15%, likewise the pitch is at 200%, // meaning if the pitch of a sound was at 50%, it is now at 100%. [soundTransform release];
Declared In
PXSoundMixer.msetSpeedOfSound:
Sets the speed of sound, this is useful for the doppler effect.
+ (void)setSpeedOfSound:(float)speedOfSoundParameters
- speedOfSound
The speed of sound.
Example:
[PXSoundMixer setSpeedOfSound:64.0f]; // Sets the speed of sound to 64.0 points/second.
Declared In
PXSoundMixer.msoundListener
Returns the global sound listener.
+ (PXSoundListener *)soundListenerReturn Value
The global sound listener.
Example:
PXSoundListener *globalSoundListener = [PXSoundMixer soundListener];
Declared In
PXSoundMixer.msoundTransform
Returns the global sound transform.
+ (PXSoundTransform *)soundTransformReturn Value
The global sound transform.
Example:
PXSoundTransform *globalSoundTransform = [PXSoundMixer soundTransform];
// globalSoundTransform by default will have 1.0f for volume, and 1.0f for
// pitch.
Declared In
PXSoundMixer.mspeedOfSound
Returns the speed of sound.
+ (float)speedOfSoundReturn Value
The speed of sound.
Example:
float speedOfSound = [PXSoundMixer speedOfSound];
Default: 340.29f
Declared In
PXSoundMixer.mwarmUp
Initializes the sound engine so that when you go to play a sound there is not the initial delay of setting up the engine. This is suggested to do at the start of your program if you are in need of playing sounds immediately within the duration of your app.
+ (void)warmUpDeclared In
PXSoundMixer.m