diff options
author | Franklin Wei <git@fwei.tk> | 2018-02-11 15:34:30 -0500 |
---|---|---|
committer | Franklin Wei <git@fwei.tk> | 2019-07-19 22:37:40 -0400 |
commit | 5d05b9d3e920a6aa5fcb553758e98ed0da8c91e4 (patch) | |
tree | 84406e21639529a185556a33e5de7f43cffc277b /apps/plugins/sdl/src/audio | |
parent | b70fecf21ddc21877ec1ae7888d9c18a979e37ad (diff) | |
download | rockbox-5d05b9d3e920a6aa5fcb553758e98ed0da8c91e4.tar.gz rockbox-5d05b9d3e920a6aa5fcb553758e98ed0da8c91e4.zip |
Quake!
This ports id Software's Quake to run on the SDL plugin runtime. The
source code originated from id under the GPLv2 license. I used
https://github.com/ahefner/sdlquake as the base of my port.
Performance is, unsurprisingly, not on par with what you're probably
used to on PC. I average about 10FPS on ipod6g, but it's still
playable.
Sound works well enough, but in-game music is not supported. I've
written ARM assembly routines for the inner sound loop. Make sure you
turn the "brightness" all the way down, or colors will look funky.
To run, extract Quake's data files to /.rockbox/quake. Have fun!
Change-Id: I4285036e967d7f0722802d43cf2096c808ca5799
Diffstat (limited to 'apps/plugins/sdl/src/audio')
-rw-r--r-- | apps/plugins/sdl/src/audio/SDL_audio.c | 1 | ||||
-rw-r--r-- | apps/plugins/sdl/src/audio/rockbox/SDL_rockboxaudio.c | 19 |
2 files changed, 19 insertions, 1 deletions
diff --git a/apps/plugins/sdl/src/audio/SDL_audio.c b/apps/plugins/sdl/src/audio/SDL_audio.c index 9c0feeddfc..f2a2e59323 100644 --- a/apps/plugins/sdl/src/audio/SDL_audio.c +++ b/apps/plugins/sdl/src/audio/SDL_audio.c | |||
@@ -204,6 +204,7 @@ int SDLCALL SDL_RunAudio(void *audiop) | |||
204 | 204 | ||
205 | /* Convert the audio if necessary */ | 205 | /* Convert the audio if necessary */ |
206 | if ( audio->convert.needed ) { | 206 | if ( audio->convert.needed ) { |
207 | LOGF("RB AUDIO: converting audio. Will be slow!"); | ||
207 | SDL_ConvertAudio(&audio->convert); | 208 | SDL_ConvertAudio(&audio->convert); |
208 | stream = audio->GetAudioBuf(audio); | 209 | stream = audio->GetAudioBuf(audio); |
209 | if ( stream == NULL ) { | 210 | if ( stream == NULL ) { |
diff --git a/apps/plugins/sdl/src/audio/rockbox/SDL_rockboxaudio.c b/apps/plugins/sdl/src/audio/rockbox/SDL_rockboxaudio.c index 78334303af..cb72687d48 100644 --- a/apps/plugins/sdl/src/audio/rockbox/SDL_rockboxaudio.c +++ b/apps/plugins/sdl/src/audio/rockbox/SDL_rockboxaudio.c | |||
@@ -225,12 +225,29 @@ static void ROCKBOXAUD_CloseAudio(_THIS) | |||
225 | rb->pcm_set_frequency(HW_SAMPR_DEFAULT); | 225 | rb->pcm_set_frequency(HW_SAMPR_DEFAULT); |
226 | } | 226 | } |
227 | 227 | ||
228 | static bool freq_ok(unsigned int freq) | ||
229 | { | ||
230 | for(int i = 0; i < SAMPR_NUM_FREQ; i++) | ||
231 | { | ||
232 | if(rb->hw_freq_sampr[i] == freq) | ||
233 | return true; | ||
234 | } | ||
235 | return false; | ||
236 | } | ||
237 | |||
228 | static int ROCKBOXAUD_OpenAudio(_THIS, SDL_AudioSpec *spec) | 238 | static int ROCKBOXAUD_OpenAudio(_THIS, SDL_AudioSpec *spec) |
229 | { | 239 | { |
230 | /* change to our format */ | 240 | /* change to our format */ |
231 | spec->format = AUDIO_S16SYS; | 241 | spec->format = AUDIO_S16SYS; |
232 | spec->channels = 2; | 242 | spec->channels = 2; |
233 | spec->freq = RB_SAMPR; | 243 | |
244 | if(!freq_ok(spec->freq)) | ||
245 | { | ||
246 | rb->splashf(HZ, "Warning: Unsupported audio rate. Defaulting to %d Hz", RB_SAMPR); | ||
247 | |||
248 | // switch to default | ||
249 | spec->freq = RB_SAMPR; | ||
250 | } | ||
234 | 251 | ||
235 | /* we've changed it */ | 252 | /* we've changed it */ |
236 | SDL_CalculateAudioSpec(spec); | 253 | SDL_CalculateAudioSpec(spec); |