The application's one audio manager.
More...
#include <AudioManager.h>
|
| (instancetype) | - init |
| | Builds the manager and its sound-effect pool.
|
| (void) | - seekBgmToTop |
| | Seeks the background music back to its start.
|
| (void) | - setBgmPos: |
| | Moves the background music's playback position.
|
| (void) | - playSePlayer: |
| | Plays an already-prepared sound-effect player.
|
| (void) | - stopAllSe |
| | Stops every sound effect in flight.
|
| (void) | - beginInterruption |
| | Marks the start of an audio-session interruption.
|
| (void) | - endInterruption |
| | Marks the end of an audio-session interruption.
|
| (void) | - playSeFile: |
| | Plays a sound effect from a file path.
|
| (void) | - playSeResFile:inDirectory: |
| | Plays a sound effect from a bundle resource.
|
| (void) | - playSeData: |
| | Plays a sound effect from data already in memory.
|
| (BOOL) | - loadBgmFile: |
| | Loads background music from a file path.
|
| (BOOL) | - loadBgmResAAC:inDirectory: |
| | Loads background music from a bundled AAC resource.
|
| (BOOL) | - loadBgmData: |
| | Loads background music from data already in memory.
|
| (void) | - startBgm:fadeTime: |
| | Starts the background music, optionally fading it in.
|
| (void) | - onFadeinTimer: |
| | Advances a fade in by one tick.
|
| (void) | - stopBgm |
| | Stops the background music and any fade in progress.
|
| (void) | - pushBgm |
| | Saves the current background music so another track can play over it.
|
| (BOOL) | - popBgm |
| | Restores the background music saved by -pushBgm .
|
| (void) | - fadeoutBgm: |
| | Fades the background music out over a time.
|
| (void) | - setBgmSpeed: |
| | Changes the background music's playback rate.
|
| (void) | - onFadeoutTimer: |
| | Advances a fade out by one tick.
|
| (void) | - releaseBgm: |
| | Drops the active background music player, optionally also the pushed one.
|
| (void) | - appDidBecomeActive: |
| | Called back when the application returns to the foreground.
|
|
| AudioManager * | sharedManager |
| | The shared instance.
|
| AVAudioPlayer * | bgmPlayer |
| | The player the background music is running on.
|
| BOOL | interrupted |
| | Whether an audio-session interruption is currently in effect.
|
| double | bgmPos |
| | How far into the background music playback has reached, in seconds.
|
| double | bgmDuration |
| | The background music's length in seconds.
|
| BOOL | bgmPlaying |
| | Whether the background music is playing.
|
The application's one audio manager.
◆ appDidBecomeActive:
| - (void) appDidBecomeActive: |
|
(nullable NSNotification *) | notification |
|
Called back when the application returns to the foreground.
Resumes the BGM if it was suspended and clears the interruption flag.
- Parameters
-
| notification | The notification. |
- Ghidra address:
- 0x78ee0
◆ beginInterruption
| - (void) beginInterruption |
|
|
|
Marks the start of an audio-session interruption.
- Ghidra address:
- 0x78ebc
◆ endInterruption
Marks the end of an audio-session interruption.
- Ghidra address:
- 0x78ed0
◆ fadeoutBgm:
| - (void) fadeoutBgm: |
|
(double) | fadeTime |
|
Fades the background music out over a time.
Does nothing when nothing is playing or the fade is at or below the tick interval.
- Parameters
-
| fadeTime | How long the fade takes. |
- Ghidra address:
- 0x789f0
- Ghidra address:
- 0x789f0
◆ init
Builds the manager and its sound-effect pool.
Sets both volumes to full, subscribes to UIApplicationDidBecomeActiveNotification , and creates the SEManager .
- Returns
- The initialised manager.
- Ghidra address:
- 0x77da8
- Ghidra address:
- 0x77da8
◆ loadBgmData:
| - (BOOL) loadBgmData: |
|
(nullable NSData *) | data |
|
Loads background music from data already in memory.
- Parameters
-
- Returns
YES when the music loaded.
- Ghidra address:
- 0x7834c
◆ loadBgmFile:
| - (BOOL) loadBgmFile: |
|
(nullable NSString *) | path |
|
Loads background music from a file path.
Drops any previous player first, so a failed load leaves nothing loaded.
- Parameters
-
- Returns
YES when the music loaded.
- Ghidra address:
- 0x7811c
◆ loadBgmResAAC:inDirectory:
| - (BOOL) loadBgmResAAC: |
|
(nullable NSString *) | name |
| inDirectory: |
|
(nullable NSString *) | directory |
Loads background music from a bundled AAC resource.
The extension is fixed at m4a , so this only ever finds AAC.
- Parameters
-
| name | The resource name. |
| directory | The bundle subdirectory. |
- Returns
YES when the music loaded.
- Ghidra address:
- 0x78248
◆ onFadeinTimer:
| - (void) onFadeinTimer: |
|
(nullable NSTimer *) | timer |
|
Advances a fade in by one tick.
Ignores a timer that is not the current one, which is how a superseded fade is discarded.
- Parameters
-
- Ghidra address:
- 0x78690
◆ onFadeoutTimer:
| - (void) onFadeoutTimer: |
|
(nullable NSTimer *) | timer |
|
Advances a fade out by one tick.
Ignores a timer that is not the current one. On completion, stops the music rather than just restoring the volume.
- Parameters
-
- Ghidra address:
- 0x78bc0
◆ playSeData:
| - (void) playSeData: |
|
(nullable NSData *) | data |
|
Plays a sound effect from data already in memory.
- Parameters
-
- Ghidra address:
- 0x78040
◆ playSeFile:
| - (void) playSeFile: |
|
(nullable NSString *) | path |
|
Plays a sound effect from a file path.
Nothing happens when the path is nil or the player fails to initialise.
- Parameters
-
- Ghidra address:
- 0x77ea0
◆ playSePlayer:
| - (void) playSePlayer: |
|
(nullable AVAudioPlayer *) | player |
|
Plays an already-prepared sound-effect player.
Ignores a nil player rather than forwarding it.
- Parameters
-
| player | The effect to play. |
- Ghidra address:
- 0x780e4
◆ playSeResFile:inDirectory:
| - (void) playSeResFile: |
|
(nullable NSString *) | name |
| inDirectory: |
|
(nullable NSString *) | directory |
Plays a sound effect from a bundle resource.
Resolves the resource as a caf file, so this only ever plays that container.
- Parameters
-
| name | The resource name. |
| directory | The bundle subdirectory. |
- Ghidra address:
- 0x77f50
◆ popBgm
Restores the background music saved by -pushBgm .
Drops any current player first, then moves the pushed one back and reattaches the delegate.
- Returns
YES when something was restored.
- Ghidra address:
- 0x7894c
- Ghidra address:
- 0x7894c
◆ pushBgm
Saves the current background music so another track can play over it.
Stops the current track, moves it and its volume to the pushed slot, and clears the active one.
- Ghidra address:
- 0x788b0
- Ghidra address:
- 0x788b0
◆ releaseBgm:
| - (void) releaseBgm: |
|
(BOOL) | stopFirst |
|
Drops the active background music player, optionally also the pushed one.
Always stops the active player before clearing it.
- Parameters
-
| stopFirst | Whether the pushed player is also dropped. |
- Ghidra address:
- 0x78cb0
- Ghidra address:
- 0x78cb0
◆ seekBgmToTop
Seeks the background music back to its start.
Does nothing when no player is loaded.
- Ghidra address:
- 0x78448
- Ghidra address:
- 0x78448
◆ setBgmPos:
| - (void) setBgmPos: |
|
(double) | bgmPos |
|
Moves the background music's playback position.
- Parameters
-
| bgmPos | The new position in seconds. |
- Ghidra address:
- 0x78868
- Ghidra address:
- 0x78868
◆ setBgmSpeed:
| - (void) setBgmSpeed: |
|
(float) | speed |
|
Changes the background music's playback rate.
Enables rate adjustment and sets the rate to the same value.
- Parameters
-
- Ghidra address:
- 0x78b6c
- Ghidra address:
- 0x78b6c
◆ startBgm:fadeTime:
| - (void) startBgm: |
|
(BOOL) | loop |
| fadeTime: |
|
(double) | fadeTime |
Starts the background music, optionally fading it in.
Does nothing when no player is loaded or one is already playing. During an interruption the request is remembered rather than played.
- Parameters
-
| loop | Whether the track repeats. |
| fadeTime | How long the fade in takes; a value at or below the tick interval skips it. |
- Ghidra address:
- 0x7846c
- Ghidra address:
- 0x7846c
◆ stopAllSe
Stops every sound effect in flight.
- Ghidra address:
- 0x78104
◆ stopBgm
Stops the background music and any fade in progress.
- Ghidra address:
- 0x787a4
◆ bgmDuration
The background music's length in seconds.
- Ghidra address:
- 0x78880
◆ bgmPlayer
| - (AVAudioPlayer*) bgmPlayer |
|
readnonatomicassign |
The player the background music is running on.
- Ghidra address:
- 0x349f24 (ivar offset global)
◆ bgmPlaying
Whether the background music is playing.
- Ghidra address:
- 0x78898
◆ bgmPos
How far into the background music playback has reached, in seconds.
Read-only as a property, but a setter exists as a plain method — see -setBgmPos: .
- Ghidra address:
- 0x78850
- Ghidra address:
- 0x78850
◆ interrupted
Whether an audio-session interruption is currently in effect.
- Ghidra address:
- 0x349f28 (ivar offset global)
◆ sharedManager
The shared instance.
- Returns
- The manager.
- Ghidra address:
- 0x77d28
- Ghidra address:
- 0x77d28
- Ghidra address:
- 0x77d68
The documentation for this class was generated from the following files: