support multiple sound drivers
[picodrive.git] / platform / linux / emu.c
index cf05dbc..25bb05c 100644 (file)
@@ -1,14 +1,16 @@
-// (c) Copyright 2006-2009 notaz, All rights reserved.\r
-// Free for non-commercial use.\r
-\r
-// For commercial use, separate licencing terms must be obtained.\r
+/*\r
+ * PicoDrive\r
+ * (C) notaz, 2006-2010\r
+ *\r
+ * This work is licensed under the terms of MAME license.\r
+ * See COPYING file in the top-level directory.\r
+ */\r
 \r
 #include <stdio.h>\r
 #include <unistd.h>\r
 \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
@@ -16,7 +18,6 @@
 #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
@@ -168,20 +169,6 @@ void plat_video_toggle_renderer(int change, int is_menu)
        emu_status_msg(renderer_names[currentConfig.renderer]);\r
 }\r
 \r
-void plat_video_menu_enter(int is_rom_loaded)\r
-{\r
-}\r
-\r
-void plat_video_menu_begin(void)\r
-{\r
-       g_menuscreen_ptr = g_screen_ptr;\r
-}\r
-\r
-void plat_video_menu_end(void)\r
-{\r
-       plat_video_flip();\r
-}\r
-\r
 void plat_status_msg_clear(void)\r
 {\r
        unsigned short *d = (unsigned short *)g_screen_ptr + g_screen_width * g_screen_height;\r
@@ -220,43 +207,9 @@ void pemu_forced_frame(int no_scale, int do_emu)
        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
@@ -273,14 +226,10 @@ void pemu_loop_prep(void)
 {\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