mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
tentative fix for issue#229
See: https://github.com/shlomif/PySolFC/issues/229 pygame2 compat.
This commit is contained in:
parent
7af8fde4c0
commit
ffa0ae1a2f
2 changed files with 11 additions and 9 deletions
|
@ -1252,9 +1252,9 @@ class Application:
|
|||
self.initResource(manager, dirs, ext_re, Sample)
|
||||
|
||||
def initMusic(self):
|
||||
manager = self.music_manager
|
||||
music_manager = self.music_manager
|
||||
# find all available music songs
|
||||
dirs = manager.getSearchDirs(self, "music-*", "PYSOL_MUSIC")
|
||||
# print dirs
|
||||
dirs = music_manager.getSearchDirs(self, "music-*", "PYSOL_MUSIC")
|
||||
# print('dirs =', dirs)
|
||||
ext_re = re.compile(self.audio.EXTENSIONS)
|
||||
self.initResource(manager, dirs, ext_re, Music)
|
||||
self.initResource(music_manager, dirs, ext_re, Music)
|
||||
|
|
|
@ -502,6 +502,7 @@ class PyGameAudioClient(AbstractAudioClient):
|
|||
def __init__(self):
|
||||
AbstractAudioClient.__init__(self)
|
||||
import pygame.mixer
|
||||
import pygame.mixer_music
|
||||
import pygame.time
|
||||
if os.name == 'nt':
|
||||
# for py2exe
|
||||
|
@ -510,7 +511,8 @@ class PyGameAudioClient(AbstractAudioClient):
|
|||
import pygame.mixer_music
|
||||
self.mixer = pygame.mixer
|
||||
self.time = pygame.time
|
||||
self.music = self.mixer.music
|
||||
self.mixer_music = pygame.mixer_music
|
||||
self.music = self.mixer_music
|
||||
self.audiodev = self.mixer
|
||||
self.sound = None
|
||||
self.sound_channel = None
|
||||
|
@ -561,7 +563,7 @@ class PyGameAudioClient(AbstractAudioClient):
|
|||
self.sound_channel = None
|
||||
|
||||
def _playMusicLoop(self):
|
||||
# print '_playMusicLoop'
|
||||
# print('_playMusicLoop')
|
||||
music_list = self.music_list
|
||||
if not music_list:
|
||||
return
|
||||
|
@ -604,14 +606,14 @@ class PyGameAudioClient(AbstractAudioClient):
|
|||
th.start()
|
||||
|
||||
def updateSettings(self):
|
||||
if (not self.app.opt.sound or not self.app.opt.music or
|
||||
self.app.opt.sound_music_volume == 0):
|
||||
if (not ((self.app.opt.sound or self.app.opt.music) and
|
||||
self.app.opt.sound_music_volume > 0)):
|
||||
if self.music:
|
||||
self.music.stop()
|
||||
self.music = None
|
||||
else:
|
||||
if not self.music:
|
||||
self.music = self.mixer.music
|
||||
self.music = self.mixer_music
|
||||
th = Thread(target=self._playMusicLoop)
|
||||
th.start()
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue