2 from random
import choice
3 from logging
import info
4 from panda3d
.core
import AudioSound
9 def __init__(self
, volume
):
10 self
._start
_music
(glob('assets/audio/music/*.ogg'))
11 base
.musicManager
.setVolume(.8 * volume
)
12 base
.sfxManagerList
[0].setVolume(volume
)
13 taskMgr
.add(self
._on
_frame
, 'on frame music')
15 def _start_music(self
, files
):
16 self
._music
= loader
.load_music(choice(files
))
17 info('playing music ' + self
._music
.get_name())
20 def set_volume(self
, volume
):
21 base
.musicManager
.setVolume(.8 * volume
)
22 base
.sfxManagerList
[0].setVolume(volume
)
24 def _on_frame(self
, task
):
25 if self
._music
.status() == AudioSound
.READY
:
26 files
= glob('assets/audio/music/*.ogg')
27 files
.remove('assets/audio/music/' + self
._music
.get_name())
28 self
._start
_music
(files
)