Skip to content

Commit 9aed969

Browse files
authored
Merge pull request #2152 from pygame-community/starbuck5-tracker-music
Fixes for tracker music support, add test
2 parents ffc087c + f7d9f6b commit 9aed969

File tree

6 files changed

+41
-23
lines changed

6 files changed

+41
-23
lines changed

buildconfig/download_win_prebuilt.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ def get_urls(x86=True, x64=True):
9090
'dee48e9c5184c139aa8bcab34a937d1b3df4f503'
9191
],
9292
[
93-
'https://github.com/libsdl-org/SDL_mixer/releases/download/release-2.6.3/SDL2_mixer-devel-2.6.3-VC.zip',
94-
'4e8d47098446d58fbedbe4a741cec9acedcc4957',
93+
'https://github.com/libsdl-org/SDL_mixer/releases/download/release-2.6.2/SDL2_mixer-devel-2.6.2-VC.zip',
94+
'000e3ea8a50261d46dbd200fb450b93c59ed4482',
9595
],
9696
])
9797
if x86:
@@ -212,12 +212,12 @@ def copy(src, dst):
212212
copy(
213213
os.path.join(
214214
temp_dir,
215-
'SDL2_mixer-devel-2.6.3-VC/SDL2_mixer-2.6.3'
215+
'SDL2_mixer-devel-2.6.2-VC/SDL2_mixer-2.6.2'
216216
),
217217
os.path.join(
218218
move_to_dir,
219219
prebuilt_dir,
220-
'SDL2_mixer-2.6.3'
220+
'SDL2_mixer-2.6.2'
221221
)
222222
)
223223
copy(

buildconfig/manylinux-build/docker_base/sdl_libs/build-sdl2-libs.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ cd $(dirname `readlink -f "$0"`)
66
SDL2="SDL2-2.26.4"
77
IMG2="SDL2_image-2.0.5"
88
TTF2="SDL2_ttf-2.20.2"
9-
MIX2="SDL2_mixer-2.6.3"
9+
MIX2="SDL2_mixer-2.6.2"
1010

1111

1212
# Download
@@ -115,7 +115,8 @@ cd $MIX2
115115
--disable-music-ogg-vorbis-shared \
116116
--disable-music-ogg-tremor-shared \
117117
--disable-music-flac-libflac-shared \
118-
--disable-music-mp3-mpg123-shared
118+
--disable-music-mp3-mpg123-shared \
119+
--disable-music-mod-modplug-shared
119120

120121
make
121122
make install
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
138f52a23d796803c450722c8a4db8226214522e99f1e5ae657e2b28eb45abf0c81c9c3df9ab16f1a07d59722ed9415d64dd04332ff040cdfbbc0329f0d05ce4 SDL2-2.26.4.tar.gz
22
77e743d3f32707e015b290c1379ae3c7d7a3fe265995713267f0d0ec6517de4808f0de9890b5ab28445941af5bc9fbff346620629e0d7d7e9f365262cab05ee7 SDL2_image-2.0.5.tar.gz
3-
2e9da045d2fdab97236c3901b3d441834a67a47c8851ddfb817c9db6f23ed9fb355a5ef8d2158d0c9959a83934e8cd1b95db8a69eaddf8f7fcca115f01818740 SDL2_mixer-2.6.3.tar.gz
3+
16baa9d8b345bf0224538cbfb2ae9fc5d3deea2b454f41a98006c938fe7a65d5a8c84e28a76f98a4dd971c4fe5cf0219d8bf73331cf11f2702e01600eb197658 SDL2_mixer-2.6.2.tar.gz
44
b54e93b100712e3764cd80d4e4b16cd4c2a6853620f675941a4214320b0ee29a583d57ad56cd5fdb5c7a32d7615cbf43bc3fa55337b01623cee7219ebb43667c SDL2_ttf-2.20.2.tar.gz

examples/data/attributions.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
surfonasinewave.xm:
2+
By FearofDark
3+
https://modarchive.org/index.php?request=view_by_moduleid&query=169104

examples/data/surfonasinewave.xm

418 KB
Binary file not shown.

test/mixer_music_test.py

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,24 @@ def setUp(cls):
2626

2727
def test_load_mp3(self):
2828
"|tags:music|"
29-
self.music_load("mp3")
29+
self.music_load("house_lo.mp3")
3030

3131
def test_load_ogg(self):
3232
"|tags:music|"
33-
self.music_load("ogg")
33+
self.music_load("house_lo.ogg")
3434

3535
def test_load_wav(self):
3636
"|tags:music|"
37-
self.music_load("wav")
37+
self.music_load("house_lo.wav")
3838

39-
def music_load(self, format):
39+
def test_load_xm(self):
40+
"|tags:music|"
41+
self.music_load("surfonasinewave.xm")
42+
43+
def music_load(self, filename):
4044
data_fname = example_path("data")
4145

42-
path = os.path.join(data_fname, f"house_lo.{format}")
46+
path = os.path.join(data_fname, filename)
4347
if os.sep == "\\":
4448
path = path.replace("\\", "\\\\")
4549
umusfn = str(path)
@@ -50,10 +54,10 @@ def music_load(self, format):
5054

5155
def test_load_object(self):
5256
"""test loading music from file-like objects."""
53-
formats = ["ogg", "wav"]
57+
filenames = ["house_lo.ogg", "house_lo.wav", "surfonasinewave.xm"]
5458
data_fname = example_path("data")
55-
for f in formats:
56-
path = os.path.join(data_fname, f"house_lo.{f}")
59+
for file in filenames:
60+
path = os.path.join(data_fname, file)
5761
if os.sep == "\\":
5862
path = path.replace("\\", "\\\\")
5963
bmusfn = path.encode()
@@ -63,26 +67,28 @@ def test_load_object(self):
6367

6468
def test_object_namehint(self):
6569
"""test loading & queuing music from file-like objects with namehint argument."""
66-
formats = ["wav", "ogg"]
70+
filenames = ["house_lo.ogg", "house_lo.wav", "surfonasinewave.xm"]
6771
data_fname = example_path("data")
68-
for f in formats:
69-
path = os.path.join(data_fname, f"house_lo.{f}")
72+
for file in filenames:
73+
path = os.path.join(data_fname, file)
7074
if os.sep == "\\":
7175
path = path.replace("\\", "\\\\")
7276
bmusfn = path.encode()
7377

78+
*_, format = file.split(".")
79+
7480
# these two "with open" blocks need to be separate, which is kinda weird
7581
with open(bmusfn, "rb") as musf:
76-
pygame.mixer.music.load(musf, f)
82+
pygame.mixer.music.load(musf, format)
7783

7884
with open(bmusfn, "rb") as musf:
79-
pygame.mixer.music.queue(musf, f)
85+
pygame.mixer.music.queue(musf, format)
8086

8187
with open(bmusfn, "rb") as musf:
82-
pygame.mixer.music.load(musf, namehint=f)
88+
pygame.mixer.music.load(musf, namehint=format)
8389

8490
with open(bmusfn, "rb") as musf:
85-
pygame.mixer.music.queue(musf, namehint=f)
91+
pygame.mixer.music.queue(musf, namehint=format)
8692

8793
def test_load_unicode(self):
8894
"""test non-ASCII unicode path"""
@@ -143,6 +149,14 @@ def test_queue_wav(self):
143149
filename = example_path(os.path.join("data", "house_lo.wav"))
144150
pygame.mixer.music.queue(filename)
145151

152+
def test_queue_xm(self):
153+
"""Ensures queue() accepts xm files (tracker music files).
154+
155+
|tags:music|
156+
"""
157+
filename = example_path(os.path.join("data", "surfonasinewave.xm"))
158+
pygame.mixer.music.queue(filename)
159+
146160
def test_queue__multiple_calls(self):
147161
"""Ensures queue() can be called multiple times."""
148162
ogg_file = example_path(os.path.join("data", "house_lo.ogg"))
@@ -358,7 +372,7 @@ def test_get_busy(self):
358372
# music is idle this returns False.
359373
#
360374

361-
self.music_load("ogg")
375+
self.music_load("house_lo.ogg")
362376
self.assertFalse(pygame.mixer.music.get_busy())
363377
pygame.mixer.music.play()
364378
self.assertTrue(pygame.mixer.music.get_busy())

0 commit comments

Comments
 (0)