aboutsummaryrefslogtreecommitdiff
path: root/tests/runner.py
diff options
context:
space:
mode:
authorMichael J. Bishop <mbtyke@gmail.com>2013-07-15 18:49:34 -0400
committerMichael J. Bishop <mbtyke@gmail.com>2013-07-15 18:49:34 -0400
commited0c109645836520c244dcc7456cf8b8ba619de6 (patch)
tree28c0cf6dc1f43986cedfbd42c8f382c64aa31beb /tests/runner.py
parentb87be16d64b81efd5c5e9187d3cd601441b4af31 (diff)
Added support for loading .ogg audio files using a combination of
`SDL_RWFromConstMem()` + `Mix_LoadMUS/WAV_RW()`. `SDL_RWFromConstMem()` now returns an opaque reference that corresponds to a Javascript-side object which retains the information passed in. The same for `SDL_RWFromFile()` but it saves different information. When `Mix_LoadMUS/WAV_RW()` is called, it now expects a reference to one of those Javascript-side objects and from it, either uses a pre-loaded Audio, or reads bytes from the file-system to make one, or uses the bytes originally passed into `SDL_RWFromConstMem()` to create one. Note that with this change you can now simply embed sound files in your app, you do not need to preload them.
Diffstat (limited to 'tests/runner.py')
-rwxr-xr-xtests/runner.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/runner.py b/tests/runner.py
index ea702689..06d3a190 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -12536,11 +12536,13 @@ Press any key to continue.'''
def test_sdl_audio(self):
shutil.copyfile(path_from_root('tests', 'sounds', 'alarmvictory_1.ogg'), os.path.join(self.get_dir(), 'sound.ogg'))
shutil.copyfile(path_from_root('tests', 'sounds', 'alarmcreatemiltaryfoot_1.wav'), os.path.join(self.get_dir(), 'sound2.wav'))
+ shutil.copyfile(path_from_root('tests', 'sounds', 'noise.ogg'), os.path.join(self.get_dir(), 'noise.ogg'))
+ shutil.copyfile(path_from_root('tests', 'sounds', 'the_entertainer.ogg'), os.path.join(self.get_dir(), 'the_entertainer.ogg'))
open(os.path.join(self.get_dir(), 'bad.ogg'), 'w').write('I claim to be audio, but am lying')
open(os.path.join(self.get_dir(), 'sdl_audio.c'), 'w').write(self.with_report_result(open(path_from_root('tests', 'sdl_audio.c')).read()))
# use closure to check for a possible bug with closure minifying away newer Audio() attributes
- Popen([PYTHON, EMCC, '-O2', '--closure', '1', '--minify', '0', os.path.join(self.get_dir(), 'sdl_audio.c'), '--preload-file', 'sound.ogg', '--preload-file', 'sound2.wav', '--preload-file', 'bad.ogg', '-o', 'page.html', '-s', 'EXPORTED_FUNCTIONS=["_main", "_play", "_play2"]']).communicate()
+ Popen([PYTHON, EMCC, '-O2', '--closure', '1', '--minify', '0', os.path.join(self.get_dir(), 'sdl_audio.c'), '--preload-file', 'sound.ogg', '--preload-file', 'sound2.wav', '--embed-file', 'the_entertainer.ogg', '--preload-file', 'noise.ogg', '--preload-file', 'bad.ogg', '-o', 'page.html', '-s', 'EXPORTED_FUNCTIONS=["_main", "_play", "_play2"]']).communicate()
self.run_browser('page.html', '', '/report_result?1')
def test_sdl_audio_mix_channels(self):