summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
7bc9cd7)
}\r
writebuff_ptr = 0;\r
\r
}\r
writebuff_ptr = 0;\r
\r
+ /* predict sample counter for next frame */\r
+ if (PsndLen_exc_add) {\r
+ if (PsndLen_exc_cnt + PsndLen_exc_add >= 0x10000) length = PsndLen + 1;\r
+ else length = PsndLen;\r
+ }\r
+\r
/* give 940 ym job */\r
shared_ctl->writebuffsel ^= 1;\r
shared_ctl->length = length;\r
/* give 940 ym job */\r
shared_ctl->writebuffsel ^= 1;\r
shared_ctl->length = length;\r
\r
extern int crashed_940;\r
\r
\r
extern int crashed_940;\r
\r
+static short sndBuffer[2*44100/50];\r
static char noticeMsg[64]; // notice msg to draw\r
static struct timeval noticeMsgTime = { 0, 0 }; // when started showing\r
static int reset_timing, osd_fps_x;\r
static char noticeMsg[64]; // notice msg to draw\r
static struct timeval noticeMsgTime = { 0, 0 }; // when started showing\r
static int reset_timing, osd_fps_x;\r
prevEvents = (allActions[0] | allActions[1]) >> 16;\r
}\r
\r
prevEvents = (allActions[0] | allActions[1]) >> 16;\r
}\r
\r
-static int snd_excess_add = 0, snd_excess_cnt = 0; // hack\r
-static void updateSound(void)\r
+static void updateSound(int len)\r
- int len = (PicoOpt&8)?PsndLen*2:PsndLen;\r
-\r
- snd_excess_cnt += snd_excess_add;\r
- if (snd_excess_cnt >= 0x10000) {\r
- snd_excess_cnt -= 0x10000;\r
- if (PicoOpt&8) {\r
- PsndOut[len] = PsndOut[len-2];\r
- PsndOut[len+1] = PsndOut[len-1];\r
- len+=2;\r
- } else {\r
- PsndOut[len] = PsndOut[len-1];\r
- len++;\r
- }\r
- }\r
+ if (PicoOpt&8) len<<=1;\r
\r
gp2x_sound_write(PsndOut, len<<1);\r
}\r
\r
gp2x_sound_write(PsndOut, len<<1);\r
}\r
\r
// prepare sound stuff\r
if(currentConfig.EmuOpt & 4) {\r
\r
// prepare sound stuff\r
if(currentConfig.EmuOpt & 4) {\r
if(PsndRate != PsndRate_old || (PicoOpt&0x20b) != (PicoOpt_old&0x20b) || Pico.m.pal != pal_old || crashed_940) {\r
/* if 940 is turned off, we need it to be put back to sleep */\r
if (!(PicoOpt&0x200) && ((PicoOpt^PicoOpt_old)&0x200)) {\r
Reset940(1, 2);\r
Pause940(1);\r
}\r
if(PsndRate != PsndRate_old || (PicoOpt&0x20b) != (PicoOpt_old&0x20b) || Pico.m.pal != pal_old || crashed_940) {\r
/* if 940 is turned off, we need it to be put back to sleep */\r
if (!(PicoOpt&0x200) && ((PicoOpt^PicoOpt_old)&0x200)) {\r
Reset940(1, 2);\r
Pause940(1);\r
}\r
}\r
//excess_samples = PsndRate - PsndLen*target_fps;\r
}\r
//excess_samples = PsndRate - PsndLen*target_fps;\r
snd_excess_add = ((PsndRate - PsndLen*target_fps)<<16) / target_fps;\r
printf("starting audio: %i len: %i (ex: %04x) stereo: %i, pal: %i\n", PsndRate, PsndLen, snd_excess_add, (PicoOpt&8)>>3, Pico.m.pal);\r
gp2x_start_sound(PsndRate, 16, (PicoOpt&8)>>3);\r
gp2x_sound_volume(currentConfig.volume, currentConfig.volume);\r
PicoWriteSound = updateSound;\r
snd_excess_add = ((PsndRate - PsndLen*target_fps)<<16) / target_fps;\r
printf("starting audio: %i len: %i (ex: %04x) stereo: %i, pal: %i\n", PsndRate, PsndLen, snd_excess_add, (PicoOpt&8)>>3, Pico.m.pal);\r
gp2x_start_sound(PsndRate, 16, (PicoOpt&8)>>3);\r
gp2x_sound_volume(currentConfig.volume, currentConfig.volume);\r
PicoWriteSound = updateSound;\r
- PsndOut = calloc((PicoOpt&8) ? (PsndLen*4+4) : (PsndLen*2+2), 1);\r
+ memset(sndBuffer, 0, sizeof(sndBuffer));\r
+ PsndOut = sndBuffer;\r
PsndRate_old = PsndRate;\r
PsndLen_real = PsndLen;\r
PicoOpt_old = PicoOpt;\r
PsndRate_old = PsndRate;\r
PsndLen_real = PsndLen;\r
PicoOpt_old = PicoOpt;\r
emu_SaveLoadGame(0, 1);\r
SRam.changed = 0;\r
}\r
emu_SaveLoadGame(0, 1);\r
SRam.changed = 0;\r
}\r
-\r
- if (PsndOut != 0) {\r
- free(PsndOut);\r
- PsndOut = 0;\r
- }\r