diff options
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); |