mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
move more globals to PicoInterface
similar reasons as before
This commit is contained in:
parent
075672bf9f
commit
6311a3baf5
27 changed files with 244 additions and 247 deletions
|
@ -259,9 +259,9 @@ static int custom_read(menu_entry *me, const char *var, const char *val)
|
|||
|
||||
case MA_OPT_SOUND_QUALITY:
|
||||
if (strcasecmp(var, "Sound Quality") != 0) return 0;
|
||||
PsndRate = strtoul(val, &tmp, 10);
|
||||
if (PsndRate < 8000 || PsndRate > 44100)
|
||||
PsndRate = 22050;
|
||||
PicoIn.sndRate = strtoul(val, &tmp, 10);
|
||||
if (PicoIn.sndRate < 8000 || PicoIn.sndRate > 44100)
|
||||
PicoIn.sndRate = 22050;
|
||||
if (*tmp == 'H' || *tmp == 'h') tmp++;
|
||||
if (*tmp == 'Z' || *tmp == 'z') tmp++;
|
||||
while (*tmp == ' ') tmp++;
|
||||
|
|
|
@ -604,7 +604,7 @@ void emu_set_defconfig(void)
|
|||
{
|
||||
memcpy(¤tConfig, &defaultConfig, sizeof(currentConfig));
|
||||
PicoIn.opt = currentConfig.s_PicoOpt;
|
||||
PsndRate = currentConfig.s_PsndRate;
|
||||
PicoIn.sndRate = currentConfig.s_PsndRate;
|
||||
PicoIn.regionOverride = currentConfig.s_PicoRegion;
|
||||
PicoIn.autoRgnOrder = currentConfig.s_PicoAutoRgnOrder;
|
||||
}
|
||||
|
@ -958,10 +958,10 @@ void emu_set_fastforward(int set_on)
|
|||
static int set_Frameskip, set_EmuOpt, is_on = 0;
|
||||
|
||||
if (set_on && !is_on) {
|
||||
set_PsndOut = PsndOut;
|
||||
set_PsndOut = PicoIn.sndOut;
|
||||
set_Frameskip = currentConfig.Frameskip;
|
||||
set_EmuOpt = currentConfig.EmuOpt;
|
||||
PsndOut = NULL;
|
||||
PicoIn.sndOut = NULL;
|
||||
currentConfig.Frameskip = 8;
|
||||
currentConfig.EmuOpt &= ~4;
|
||||
currentConfig.EmuOpt |= 0x40000;
|
||||
|
@ -969,7 +969,7 @@ void emu_set_fastforward(int set_on)
|
|||
emu_status_msg("FAST FORWARD");
|
||||
}
|
||||
else if (!set_on && is_on) {
|
||||
PsndOut = set_PsndOut;
|
||||
PicoIn.sndOut = set_PsndOut;
|
||||
currentConfig.Frameskip = set_Frameskip;
|
||||
currentConfig.EmuOpt = set_EmuOpt;
|
||||
PsndRerate(1);
|
||||
|
@ -1253,9 +1253,9 @@ void emu_init(void)
|
|||
config_readlrom(path);
|
||||
|
||||
PicoInit();
|
||||
PicoMessage = plat_status_msg_busy_next;
|
||||
PicoMCDopenTray = emu_tray_open;
|
||||
PicoMCDcloseTray = emu_tray_close;
|
||||
PicoIn.osdMessage = plat_status_msg_busy_next;
|
||||
PicoIn.mcdTrayOpen = emu_tray_open;
|
||||
PicoIn.mcdTrayClose = emu_tray_close;
|
||||
|
||||
sndout_init();
|
||||
}
|
||||
|
@ -1285,12 +1285,12 @@ void emu_finish(void)
|
|||
|
||||
static void snd_write_nonblocking(int len)
|
||||
{
|
||||
sndout_write_nb(PsndOut, len);
|
||||
sndout_write_nb(PicoIn.sndOut, len);
|
||||
}
|
||||
|
||||
void emu_sound_start(void)
|
||||
{
|
||||
PsndOut = NULL;
|
||||
PicoIn.sndOut = NULL;
|
||||
|
||||
if (currentConfig.EmuOpt & EOPT_EN_SOUND)
|
||||
{
|
||||
|
@ -1299,12 +1299,12 @@ void emu_sound_start(void)
|
|||
PsndRerate(Pico.m.frame_count ? 1 : 0);
|
||||
|
||||
printf("starting audio: %i len: %i stereo: %i, pal: %i\n",
|
||||
PsndRate, PsndLen, is_stereo, Pico.m.pal);
|
||||
sndout_start(PsndRate, is_stereo);
|
||||
PicoWriteSound = snd_write_nonblocking;
|
||||
PicoIn.sndRate, Pico.snd.len, is_stereo, Pico.m.pal);
|
||||
sndout_start(PicoIn.sndRate, is_stereo);
|
||||
PicoIn.writeSound = snd_write_nonblocking;
|
||||
plat_update_volume(0, 0);
|
||||
memset(sndBuffer, 0, sizeof(sndBuffer));
|
||||
PsndOut = sndBuffer;
|
||||
PicoIn.sndOut = sndBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -610,7 +610,7 @@ static int mh_opt_misc(int id, int keys)
|
|||
{
|
||||
switch (id) {
|
||||
case MA_OPT_SOUND_QUALITY:
|
||||
PsndRate = sndrate_prevnext(PsndRate, keys & PBTN_RIGHT);
|
||||
PicoIn.sndRate = sndrate_prevnext(PicoIn.sndRate, keys & PBTN_RIGHT);
|
||||
break;
|
||||
case MA_OPT_REGION:
|
||||
region_prevnext(keys & PBTN_RIGHT);
|
||||
|
@ -674,7 +674,7 @@ static const char *mgn_opt_sound(int id, int *offs)
|
|||
const char *str2;
|
||||
*offs = -8;
|
||||
str2 = (PicoIn.opt & POPT_EN_STEREO) ? "stereo" : "mono";
|
||||
sprintf(static_buff, "%5iHz %s", PsndRate, str2);
|
||||
sprintf(static_buff, "%5iHz %s", PicoIn.sndRate, str2);
|
||||
return static_buff;
|
||||
}
|
||||
|
||||
|
@ -892,7 +892,7 @@ static void debug_menu_loop(void)
|
|||
if (inp & PBTN_UP) pv->debug_p ^= PVD_KILL_S_HI;
|
||||
if (inp & PBTN_MA2) pv->debug_p ^= PVD_KILL_32X;
|
||||
if (inp & PBTN_MOK) {
|
||||
PsndOut = NULL; // just in case
|
||||
PicoIn.sndOut = NULL; // just in case
|
||||
PicoIn.skipFrame = 1;
|
||||
PicoFrame();
|
||||
PicoIn.skipFrame = 0;
|
||||
|
|
|
@ -167,11 +167,11 @@ void mp3_update(int *buffer, int length, int stereo)
|
|||
return;
|
||||
|
||||
length_mp3 = length;
|
||||
if (PsndRate <= 11025 + 100) {
|
||||
if (PicoIn.sndRate <= 11025 + 100) {
|
||||
mix_samples = mix_16h_to_32_s2;
|
||||
length_mp3 <<= 2; shr = 2;
|
||||
}
|
||||
else if (PsndRate <= 22050 + 100) {
|
||||
else if (PicoIn.sndRate <= 22050 + 100) {
|
||||
mix_samples = mix_16h_to_32_s1;
|
||||
length_mp3 <<= 1; shr = 1;
|
||||
}
|
||||
|
|
|
@ -266,12 +266,12 @@ static void stdbg(const char *fmt, ...)
|
|||
static void updateSound(int len)
|
||||
{
|
||||
snd_all_samples += len / 2;
|
||||
PsndOut += len / 2;
|
||||
if (PsndOut - snd_cbuff >= snd_cbuf_samples)
|
||||
PicoIn.sndOut += len / 2;
|
||||
if (PicoIn.sndOut - snd_cbuff >= snd_cbuf_samples)
|
||||
{
|
||||
//if (PsndOut - snd_cbuff != snd_cbuf_samples)
|
||||
// stdbg("snd diff is %i, not %i", PsndOut - snd_cbuff, snd_cbuf_samples);
|
||||
PsndOut = snd_cbuff;
|
||||
//if (PicoIn.sndOut - snd_cbuff != snd_cbuf_samples)
|
||||
// stdbg("snd diff is %i, not %i", PicoIn.sndOut - snd_cbuff, snd_cbuf_samples);
|
||||
PicoIn.sndOut = snd_cbuff;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -317,7 +317,7 @@ static void RunEvents(unsigned int which)
|
|||
{
|
||||
int do_it = 1;
|
||||
|
||||
if (PsndOut != NULL)
|
||||
if (PicoIn.sndOut != NULL)
|
||||
FrameworkAudio_SetPause(1);
|
||||
if (giz_screen == NULL)
|
||||
giz_screen = fb_lock(1);
|
||||
|
@ -344,7 +344,7 @@ static void RunEvents(unsigned int which)
|
|||
Sleep(0);
|
||||
}
|
||||
|
||||
if (PsndOut != NULL)
|
||||
if (PicoIn.sndOut != NULL)
|
||||
FrameworkAudio_SetPause(0);
|
||||
reset_timing = 1;
|
||||
}
|
||||
|
@ -401,7 +401,7 @@ static void updateKeys(void)
|
|||
events = (allActions[0] | allActions[1]) >> 16;
|
||||
|
||||
// volume is treated in special way and triggered every frame
|
||||
if ((events & 0x6000) && PsndOut != NULL)
|
||||
if ((events & 0x6000) && PicoIn.sndOut != NULL)
|
||||
{
|
||||
int vol = currentConfig.volume;
|
||||
if (events & 0x2000) {
|
||||
|
@ -469,19 +469,19 @@ void pemu_loop(void)
|
|||
if (PicoIn.AHW & PAHW_MCD) PicoCDBufferInit();
|
||||
|
||||
// prepare sound stuff
|
||||
PsndOut = NULL;
|
||||
PicoIn.sndOut = NULL;
|
||||
if (currentConfig.EmuOpt & 4)
|
||||
{
|
||||
int ret, snd_excess_add, stereo;
|
||||
if (PsndRate != PsndRate_old || (PicoIn.opt&0x0b) != (PicoOpt_old&0x0b) || Pico.m.pal != pal_old) {
|
||||
if (PicoIn.sndRate != PsndRate_old || (PicoIn.opt&0x0b) != (PicoOpt_old&0x0b) || Pico.m.pal != pal_old) {
|
||||
PsndRerate(Pico.m.frame_count ? 1 : 0);
|
||||
}
|
||||
stereo=(PicoIn.opt&8)>>3;
|
||||
snd_excess_add = ((PsndRate - PsndLen*target_fps)<<16) / target_fps;
|
||||
snd_cbuf_samples = (PsndRate<<stereo) * 16 / target_fps;
|
||||
snd_excess_add = ((PicoIn.sndRate - Pico.snd.len*target_fps)<<16) / target_fps;
|
||||
snd_cbuf_samples = (PicoIn.sndRate<<stereo) * 16 / target_fps;
|
||||
lprintf("starting audio: %i len: %i (ex: %04x) stereo: %i, pal: %i\n",
|
||||
PsndRate, PsndLen, snd_excess_add, stereo, Pico.m.pal);
|
||||
ret = FrameworkAudio_Init(PsndRate, snd_cbuf_samples, stereo);
|
||||
PicoIn.sndRate, Pico.snd.len, snd_excess_add, stereo, Pico.m.pal);
|
||||
ret = FrameworkAudio_Init(PicoIn.sndRate, snd_cbuf_samples, stereo);
|
||||
if (ret != 0) {
|
||||
lprintf("FrameworkAudio_Init() failed: %i\n", ret);
|
||||
sprintf(noticeMsg, "sound init failed (%i), snd disabled", ret);
|
||||
|
@ -489,11 +489,11 @@ void pemu_loop(void)
|
|||
currentConfig.EmuOpt &= ~4;
|
||||
} else {
|
||||
FrameworkAudio_SetVolume(currentConfig.volume, currentConfig.volume);
|
||||
PicoWriteSound = updateSound;
|
||||
PicoIn.writeSound = updateSound;
|
||||
snd_cbuff = FrameworkAudio_56448Buffer();
|
||||
PsndOut = snd_cbuff + snd_cbuf_samples / 2; // start writing at the middle
|
||||
PicoIn.sndOut = snd_cbuff + snd_cbuf_samples / 2; // start writing at the middle
|
||||
snd_all_samples = 0;
|
||||
PsndRate_old = PsndRate;
|
||||
PsndRate_old = PicoIn.sndRate;
|
||||
PicoOpt_old = PicoIn.opt;
|
||||
pal_old = Pico.m.pal;
|
||||
}
|
||||
|
@ -553,14 +553,14 @@ void pemu_loop(void)
|
|||
//tval_thissec += 1000;
|
||||
tval_thissec += sec_ms;
|
||||
|
||||
if (PsndOut != NULL)
|
||||
if (PicoIn.sndOut != NULL)
|
||||
{
|
||||
/* some code which tries to sync things to audio clock, the dirty way */
|
||||
static int audio_skew_prev = 0;
|
||||
int audio_skew, adj, co = 9, shift = 7;
|
||||
audio_skew = snd_all_samples*2 - FrameworkAudio_BufferPos();
|
||||
if (PsndRate == 22050) co = 10;
|
||||
if (PsndRate > 22050) co = 11;
|
||||
if (PicoIn.sndRate == 22050) co = 10;
|
||||
if (PicoIn.sndRate > 22050) co = 11;
|
||||
if (PicoIn.opt&8) shift++;
|
||||
if (audio_skew < 0) {
|
||||
adj = -((-audio_skew) >> shift);
|
||||
|
@ -600,7 +600,7 @@ void pemu_loop(void)
|
|||
for (i = 0; i < currentConfig.Frameskip; i++) {
|
||||
updateKeys();
|
||||
SkipFrame(); frames_done++;
|
||||
if (PsndOut) { // do framelimitting if sound is enabled
|
||||
if (PicoIn.sndOut) { // do framelimitting if sound is enabled
|
||||
int tval_diff;
|
||||
tval = GetTickCount();
|
||||
tval_diff = (int)(tval - tval_thissec) << 8;
|
||||
|
@ -660,7 +660,7 @@ void pemu_loop(void)
|
|||
|
||||
if (currentConfig.Frameskip < 0 && tval_diff - lim_time >= (300<<8)) // slowdown detection
|
||||
reset_timing = 1;
|
||||
else if (PsndOut != NULL || currentConfig.Frameskip < 0)
|
||||
else if (PicoIn.sndOut != NULL || currentConfig.Frameskip < 0)
|
||||
{
|
||||
// sleep if we are still too fast
|
||||
if (tval_diff < lim_time)
|
||||
|
@ -676,8 +676,8 @@ void pemu_loop(void)
|
|||
|
||||
if (PicoIn.AHW & PAHW_MCD) PicoCDBufferFree();
|
||||
|
||||
if (PsndOut != NULL) {
|
||||
PsndOut = snd_cbuff = NULL;
|
||||
if (PicoIn.sndOut != NULL) {
|
||||
PicoIn.sndOut = snd_cbuff = NULL;
|
||||
FrameworkAudio_Close();
|
||||
}
|
||||
|
||||
|
|
|
@ -1046,7 +1046,7 @@ static void menu_opt_cust_draw(const menu_entry *entry, int x, int y, void *para
|
|||
break;
|
||||
case MA_OPT_SOUND_QUALITY:
|
||||
str = (PicoIn.opt&0x08)?"stereo":"mono";
|
||||
text_out16(x, y, "Sound Quality: %5iHz %s", PsndRate, str);
|
||||
text_out16(x, y, "Sound Quality: %5iHz %s", PicoIn.sndRate, str);
|
||||
break;
|
||||
case MA_OPT_REGION:
|
||||
text_out16(x, y, "Region: %s", me_region_name(PicoIn.regionOverride, PicoIn.autoRgnOrder));
|
||||
|
@ -1174,18 +1174,18 @@ static int menu_loop_options(void)
|
|||
}
|
||||
break;
|
||||
case MA_OPT_SOUND_QUALITY:
|
||||
if ((inp & PBTN_RIGHT) && PsndRate == 44100 &&
|
||||
if ((inp & PBTN_RIGHT) && PicoIn.sndRate == 44100 &&
|
||||
!(PicoIn.opt&0x08))
|
||||
{
|
||||
PsndRate = 11025;
|
||||
PicoIn.sndRate = 11025;
|
||||
PicoIn.opt |= 8;
|
||||
} else if ((inp & PBTN_LEFT) && PsndRate == 11025 &&
|
||||
} else if ((inp & PBTN_LEFT) && PicoIn.sndRate == 11025 &&
|
||||
(PicoIn.opt&0x08) && !(PicoIn.AHW&1))
|
||||
{
|
||||
PsndRate = 44100;
|
||||
PicoIn.sndRate = 44100;
|
||||
PicoIn.opt &= ~8;
|
||||
} else
|
||||
PsndRate = sndrate_prevnext(PsndRate, inp & PBTN_RIGHT);
|
||||
PicoIn.sndRate = sndrate_prevnext(PicoIn.sndRate, inp & PBTN_RIGHT);
|
||||
break;
|
||||
case MA_OPT_REGION:
|
||||
region_prevnext(inp & PBTN_RIGHT);
|
||||
|
|
|
@ -402,9 +402,9 @@ int YM2612UpdateOne_940(int *buffer, int length, int stereo, int is_buf_empty)
|
|||
writebuff_ptr = 0;
|
||||
|
||||
/* predict sample counter for next frame */
|
||||
if (PsndLen_exc_add) {
|
||||
length = PsndLen;
|
||||
if (PsndLen_exc_cnt + PsndLen_exc_add >= 0x10000) length++;
|
||||
if (Pico.snd.len_e_add) {
|
||||
length = Pico.snd.len;
|
||||
if (Pico.snd.len_e_cnt + Pico.snd.len_e_add >= 0x10000) length++;
|
||||
}
|
||||
|
||||
/* give 940 ym job */
|
||||
|
@ -463,11 +463,11 @@ int mp3dec_start(FILE *f, int fpos_start)
|
|||
|
||||
if (loaded_mp3 != f)
|
||||
{
|
||||
if (PicoMessage != NULL)
|
||||
if (PicoIn.osdMessage != NULL)
|
||||
{
|
||||
fseek(f, 0, SEEK_END);
|
||||
if (ftell(f) > 2*1024*1024)
|
||||
PicoMessage("Loading MP3...");
|
||||
PicoIn.osdMessage("Loading MP3...");
|
||||
}
|
||||
fseek(f, 0, SEEK_SET);
|
||||
fread(mp3_mem, 1, MP3_SIZE_MAX, f);
|
||||
|
|
|
@ -692,7 +692,7 @@ void pemu_sound_start(void)
|
|||
{
|
||||
soc = soc_detect();
|
||||
if (soc == SOCID_POLLUX) {
|
||||
PsndRate = pollux_get_real_snd_rate(PsndRate);
|
||||
PicoIn.sndRate = pollux_get_real_snd_rate(PicoIn.sndRate);
|
||||
PsndRerate(Pico.m.frame_count ? 1 : 0);
|
||||
}
|
||||
|
||||
|
@ -707,10 +707,10 @@ void pemu_sound_stop(void)
|
|||
int i;
|
||||
|
||||
/* get back from Pollux pain */
|
||||
PsndRate += 1000;
|
||||
PicoIn.sndRate += 1000;
|
||||
for (i = 0; i < ARRAY_SIZE(sound_rates); i++) {
|
||||
if (PsndRate >= sound_rates[i]) {
|
||||
PsndRate = sound_rates[i];
|
||||
if (PicoIn.sndRate >= sound_rates[i]) {
|
||||
PicoIn.sndRate = sound_rates[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1088,9 +1088,9 @@ bool retro_load_game(const struct retro_game_info *info)
|
|||
|
||||
PicoLoopPrepare();
|
||||
|
||||
PicoWriteSound = snd_write;
|
||||
PicoIn.writeSound = snd_write;
|
||||
memset(sndBuffer, 0, sizeof(sndBuffer));
|
||||
PsndOut = sndBuffer;
|
||||
PicoIn.sndOut = sndBuffer;
|
||||
PsndRerate(0);
|
||||
|
||||
return true;
|
||||
|
@ -1193,7 +1193,7 @@ static const unsigned short retro_pico_map[] = {
|
|||
|
||||
static void snd_write(int len)
|
||||
{
|
||||
audio_batch_cb(PsndOut, len / 4);
|
||||
audio_batch_cb(PicoIn.sndOut, len / 4);
|
||||
}
|
||||
|
||||
static enum input_device input_name_to_val(const char *name)
|
||||
|
@ -1375,7 +1375,7 @@ void retro_init(void)
|
|||
#endif
|
||||
PicoIn.opt |= POPT_EN_DRC;
|
||||
#endif
|
||||
PsndRate = 44100;
|
||||
PicoIn.sndRate = 44100;
|
||||
PicoIn.autoRgnOrder = 0x184; // US, EU, JP
|
||||
|
||||
vout_width = 320;
|
||||
|
@ -1390,9 +1390,9 @@ void retro_init(void)
|
|||
PicoDrawSetOutFormat(PDF_RGB555, 0);
|
||||
PicoDrawSetOutBuf(vout_buf, vout_width * 2);
|
||||
|
||||
//PicoMessage = plat_status_msg_busy_next;
|
||||
PicoMCDopenTray = disk_tray_open;
|
||||
PicoMCDcloseTray = disk_tray_close;
|
||||
//PicoIn.osdMessage = plat_status_msg_busy_next;
|
||||
PicoIn.mcdTrayOpen = disk_tray_open;
|
||||
PicoIn.mcdTrayClose = disk_tray_close;
|
||||
|
||||
update_variables();
|
||||
}
|
||||
|
|
|
@ -571,32 +571,32 @@ void pemu_sound_start(void)
|
|||
|
||||
samples_made = samples_done = 0;
|
||||
|
||||
if (PsndRate != PsndRate_old || (PicoIn.opt&0x0b) != (PicoOpt_old&0x0b) || Pico.m.pal != pal_old) {
|
||||
if (PicoIn.sndRate != PsndRate_old || (PicoIn.opt&0x0b) != (PicoOpt_old&0x0b) || Pico.m.pal != pal_old) {
|
||||
PsndRerate(Pico.m.frame_count ? 1 : 0);
|
||||
}
|
||||
stereo=(PicoIn.opt&8)>>3;
|
||||
|
||||
samples_block = Pico.m.pal ? SOUND_BLOCK_SIZE_PAL : SOUND_BLOCK_SIZE_NTSC;
|
||||
if (PsndRate <= 22050) samples_block /= 2;
|
||||
if (PicoIn.sndRate <= 22050) samples_block /= 2;
|
||||
sndBuffer_endptr = &sndBuffer[samples_block*SOUND_BLOCK_COUNT];
|
||||
|
||||
lprintf("starting audio: %i, len: %i, stereo: %i, pal: %i, block samples: %i\n",
|
||||
PsndRate, PsndLen, stereo, Pico.m.pal, samples_block);
|
||||
PicoIn.sndRate, Pico.snd.len, stereo, Pico.m.pal, samples_block);
|
||||
|
||||
// while (sceAudioOutput2GetRestSample() > 0) psp_msleep(100);
|
||||
// sceAudio_5C37C0AE();
|
||||
ret = sceAudio_38553111(samples_block/2, PsndRate, 2); // seems to not need that stupid 64byte alignment
|
||||
ret = sceAudio_38553111(samples_block/2, PicoIn.sndRate, 2); // seems to not need that stupid 64byte alignment
|
||||
if (ret < 0) {
|
||||
lprintf("sceAudio_38553111() failed: %i\n", ret);
|
||||
emu_status_msg("sound init failed (%i), snd disabled", ret);
|
||||
currentConfig.EmuOpt &= ~EOPT_EN_SOUND;
|
||||
} else {
|
||||
PicoWriteSound = writeSound;
|
||||
PicoIn.writeSound = writeSound;
|
||||
memset32((int *)(void *)sndBuffer, 0, sizeof(sndBuffer)/4);
|
||||
snd_playptr = sndBuffer_endptr - samples_block;
|
||||
samples_made = samples_block; // send 1 empty block first..
|
||||
PsndOut = sndBuffer;
|
||||
PsndRate_old = PsndRate;
|
||||
PicoIn.sndOut = sndBuffer;
|
||||
PsndRate_old = PicoIn.sndRate;
|
||||
PicoOpt_old = PicoIn.opt;
|
||||
pal_old = Pico.m.pal;
|
||||
}
|
||||
|
@ -641,16 +641,16 @@ static void writeSound(int len)
|
|||
{
|
||||
int ret;
|
||||
|
||||
PsndOut += len / 2;
|
||||
/*if (PsndOut > sndBuffer_endptr) {
|
||||
memcpy32((int *)(void *)sndBuffer, (int *)endptr, (PsndOut - endptr + 1) / 2);
|
||||
PsndOut = &sndBuffer[PsndOut - endptr];
|
||||
PicoIn.sndOut += len / 2;
|
||||
/*if (PicoIn.sndOut > sndBuffer_endptr) {
|
||||
memcpy32((int *)(void *)sndBuffer, (int *)endptr, (PicoIn.sndOut - endptr + 1) / 2);
|
||||
PicoIn.sndOut = &sndBuffer[PicoIn.sndOut - endptr];
|
||||
lprintf("mov\n");
|
||||
}
|
||||
else*/
|
||||
if (PsndOut > sndBuffer_endptr) lprintf("snd oflow %i!\n", PsndOut - sndBuffer_endptr);
|
||||
if (PsndOut >= sndBuffer_endptr)
|
||||
PsndOut = sndBuffer;
|
||||
if (PicoIn.sndOut > sndBuffer_endptr) lprintf("snd oflow %i!\n", PicoIn.sndOut - sndBuffer_endptr);
|
||||
if (PicoIn.sndOut >= sndBuffer_endptr)
|
||||
PicoIn.sndOut = sndBuffer;
|
||||
|
||||
// signal the snd thread
|
||||
samples_made += len / 2;
|
||||
|
@ -873,7 +873,7 @@ void pemu_loop(void)
|
|||
}
|
||||
|
||||
// prepare sound stuff
|
||||
PsndOut = NULL;
|
||||
PicoIn.sndOut = NULL;
|
||||
if (currentConfig.EmuOpt & EOPT_EN_SOUND)
|
||||
{
|
||||
pemu_sound_start();
|
||||
|
@ -1021,9 +1021,9 @@ void pemu_loop(void)
|
|||
|
||||
if (PicoIn.AHW & PAHW_MCD) PicoCDBufferFree();
|
||||
|
||||
if (PsndOut != NULL) {
|
||||
if (PicoIn.sndOut != NULL) {
|
||||
pemu_sound_stop();
|
||||
PsndOut = NULL;
|
||||
PicoIn.sndOut = NULL;
|
||||
}
|
||||
|
||||
// save SRAM
|
||||
|
|
|
@ -1227,7 +1227,7 @@ static void menu_opt_cust_draw(const menu_entry *entry, int x, int y, void *para
|
|||
break;
|
||||
case MA_OPT_SOUND_QUALITY:
|
||||
str = (PicoIn.opt&0x08)?"stereo":"mono";
|
||||
text_out16(x, y, "Sound Quality: %5iHz %s", PsndRate, str);
|
||||
text_out16(x, y, "Sound Quality: %5iHz %s", PicoIn.sndRate, str);
|
||||
break;
|
||||
case MA_OPT_REGION:
|
||||
text_out16(x, y, "Region: %s", me_region_name(PicoIn.regionOverride, PicoIn.autoRgnOrder));
|
||||
|
@ -1353,7 +1353,7 @@ static int menu_loop_options(void)
|
|||
}
|
||||
break;
|
||||
case MA_OPT_SOUND_QUALITY:
|
||||
PsndRate = sndrate_prevnext(PsndRate, inp & PBTN_RIGHT);
|
||||
PicoIn.sndRate = sndrate_prevnext(PicoIn.sndRate, inp & PBTN_RIGHT);
|
||||
break;
|
||||
case MA_OPT_REGION:
|
||||
region_prevnext(inp & PBTN_RIGHT);
|
||||
|
|
|
@ -403,8 +403,8 @@ void mp3_update(int *buffer, int length, int stereo)
|
|||
if (mp3_handle < 0 || mp3_src_pos >= mp3_src_size) return;
|
||||
|
||||
length_mp3 = length;
|
||||
if (PsndRate == 22050) length_mp3 <<= 1; // mp3s are locked to 44100Hz stereo
|
||||
else if (PsndRate == 11025) length_mp3 <<= 2; // so make length 44100ish
|
||||
if (PicoIn.sndRate == 22050) length_mp3 <<= 1; // mp3s are locked to 44100Hz stereo
|
||||
else if (PicoIn.sndRate == 11025) length_mp3 <<= 2; // so make length 44100ish
|
||||
|
||||
/* do we have to wait? */
|
||||
if (mp3_job_started && mp3_samples_ready < length_mp3)
|
||||
|
@ -420,8 +420,8 @@ void mp3_update(int *buffer, int length, int stereo)
|
|||
{
|
||||
int shr = 0;
|
||||
void (*mix_samples)(int *dest_buf, short *mp3_buf, int count) = mix_16h_to_32;
|
||||
if (PsndRate == 22050) { mix_samples = mix_16h_to_32_s1; shr = 1; }
|
||||
else if (PsndRate == 11025) { mix_samples = mix_16h_to_32_s2; shr = 2; }
|
||||
if (PicoIn.sndRate == 22050) { mix_samples = mix_16h_to_32_s1; shr = 1; }
|
||||
else if (PicoIn.sndRate == 11025) { mix_samples = mix_16h_to_32_s2; shr = 2; }
|
||||
|
||||
if (1152 - mp3_buffer_offs >= length_mp3) {
|
||||
mix_samples(buffer, mp3_mix_buffer[mp3_play_bufsel] + mp3_buffer_offs*2, length<<1);
|
||||
|
|
|
@ -131,7 +131,7 @@ void pemu_sound_start(void)
|
|||
{
|
||||
int ret;
|
||||
|
||||
PsndOut = NULL;
|
||||
PicoIn.sndOut = NULL;
|
||||
currentConfig.EmuOpt &= ~EOPT_EXT_FRMLIMIT;
|
||||
|
||||
// prepare sound stuff
|
||||
|
@ -139,14 +139,14 @@ void pemu_sound_start(void)
|
|||
{
|
||||
PsndRerate(0);
|
||||
|
||||
ret = DSoundInit(FrameWnd, PsndRate, (PicoIn.opt & POPT_EN_STEREO) ? 1 : 0, PsndLen);
|
||||
ret = DSoundInit(FrameWnd, PicoIn.sndRate, (PicoIn.opt & POPT_EN_STEREO) ? 1 : 0, Pico.snd.len);
|
||||
if (ret != 0) {
|
||||
lprintf("dsound init failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
PsndOut = (void *)sndbuff;
|
||||
PicoWriteSound = update_sound;
|
||||
PicoIn.sndOut = (void *)sndbuff;
|
||||
PicoIn.writeSound = update_sound;
|
||||
currentConfig.EmuOpt |= EOPT_EXT_FRMLIMIT;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue