JubeatPlus 3.9.11
Loading...
Searching...
No Matches
AudioManager Class Reference

The application's one audio manager. More...

#include <AudioManager.h>

Inheritance diagram for AudioManager:
Collaboration diagram for AudioManager:

Instance Methods

(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.

Properties

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.

Detailed Description

The application's one audio manager.

Method Documentation

◆ 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
notificationThe notification.
Ghidra address:
0x78ee0

◆ beginInterruption

- (void) beginInterruption

Marks the start of an audio-session interruption.

Ghidra address:
0x78ebc

◆ endInterruption

- (void) 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
fadeTimeHow long the fade takes.
Ghidra address:
0x789f0
Ghidra address:
0x789f0

◆ init

- (instancetype) 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
dataThe encoded audio.
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
pathThe file to load.
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
nameThe resource name.
directoryThe 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
timerThe driving timer.
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
timerThe driving timer.
Ghidra address:
0x78bc0

◆ playSeData:

- (void) playSeData: (nullable NSData *) data

Plays a sound effect from data already in memory.

Parameters
dataThe encoded audio.
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
pathThe file to play.
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
playerThe 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
nameThe resource name.
directoryThe bundle subdirectory.
Ghidra address:
0x77f50

◆ popBgm

- (BOOL) 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

- (void) 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
stopFirstWhether the pushed player is also dropped.
Ghidra address:
0x78cb0
Ghidra address:
0x78cb0

◆ seekBgmToTop

- (void) 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
bgmPosThe 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
speedThe new rate.
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
loopWhether the track repeats.
fadeTimeHow long the fade in takes; a value at or below the tick interval skips it.
Ghidra address:
0x7846c
Ghidra address:
0x7846c

◆ stopAllSe

- (void) stopAllSe

Stops every sound effect in flight.

Ghidra address:
0x78104

◆ stopBgm

- (void) stopBgm

Stops the background music and any fade in progress.

Ghidra address:
0x787a4

Property Documentation

◆ bgmDuration

- (double) bgmDuration
readnonatomicassign

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

- (BOOL) bgmPlaying
readnonatomicassign

Whether the background music is playing.

Ghidra address:
0x78898

◆ bgmPos

- (double) bgmPos
readnonatomicassign

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

- (BOOL) interrupted
readnonatomicassign

Whether an audio-session interruption is currently in effect.

Ghidra address:
0x349f28 (ivar offset global)

◆ sharedManager

- (AudioManager *) sharedManager
readnonatomicassign

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: