Inherits from SPEventDispatcher : NSObject
Declared in SPSoundChannel.h

Overview

An SPSoundChannel represents an audio source. Use this class to control sound playback.

Sound channels are created with the method [SPSound createChannel]. They allow control over playback (play, pause, stop) and properties as the volume or if the sound should loop.

Furthermore, it will dispatch events of type SP_EVENT_TYPE_SOUND_COMPLETED when the sound is finished.

Before releasing a channel, it is a good habit to call stop or to remove any event listeners. Otherwise, an event may be dispatched to an object that was already released, causing a crash.

Tasks

Methods

  • – play

    Starts playback.

  • – stop

    Stops playback. Sound will start from the beginning on play.

  • – pause

    Pauses the sound. Call play again to continue.

Properties

  •   isPlaying

    Indicates if the sound is currently playing.

    property
  •   isPaused

    Indicates if the sound is currently paused.

    property
  •   isStopped

    Indicates if the sound was stopped.

    property
  •   duration

    The duration of the sound in seconds.

    property
  •   volume

    The volume of the sound. Range: [0.0 – 1.0]

    property
  •   loop

    Indicates if the sound should loop. Looping sounds don’t dispatch SOUND_COMPLETED events.

    property

Properties

duration

The duration of the sound in seconds.

@property (nonatomic, readonly) double duration

Discussion

The duration of the sound in seconds.

Declared In

SPSoundChannel.h

isPaused

Indicates if the sound is currently paused.

@property (nonatomic, readonly) BOOL isPaused

Discussion

Indicates if the sound is currently paused.

Declared In

SPSoundChannel.h

isPlaying

Indicates if the sound is currently playing.

@property (nonatomic, readonly) BOOL isPlaying

Discussion

Indicates if the sound is currently playing.

Declared In

SPSoundChannel.h

isStopped

Indicates if the sound was stopped.

@property (nonatomic, readonly) BOOL isStopped

Discussion

Indicates if the sound was stopped.

Declared In

SPSoundChannel.h

loop

Indicates if the sound should loop. Looping sounds don’t dispatch SOUND_COMPLETED events.

@property (nonatomic, assign) BOOL loop

Discussion

Indicates if the sound should loop. Looping sounds don’t dispatch SOUND_COMPLETED events.

Declared In

SPSoundChannel.h

volume

The volume of the sound. Range: [0.0 – 1.0]

@property (nonatomic, assign) float volume

Discussion

The volume of the sound. Range: [0.0 – 1.0]

Declared In

SPSoundChannel.h

Instance Methods

pause

Pauses the sound. Call play again to continue.

- (void)pause

Discussion

Pauses the sound. Call play again to continue.

Declared In

SPSoundChannel.h

play

Starts playback.

- (void)play

Discussion

Starts playback.

Declared In

SPSoundChannel.h

stop

Stops playback. Sound will start from the beginning on play.

- (void)stop

Discussion

Stops playback. Sound will start from the beginning on play.

Declared In

SPSoundChannel.h