Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <pspkernel.h>
- #include <pspaudio.h>
- #include <math.h>
- int exit_callback(int arg1, int arg2, void *common) {
- sceKernelExitGame();
- return 0; }
- int CallbackThread(SceSize args, void *argp) {
- int cbid;
- cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
- sceKernelRegisterExitCallback(cbid);
- sceKernelSleepThreadCB();
- return 0; }
- int SetupCallbacks() {
- int thid = 0;
- thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
- if(thid >= 0) sceKernelStartThread(thid, 0, 0);
- return thid; }
- PSP_MODULE_INFO("App",0,1,1);
- PSP_HEAP_SIZE_MAX();
- int main()
- {
- SetupCallbacks();
- short pcm[32768] = {0};
- int i;
- // On génère la sinusoide
- for (i=0; i<32768; i++) pcm[i] = 32700*sinf(i*0.3f);
- // On réserve un canal audio
- sceAudioChReserve(0, 32768, PSP_AUDIO_FORMAT_MONO);
- for (i=0; i<10; i++)
- {
- // On joue le sample 10x d'affilée, volume maximum
- sceAudioOutputBlocking(0, 0x8000, pcm);
- }
- // On libère le canal audio
- sceAudioChRelease(0);
- sceKernelExitGame();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement