Closed dbeef closed 4 years ago
Thanks to @TheMrIron2, here are Quake's PSP sources for a reference:
https://github.com/st1x51/DQuakePlus/blob/master/psp/sound.cpp
It uses 11025 Hz on input and upsamples them before passing to the platform-specific library.
Thanks to @mrneo240 - in fact it is possible to use platform-specific libraries to play non 44.1 kHz audio on the PSP:
https://github.com/z2442/sm64-port/blob/master/src/pc/audio/audio_psp.c
What worries me is that PSP refuses to open an audio device with any sampling rate other than 44100 Hz, forcing to use high precision audio format that bloats final binary size (as music and sounds are resource-compiled). Just for comparison, SpelunkyPSP Linux artifact before was ~5 MB, after ~16 MB.
Need to do some further research on this.
EDIT 1:
As I investigated, I started searching through the toolchain SDK sources and stumbled upon
psp-ports/SDL/src/audio/psp/SDL_pspaudio.c
, with the interesting fragment being:Which explains why I was refused to open an audio device with sampling frequency any other than 44100 Hz. Seems I am stuck to this format for good. Using platform-specific libraries directly most probably won't help either, judging by
pspaudio_kernel.h
:It must be some hardware constraint.
EDIT 2: Loading U8 encoded audio instead of S16LSB is not allowed either (same reason as in case of sampling rate, look at the
SDL_pspaudio.c
that I posted).EDIT 3: Concluding - by resource-compiling sounds and music, SpelunkyPSP artifact for the PSP (the .PBP file) grew from 1.7 MB to 14 MB - more than 8 times bigger! That's awful, but in the same time, PSP has in the worst case 32 MB (the PSP-1000 "fat" model), and in the best case 64 MB (every other model). The game itself needs roughly 1MB in the runtime, that still leaves about 17 MB for further development.
The problem will definitely reoccur in the far future when implementing another biomes (jungle, lava city, yeti level), as they have their own audio themes that I do not add in this MR. In such case, implementing filesystem support may happen to be required to finish the project.