Tairitsu.BgmPlayer¶
Play background music.
BgmPlayer
¶
Classes¶
BgmPlayer
¶
BgmPlayer(path: str = GamePath.bgm['CITY'])
A class representing a background music player.
| ATTRIBUTE | DESCRIPTION |
|---|---|
current_bgm |
The currently playing background music.
|
| METHOD | DESCRIPTION |
|---|---|
play |
str, loop=-1): Plays the specified background music. |
stop |
Stops the currently playing background music. |
resume |
Resumes the paused background music. |
update |
Updates the BgmPlayer object. |
Source code in Tairitsu/BgmPlayer.py
19 20 21 | |
Attributes¶
Functions¶
play
¶
play(name: str = '', loop=-1)
Play the specified background music.
| PARAMETER | DESCRIPTION |
|---|---|
name |
The name of the background music to play.
TYPE:
|
loop |
The number of times the music should loop. Defaults to -1 (infinite loop).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
|
None |
Source code in Tairitsu/BgmPlayer.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |
position
¶
position() -> int
Returns the current position of the music playback in milliseconds.
| RETURNS | DESCRIPTION |
|---|---|
int
|
The current position of the music playback in milliseconds.
TYPE:
|
Source code in Tairitsu/BgmPlayer.py
49 50 51 52 53 54 55 56 | |
position_beat
¶
position_beat() -> float
Source code in Tairitsu/BgmPlayer.py
58 59 | |
resume
¶
resume()
Source code in Tairitsu/BgmPlayer.py
43 44 | |
SoundFX
¶
SoundFX(path: str = GamePath.sound['MenuCursor'], volume: float = 0.5)