LDLIBS += -lm -lpng
# tmp
-CFLAGS += `sdl-config --cflags`
+CFLAGS += `sdl-config --cflags` -DHAVE_SDL
LDLIBS += `sdl-config --libs`
all: PicoDrive
OBJS += platform/libpicofe/input.o platform/libpicofe/readpng.o \
platform/libpicofe/fonts.o platform/libpicofe/linux/in_evdev.o \
platform/libpicofe/linux/plat.o platform/libpicofe/linux/sndout_oss.o \
- platform/libpicofe/plat_sdl.o platform/libpicofe/in_sdl.o
+ platform/libpicofe/plat_sdl.o platform/libpicofe/in_sdl.o \
+ platform/libpicofe/sndout.o platform/libpicofe/sndout_sdl.o
OBJS += platform/libpicofe/plat_dummy.o
#include "../libpicofe/posix.h"\r
#include "../libpicofe/input.h"\r
#include "../libpicofe/fonts.h"\r
+#include "../libpicofe/sndout.h"\r
#include "../libpicofe/lprintf.h"\r
#include "../libpicofe/plat.h"\r
#include "emu.h"\r
int pico_inp_mode = 0;\r
int engineState = PGS_Menu;\r
\r
+static short __attribute__((aligned(4))) sndBuffer[2*44100/50];\r
+\r
/* tmp buff to reduce stack usage for plats with small stack */\r
static char static_buff[512];\r
const char *rom_fname_reload;\r
PicoMessage = plat_status_msg_busy_next;\r
PicoMCDopenTray = emu_tray_open;\r
PicoMCDcloseTray = emu_tray_close;\r
+\r
+ sndout_init();\r
}\r
\r
void emu_finish(void)\r
pprof_finish();\r
\r
PicoExit();\r
+ sndout_exit();\r
+}\r
+\r
+static void snd_write_nonblocking(int len)\r
+{\r
+ sndout_write_nb(PsndOut, len);\r
+}\r
+\r
+void emu_sound_start(void)\r
+{\r
+ PsndOut = NULL;\r
+\r
+ if (currentConfig.EmuOpt & EOPT_EN_SOUND)\r
+ {\r
+ int is_stereo = (PicoOpt & POPT_EN_STEREO) ? 1 : 0;\r
+\r
+ PsndRerate(Pico.m.frame_count ? 1 : 0);\r
+\r
+ printf("starting audio: %i len: %i stereo: %i, pal: %i\n",\r
+ PsndRate, PsndLen, is_stereo, Pico.m.pal);\r
+ sndout_start(PsndRate, is_stereo);\r
+ PicoWriteSound = snd_write_nonblocking;\r
+ plat_update_volume(0, 0);\r
+ memset(sndBuffer, 0, sizeof(sndBuffer));\r
+ PsndOut = sndBuffer;\r
+ }\r
+}\r
+\r
+void emu_sound_stop(void)\r
+{\r
+ sndout_stop();\r
+}\r
+\r
+void emu_sound_wait(void)\r
+{\r
+ sndout_wait();\r
}\r
\r
static void skip_frame(int do_audio)\r
\r
plat_video_loop_prepare();\r
pemu_loop_prep();\r
+ pemu_sound_start();\r
\r
/* number of ticks per frame */\r
if (Pico.m.pal) {\r
}\r
\r
pemu_loop_end();\r
+ emu_sound_stop();\r
\r
// pemu_loop_end() might want to do 1 frame for bg image,\r
// so free CD buffer here\r
void emu_set_fastforward(int set_on);
void emu_status_msg(const char *format, ...);
+/* default sound code */
+void emu_sound_start(void);
+void emu_sound_stop(void);
+void emu_sound_wait(void);
+
/* used by some (but not all) platforms */
void emu_cmn_forced_frame(int no_scale, int do_emu);
void pemu_finalize_frame(const char *fps, const char *notice_msg);
void pemu_sound_start(void);
-void pemu_sound_stop(void);
-void pemu_sound_wait(void);
void plat_early_init(void);
void plat_init(void);
PDebugZ80Frame();
if (in_menu_wait_any(NULL, 0) & PBTN_MA3)
break;
- pemu_sound_wait();
+ emu_sound_wait();
}
- pemu_sound_stop();
+ emu_sound_stop();
}
static void draw_text_debug(const char *str, int skip, int from)
// use buffer2 for menubg to save mem (using only buffers 0, 1 in menu)
g_menubg_ptr = gp2x_screens[2];
- // snd
- sndout_oss_init();
-
if (gp2x_dev_id == GP2X_DEV_CAANOO)
in_set_config(in_name_to_id("evdev:pollux-analog"), IN_CFG_KEY_NAMES,
caanoo_keys, sizeof(caanoo_keys));
dummy_finish();
break;
}
-
- sndout_oss_exit();
}
-Subproject commit 20b143089cc395dbcd51cac516a9e36f4ab6f5ac
+Subproject commit 26d3ca0d29e87a14943d29fcafc93da753df60cd
\r
#include "../libpicofe/menu.h"\r
#include "../libpicofe/plat.h"\r
-#include "../libpicofe/linux/sndout_oss.h"\r
#include "../common/emu.h"\r
#include "../common/arm_utils.h"\r
#include "version.h"\r
#include <pico/pico_int.h>\r
\r
\r
-static short __attribute__((aligned(4))) sndBuffer[2*44100/50];\r
const char *renderer_names[] = { "16bit accurate", " 8bit accurate", " 8bit fast", NULL };\r
const char *renderer_names32x[] = { "accurate", "faster", "fastest", NULL };\r
enum renderer_types { RT_16BIT, RT_8BIT_ACC, RT_8BIT_FAST, RT_COUNT };\r
g_menubg_src_ptr = g_screen_ptr;\r
}\r
\r
-static void oss_write_nonblocking(int len)\r
-{\r
- // sndout_oss_can_write() is not reliable, only use with no_frmlimit\r
- if ((currentConfig.EmuOpt & EOPT_NO_FRMLIMIT) && !sndout_oss_can_write(len))\r
- return;\r
-\r
- sndout_oss_write_nb(PsndOut, len);\r
-}\r
-\r
void pemu_sound_start(void)\r
{\r
- PsndOut = NULL;\r
-\r
- if (currentConfig.EmuOpt & EOPT_EN_SOUND)\r
- {\r
- int is_stereo = (PicoOpt & POPT_EN_STEREO) ? 1 : 0;\r
-\r
- PsndRerate(Pico.m.frame_count ? 1 : 0);\r
-\r
- printf("starting audio: %i len: %i stereo: %i, pal: %i\n",\r
- PsndRate, PsndLen, is_stereo, Pico.m.pal);\r
- sndout_oss_start(PsndRate, is_stereo, 1);\r
- sndout_oss_setvol(currentConfig.volume, currentConfig.volume);\r
- PicoWriteSound = oss_write_nonblocking;\r
- plat_update_volume(0, 0);\r
- memset(sndBuffer, 0, sizeof(sndBuffer));\r
- PsndOut = sndBuffer;\r
- }\r
-}\r
-\r
-void pemu_sound_stop(void)\r
-{\r
-}\r
-\r
-void pemu_sound_wait(void)\r
-{\r
- // don't need to do anything, writes will block by themselves\r
+ emu_sound_start();\r
}\r
\r
void plat_debug_cat(char *str)\r
{\r
apply_renderer();\r
osd_text = osd_text16;\r
-\r
- pemu_sound_start();\r
}\r
\r
void pemu_loop_end(void)\r
{\r
- pemu_sound_stop();\r
-\r
/* do one more frame for menu bg */\r
pemu_forced_frame(0, 1);\r
}\r
#include "../libpicofe/menu.h"
#include "../libpicofe/input.h"
-#include "../libpicofe/linux/sndout_oss.h"
#include "../common/emu.h"
#include "../common/input_pico.h"
#include "version.h"
memset(g_screen_ptr, 0, g_screen_width * g_screen_height * 2);
xlib_init();
#endif
-
- // snd
- sndout_oss_init();
}
void plat_finish(void)
#else
free(g_screen_ptr);
#endif
- sndout_oss_exit();
}
/* misc */