PXSoundChannel Class Reference
| Inherits from | PXEventDispatcher : NSObject |
| Declared in | PXSoundChannel.h PXSoundChannel.m |
Overview
Represents a loaded and playing sound. Sound channels should never be initialized manually, but instead created via the [PXSound play] method.
Tasks
-
soundTransformThe transform of the sound.
property -
positionThe current point in milliseconds of the playing sound.
property -
isPlaying
propertyYESif the sound is playing, otherwiseNO. -
– playIf the sound is not already playing, it plays the sound from it’s current position.
-
– pauseIf the sound is not already paused, it pauses the sound at it’s current position.
-
– stopIf the sound is not already stopped, it stops the sound and removes it permanently from the play list.
-
– rewindIf the sound is not already rewound, it rewinds the sound moving it’s position back to 0 and continues playing if it were previously playing, or pause if it was previously paused. This does not reset the loops already done.
Properties
isPlaying
YES if the sound is playing, otherwise NO.
@property (nonatomic, readonly) BOOL isPlayingDeclared In
PXSoundChannel.hInstance Methods
pause
If the sound is not already paused, it pauses the sound at it’s current position.
- (void)pauseDiscussion
Example:
PXSound *sound = [PXSound soundWithContentsOfFile:@"sound.wav"];
PXSoundChannel *channel = [sound play];
// The sound is playing
[channel pause];
// The sound is paused
Declared In
PXSoundChannel.mplay
If the sound is not already playing, it plays the sound from it’s current position.
- (BOOL)playDiscussion
Example:
PXSound *sound = [PXSound soundWithContentsOfFile:@"sound.wav"];
PXSoundChannel *channel = [sound play];
// The sound is playing
[channel pause];
// The sound is paused
[channel play];
// The sound is playing
Declared In
PXSoundChannel.mrewind
If the sound is not already rewound, it rewinds the sound moving it’s position back to 0 and continues playing if it were previously playing, or pause if it was previously paused. This does not reset the loops already done.
- (void)rewindDiscussion
Example:
PXSound *sound = [PXSound soundWithContentsOfFile:@"sound.wav"];
PXSoundChannel *channel = [sound play];
// The sound is playing
[channel rewind];
// The sound is rewinded and continues playing
[channel pause];
// The sound is paused
[channel rewind];
// The sound is rewinded and continues staying paused
Declared In
PXSoundChannel.mstop
If the sound is not already stopped, it stops the sound and removes it permanently from the play list.
- (void)stopDiscussion
Example:
PXSound *sound = [PXSound soundWithContentsOfFile:@"sound.wav"];
PXSoundChannel *channel = [sound play];
// The sound is playing
[channel stop];
// The sound is stopped and wont play again
Declared In
PXSoundChannel.m