Previous 199869 Revisions Next

r34584 Saturday 24th January, 2015 at 01:20:18 UTC by Couriersud
Converted sound modules to be osd_modules. Simplified code. (nw)
[src/osd/modules]osdmodule.h
[src/osd/modules/font]font_none.c font_sdl.c
[src/osd/modules/lib]osdobj_common.c osdobj_common.h
[src/osd/modules/sound]direct_sound.c direct_sound.h js_sound.c js_sound.h none.c none.h sdl_sound.c sdl_sound.h sound_module.h*
[src/osd/sdl]osdsdl.h sdl.mak sdlmain.c
[src/osd/windows]windows.mak winmain.c winmain.h

trunk/src/osd/modules/font/font_none.c
r243095r243096
66#include "font_module.h"
77#include "modules/osdmodule.h"
88
9#include "astring.h"
10#include "corealloc.h"
11#include "fileio.h"
12
139//-------------------------------------------------
1410//  font_open - attempt to "open" a handle to the
1511//  font with the given name
trunk/src/osd/modules/font/font_sdl.c
r243095r243096
338338        return global_alloc(osd_font_sdl);
339339    }
340340
341    virtual void init()
341    int init()
342342    {
343343        if (TTF_Init() == -1)
344344        {
345345            osd_printf_error("SDL_ttf failed: %s\n", TTF_GetError());
346            return -1;
346347        }
348        return 0;
347349    }
348350
349351    virtual void exit()
trunk/src/osd/modules/lib/osdobj_common.c
r243095r243096
1111
1212#include "emu.h"
1313#include "osdepend.h"
14#include "modules/sound/none.h"
1514#include "modules/debugger/none.h"
1615#include "modules/debugger/debugint.h"
1716#include "modules/lib/osdobj_common.h"
r243095r243096
119118    REGISTER_MODULE(m_mod_man, FONT_SDL);
120119    REGISTER_MODULE(m_mod_man, FONT_NONE);
121120
121    REGISTER_MODULE(m_mod_man, SOUND_DSOUND);
122    REGISTER_MODULE(m_mod_man, SOUND_JS);
123    REGISTER_MODULE(m_mod_man, SOUND_SDL);
124    REGISTER_MODULE(m_mod_man, SOUND_NONE);
125
122126    // after initialization we know which modules are supported
123127
124128    const char *names[20];
r243095r243096
129133        dnames.append(names[i]);
130134    update_option(OSD_FONT_PROVIDER, dnames);
131135
136    m_mod_man.get_module_names(OSD_SOUND_PROVIDER, 20, &num, names);
137    dnames.reset();
138    for (int i = 0; i < num; i++)
139        dnames.append(names[i]);
140    update_option(OSD_SOUND_PROVIDER, dnames);
132141
133
134
135
136142    // Register video options and update options
137143    video_options_add("none", NULL);
138144    video_register();
139145    update_option(OSDOPTION_VIDEO, m_video_names);
140146
141    // Register sound options and update options
142    sound_options_add("none", OSD_SOUND_NONE);
143    sound_register();
144    update_option(OSDOPTION_SOUND, m_sound_names);
145
146147    // Register debugger options and update options
147148    debugger_options_add("none", OSD_DEBUGGER_NONE);
148149    debugger_options_add("internal", OSD_DEBUGGER_INTERNAL);
r243095r243096
180181      osd_free(const_cast<char*>(m_video_names[i]));
181182   //m_video_options,reset();
182183
183   for(int i= 0; i < m_sound_names.count(); ++i)
184      osd_free(const_cast<char*>(m_sound_names[i]));
185   m_sound_options.reset();
186
187184   for(int i= 0; i < m_debugger_names.count(); ++i)
188185      osd_free(const_cast<char*>(m_debugger_names[i]));
189186   m_debugger_options.reset();
r243095r243096
233230   if (options.verbose())
234231      g_print_verbose = true;
235232
236    m_font_module = select_module_options<font_module *>(options, OSD_FONT_PROVIDER);
237
238    m_mod_man.init();
239
240
241233   // ensure we get called on the way out
242234   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(osd_common_t::osd_exit), this));
243235}
r243095r243096
327319   // It provides an array of stereo samples in L-R order which should be
328320   // output at the configured sample_rate.
329321   //
330    if (m_sound != NULL)
331        m_sound->update_audio_stream(buffer,samples_this_frame);
322    m_sound->update_audio_stream(m_machine->video().throttled(), buffer,samples_this_frame);
332323}
333324
334325
r243095r243096
449440      exit(-1);
450441   }
451442
452   sound_init();
453443   input_init();
454444   // we need pause callbacks
455445   machine().add_notifier(MACHINE_NOTIFY_PAUSE, machine_notify_delegate(FUNC(osd_common_t::input_pause), this));
r243095r243096
460450   network_init();
461451#endif
462452   midi_init();
453
454    m_font_module = select_module_options<font_module *>(options(), OSD_FONT_PROVIDER);
455
456    m_sound = select_module_options<sound_module *>(options(), OSD_SOUND_PROVIDER);
457    m_sound->m_sample_rate = options().sample_rate();
458    m_sound->m_audio_latency = options().audio_latency();
459
460    m_mod_man.init();
461
463462}
464463
465464bool osd_common_t::video_init()
r243095r243096
472471   return true;
473472}
474473
475bool osd_common_t::sound_init()
476{
477   osd_sound_type sound = m_sound_options.find(options().sound());
478   if (sound==NULL)
479   {
480      osd_printf_warning("sound_init: option %s not found switching to auto\n",options().sound());
481      sound = m_sound_options.find("auto");
482   }
483   if (sound != NULL)
484       m_sound = (*sound)(*this, machine());
485   else
486       m_sound = NULL;
487   return true;
488}
489
490474bool osd_common_t::no_sound()
491475{
492476   return (strcmp(options().sound(),"none")==0) ? true : false;
r243095r243096
496480{
497481}
498482
499void osd_common_t::sound_register()
500{
501}
502
503483void osd_common_t::debugger_register()
504484{
505485}
r243095r243096
530510void osd_common_t::exit_subsystems()
531511{
532512   video_exit();
533   sound_exit();
534513   input_exit();
535514   output_exit();
536515   #ifdef USE_NETWORK
r243095r243096
548527{
549528}
550529
551void osd_common_t::sound_exit()
552{
553    if (m_sound != NULL)
554        global_free(m_sound);
555}
556
557530void osd_common_t::input_exit()
558531{
559532}
r243095r243096
579552   m_video_names.append(core_strdup(name));
580553}
581554
582void osd_common_t::sound_options_add(const char *name, osd_sound_type type)
583{
584   m_sound_options.add(name, type, false);
585   m_sound_names.append(core_strdup(name));
586}
587
588555void osd_common_t::debugger_options_add(const char *name, osd_debugger_type type)
589556{
590557   m_debugger_options.add(name, type, false);
r243095r243096
603570}
604571
605572//-------------------------------------------------
606//  osd_sound_interface - constructor
607//-------------------------------------------------
608
609osd_sound_interface::osd_sound_interface(const osd_interface &osd, running_machine &machine)
610    : m_osd(osd), m_machine(machine)
611{
612}
613
614//-------------------------------------------------
615//  osd_sound_interface - destructor
616//-------------------------------------------------
617
618osd_sound_interface::~osd_sound_interface()
619{
620}
621
622//-------------------------------------------------
623573//  osd_debugger_interface - constructor
624574//-------------------------------------------------
625575
trunk/src/osd/modules/lib/osdobj_common.h
r243095r243096
1616#include "osdepend.h"
1717#include "modules/osdmodule.h"
1818#include "modules/font/font_module.h"
19#include "modules/sound/sound_module.h"
1920#include "cliopts.h"
2021
2122//============================================================
r243095r243096
103104    static const options_entry s_option_entries[];
104105};
105106
106class osd_sound_interface;
107107class osd_debugger_interface;
108108
109109// a osd_sound_type is simply a pointer to its alloc function
110typedef osd_sound_interface *(*osd_sound_type)(const osd_interface &osd, running_machine &machine);
111
112// a osd_sound_type is simply a pointer to its alloc function
113110typedef osd_debugger_interface *(*osd_debugger_type)(const osd_interface &osd);
114111
115112
r243095r243096
172169    virtual void video_register();
173170    virtual bool window_init();
174171
175    virtual bool sound_init();
176    virtual void sound_register();
177
178172    virtual void input_resume();
179173    virtual bool output_init();
180174    virtual bool network_init();
r243095r243096
183177    virtual void exit_subsystems();
184178    virtual void video_exit();
185179    virtual void window_exit();
186    virtual void sound_exit();
187180    virtual void input_exit();
188181    virtual void output_exit();
189182    virtual void network_exit();
r243095r243096
192185    virtual void osd_exit();
193186
194187    virtual void video_options_add(const char *name, void *type);
195    virtual void sound_options_add(const char *name, osd_sound_type type);
196188    virtual void debugger_options_add(const char *name, osd_debugger_type type);
197189
198190    osd_options &options() { return m_options; }
r243095r243096
231223    }
232224
233225protected:
234   osd_sound_interface* m_sound;
226   sound_module* m_sound;
235227   osd_debugger_interface* m_debugger;
236228private:
237229   //tagmap_t<osd_video_type>  m_video_options;
238230   dynamic_array<const char *> m_video_names;
239   tagmap_t<osd_sound_type>  m_sound_options;
240   dynamic_array<const char *> m_sound_names;
241231   tagmap_t<osd_debugger_type>  m_debugger_options;
242232   dynamic_array<const char *> m_debugger_names;
243233};
244234
245235
246class osd_sound_interface
247{
248public:
249   // construction/destruction
250   osd_sound_interface(const osd_interface &osd, running_machine &machine);
251   virtual ~osd_sound_interface();
252
253   virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame) = 0;
254   virtual void set_mastervolume(int attenuation) = 0;
255protected:
256   const osd_interface& m_osd;
257   running_machine& m_machine;
258};
259
260// this template function creates a stub which constructs a sound subsystem
261template<class _DeviceClass>
262osd_sound_interface *osd_sound_creator(const osd_interface &osd, running_machine &machine)
263{
264   return global_alloc(_DeviceClass(osd, machine));
265}
266
267236class osd_debugger_interface
268237{
269238public:
trunk/src/osd/modules/osdmodule.h
r243095r243096
3636
3737    virtual bool probe() const { return true; }
3838
39    virtual void init() {  }
40    virtual void exit() {  }
39    virtual int init() { return 0; }
40    virtual void exit() { }
4141
4242private:
4343    astring     m_name;
trunk/src/osd/modules/sound/direct_sound.c
r243095r243096
66//
77//============================================================
88
9#include "sound_module.h"
10#include "modules/osdmodule.h"
11
12#if defined(OSD_WINDOWS) || defined(SDLMAME_WIN32)
13
914// standard windows headers
1015#define WIN32_LEAN_AND_MEAN
1116#include <windows.h>
r243095r243096
2126#include "osdepend.h"
2227#include "emuopts.h"
2328
24// MAMEOS headers
25#include "direct_sound.h"
26
2729#ifdef SDLMAME_WIN32
2830#include "../../sdl/osdsdl.h"
2931#if (SDLMAME_SDL2)
r243095r243096
4547
4648#define LOG(x) do { if (LOG_SOUND) logerror x; } while(0)
4749
50class sound_direct_sound : public osd_module, public sound_module
51{
52public:
4853
54    sound_direct_sound()
55    : osd_module(OSD_SOUND_PROVIDER, "dsound"), sound_module()
56    {
57    }
58    virtual ~sound_direct_sound() { }
59
60    virtual int init();
61    virtual void exit();
62
63    // sound_module
64
65    virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame);
66    virtual void set_mastervolume(int attenuation);
67
68private:
69    HRESULT      dsound_init();
70    void         dsound_kill();
71    HRESULT      dsound_create_buffers();
72    void         dsound_destroy_buffers();
73    void         copy_sample_data(const INT16 *data, int bytes_to_copy);
74
75};
76
77
78
4979//============================================================
5080//  LOCAL VARIABLES
5181//============================================================
r243095r243096
6999// buffer over/underflow counts
70100static int                  buffer_underflows;
71101static int                  buffer_overflows;
102
72103//============================================================
73104//  PROTOTYPES
74105//============================================================
75106
76const osd_sound_type OSD_SOUND_DIRECT_SOUND = &osd_sound_creator<sound_direct_sound>;
77
78107//-------------------------------------------------
79108//  sound_direct_sound - constructor
80109//-------------------------------------------------
81sound_direct_sound::sound_direct_sound(const osd_interface &osd, running_machine &machine)
82   : osd_sound_interface(osd, machine)
110
111int sound_direct_sound::init()
83112{
84113   // attempt to initialize directsound
85114   // don't make it fatal if we can't -- we'll just run without sound
86115   dsound_init();
116   return 0;
87117}
88118
89119
90sound_direct_sound::~sound_direct_sound()
120void sound_direct_sound::exit()
91121{
92122   // kill the buffers and dsound
93123   dsound_destroy_buffers();
r243095r243096
149179//  update_audio_stream
150180//============================================================
151181
152void sound_direct_sound::update_audio_stream(const INT16 *buffer, int samples_this_frame)
182void sound_direct_sound::update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame)
153183{
154184   int bytes_this_frame = samples_this_frame * stream_format.nBlockAlign;
155185   DWORD play_position, write_position;
r243095r243096
268298   stream_format.wBitsPerSample    = 16;
269299   stream_format.wFormatTag        = WAVE_FORMAT_PCM;
270300   stream_format.nChannels         = 2;
271   stream_format.nSamplesPerSec    = m_machine.sample_rate();
301   stream_format.nSamplesPerSec    = sample_rate();
272302   stream_format.nBlockAlign       = stream_format.wBitsPerSample * stream_format.nChannels / 8;
273303   stream_format.nAvgBytesPerSec   = stream_format.nSamplesPerSec * stream_format.nBlockAlign;
274304
275305
276306   // compute the buffer size based on the output sample rate
277307   int audio_latency;
278   #ifdef SDLMAME_WIN32
279   audio_latency = downcast<sdl_options &>(m_machine.options()).audio_latency();
280   #else
281   audio_latency = downcast<windows_options &>(m_machine.options()).audio_latency();
282   #endif
308   audio_latency = m_audio_latency;
309
283310   stream_buffer_size = stream_format.nSamplesPerSec * stream_format.nBlockAlign * audio_latency / 10;
284311   stream_buffer_size = (stream_buffer_size / 1024) * 1024;
285312   if (stream_buffer_size < 1024)
r243095r243096
419446      IDirectSoundBuffer_Release(primary_buffer);
420447   primary_buffer = NULL;
421448}
449
450#else /* SDLMAME_UNIX */
451    MODULE_NOT_SUPPORTED(sound_direct_sound, OSD_SOUND_PROVIDER, "dsound")
452#endif
453
454MODULE_DEFINITION(SOUND_DSOUND, sound_direct_sound)
trunk/src/osd/modules/sound/direct_sound.h
r243095r243096
1// license:BSD-3-Clause
2// copyright-holders:Aaron Giles
3//============================================================
4//
5//  sound.c - Win32 implementation of MAME sound routines
6//
7//============================================================
8#pragma once
9
10#ifndef __SOUND_DSOUND_H__
11#define __SOUND_DSOUND_H__
12
13// standard windows headers
14#define WIN32_LEAN_AND_MEAN
15#include <windows.h>
16#include <mmsystem.h>
17
18// undef WINNT for dsound.h to prevent duplicate definition
19#undef WINNT
20#include <dsound.h>
21#undef interface
22
23#include "osdepend.h"
24#include "modules/lib/osdobj_common.h"
25
26class sound_direct_sound : public osd_sound_interface
27{
28public:
29   // construction/destruction
30   sound_direct_sound(const osd_interface &osd, running_machine &machine);
31   virtual ~sound_direct_sound();
32
33   virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame);
34   virtual void set_mastervolume(int attenuation);
35
36   HRESULT      dsound_init();
37   void         dsound_kill();
38   HRESULT      dsound_create_buffers();
39   void         dsound_destroy_buffers();
40   void         copy_sample_data(const INT16 *data, int bytes_to_copy);
41private:
42};
43
44extern const osd_sound_type OSD_SOUND_DIRECT_SOUND;
45
46#endif  /* __SOUND_DSOUND_H__ */
trunk/src/osd/modules/sound/js_sound.c
r243095r243096
88
99*******************************************************************c********/
1010
11#include "sound_module.h"
12#include "modules/osdmodule.h"
1113
14#if (defined(SDLMAME_EMSCRIPTEN))
15
1216#include "js_sound.h"
1317#include "emscripten.h"
1418
15//-------------------------------------------------
16//  sound_js - constructor
17//-------------------------------------------------
18sound_js::sound_js(const osd_interface &osd)
19   : osd_sound_interface(osd)
19class sound_js : public osd_module, public sound_module
2020{
21}
21public:
2222
23void sound_js::update_audio_stream(const INT16 *buffer, int samples_this_frame)
24{
25   EM_ASM_ARGS({
26   // Forward audio stream update on to JS backend implementation.
27   jsmess_update_audio_stream($0, $1);
28   }, (unsigned int)buffer, samples_this_frame);
29}
23    sound_js()
24    : osd_module(OSD_SOUND_PROVIDER, "js"), sound_module()
25    {
26    }
27    virtual ~sound_js() { }
3028
31void sound_js::set_mastervolume(int attenuation)
32{
33   EM_ASM_ARGS({
34   // Forward volume update on to JS backend implementation.
35   jsmess_set_mastervolume($0);
36   }, attenuation);
37}
29    virtual int init();
30    virtual void exit();
3831
39const osd_sound_type OSD_SOUND_JS = &osd_sound_creator<sound_js>;
32    // sound_module
33
34    virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame)
35    {
36        EM_ASM_ARGS({
37        // Forward audio stream update on to JS backend implementation.
38        jsmess_update_audio_stream($1, $2);
39        }, (unsigned int)buffer, samples_this_frame);
40    }
41    virtual void set_mastervolume(int attenuation)
42    {
43        EM_ASM_ARGS({
44        // Forward volume update on to JS backend implementation.
45        jsmess_set_mastervolume($0);
46        }, attenuation);
47    }
48
49};
50
51#else /* SDLMAME_UNIX */
52    MODULE_NOT_SUPPORTED(sound_js, OSD_SOUND_PROVIDER, "js")
53#endif
54
55MODULE_DEFINITION(SOUND_JS, sound_js)
trunk/src/osd/modules/sound/js_sound.h
r243095r243096
1// license:BSD-3-Clause
2// copyright-holders:Miodrag Milanovic, Katelyn Gadd
3/***************************************************************************
4
5    js_sound.h
6
7    Shim for native JavaScript sound interface implementations (Emscripten only).
8
9*******************************************************************c********/
10
11#pragma once
12
13#ifndef __SOUND_JS_H__
14#define __SOUND_JS_H__
15
16#include "osdepend.h"
17
18class sound_js : public osd_sound_interface
19{
20public:
21   // construction/destruction
22   sound_js(const osd_interface &osd);
23   virtual ~sound_js() { }
24
25   virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame);
26   virtual void set_mastervolume(int attenuation);
27};
28
29extern const osd_sound_type OSD_SOUND_JS;
30
31#endif  /* __SOUND_JS_H__ */
trunk/src/osd/modules/sound/none.c
r243095r243096
88
99*******************************************************************c********/
1010
11#include "sound_module.h"
12#include "modules/osdmodule.h"
1113
12#include "none.h"
13
14//-------------------------------------------------
15//  sound_none - constructor
16//-------------------------------------------------
17sound_none::sound_none(const osd_interface &osd, running_machine &machine)
18   : osd_sound_interface(osd, machine)
14class sound_none : public osd_module, public sound_module
1915{
20}
16public:
17    sound_none()
18    : osd_module(OSD_SOUND_PROVIDER, "none"), sound_module()
19    {
20    }
21    virtual ~sound_none() { }
2122
23    virtual int init() { return 0; }
24    virtual void exit() { }
2225
23const osd_sound_type OSD_SOUND_NONE = &osd_sound_creator<sound_none>;
26    // sound_module
27
28    virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame) { }
29    virtual void set_mastervolume(int attenuation) { }
30
31};
32
33MODULE_DEFINITION(SOUND_NONE, sound_none)
trunk/src/osd/modules/sound/none.h
r243095r243096
1// license:BSD-3-Clause
2// copyright-holders:Miodrag Milanovic
3/***************************************************************************
4
5    none.h
6
7    Dummy sound interface.
8
9*******************************************************************c********/
10
11#pragma once
12
13#ifndef __SOUND_NONE_H__
14#define __SOUND_NONE_H__
15
16#include "osdepend.h"
17#include "modules/lib/osdobj_common.h"
18
19class sound_none : public osd_sound_interface
20{
21public:
22   // construction/destruction
23   sound_none(const osd_interface &osd, running_machine &machine);
24   virtual ~sound_none() { }
25
26   virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame) { }
27   virtual void set_mastervolume(int attenuation) { }
28};
29
30extern const osd_sound_type OSD_SOUND_NONE;
31
32#endif  /* __SOUND_NONE_H__ */
trunk/src/osd/modules/sound/sdl_sound.c
r243095r243096
99//
1010//============================================================
1111
12#include "sound_module.h"
13#include "modules/osdmodule.h"
14
15#if (!defined(SDLMAME_EMSCRIPTEN)) && (!defined(OSD_WINDOWS))
16
1217// standard sdl header
1318#include "../../sdl/sdlinc.h"
1419
r243095r243096
1621#include "emu.h"
1722#include "emuopts.h"
1823
19#include "sdl_sound.h"
2024#include "../../sdl/osdsdl.h"
2125
2226//============================================================
r243095r243096
2630#define LOG_SOUND       0
2731
2832//============================================================
29//  PARAMETERS
33//  PROTOTYPES
3034//============================================================
3135
32// number of samples per SDL callback
33#define SDL_XFER_SAMPLES    (512)
36static void sdl_callback(void *userdata, Uint8 *stream, int len);
3437
35static int sdl_xfer_samples = SDL_XFER_SAMPLES;
36static int stream_in_initialized = 0;
37static int stream_loop = 0;
38
39// maximum audio latency
40#define MAX_AUDIO_LATENCY       5
41
4238//============================================================
43//  LOCAL VARIABLES
39//  CLASS
4440//============================================================
4541
46static int              attenuation = 0;
42class sound_sdl : public osd_module, public sound_module
43{
44public:
4745
48static int              initialized_audio = 0;
49static int              buf_locked;
46    friend void sdl_callback(void *userdata, Uint8 *stream, int len);
5047
51static INT8             *stream_buffer;
52static volatile INT32   stream_playpos;
48    // number of samples per SDL callback
49    static const int SDL_XFER_SAMPLES = 512;
5350
54static UINT32           stream_buffer_size;
55static UINT32           stream_buffer_in;
51    sound_sdl()
52    : osd_module(OSD_SOUND_PROVIDER, "sdl"), sound_module(),
53      stream_in_initialized(0),
54      stream_loop(0),
55      attenuation(0)
56    {
57        sdl_xfer_samples = SDL_XFER_SAMPLES;
58    }
59    virtual ~sound_sdl() { }
5660
57// buffer over/underflow counts
58static int              buffer_underflows;
59static int              buffer_overflows;
61    virtual int init();
62    virtual void exit();
6063
61// debugging
62static FILE *sound_log;
64    // sound_module
6365
66    virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame);
67    virtual void set_mastervolume(int attenuation);
6468
65// sound enable
66static int snd_enabled;
69private:
70    int lock_buffer(bool is_throttled, long offset, long size, void **buffer1, long *length1, void **buffer2, long *length2);
71    void unlock_buffer(void);
72    void att_memcpy(void *dest, const INT16 *data, int bytes_to_copy);
73    void copy_sample_data(bool is_throttled, const INT16 *data, int bytes_to_copy);
74    int sdl_create_buffers(void);
75    void sdl_destroy_buffers(void);
6776
68//============================================================
69//  PROTOTYPES
70//============================================================
77    int sdl_xfer_samples;
78    int stream_in_initialized;
79    int stream_loop;
80    int attenuation;
7181
72static int          sdl_init(running_machine &machine);
73static void         sdl_kill(running_machine &machine);
74static int          sdl_create_buffers(void);
75static void         sdl_destroy_buffers(void);
76static void         SDLCALL sdl_callback(void *userdata, Uint8 *stream, int len);
82    int              buf_locked;
7783
78const osd_sound_type OSD_SOUND_SDL = &osd_sound_creator<sound_sdl>;
84    INT8             *stream_buffer;
85    volatile INT32   stream_playpos;
7986
80//-------------------------------------------------
81//  sound_sdl - constructor
82//-------------------------------------------------
83sound_sdl::sound_sdl(const osd_interface &osd, running_machine &machine)
84   : osd_sound_interface(osd, machine)
85{
86   if (LOG_SOUND)
87      sound_log = fopen(SDLMAME_SOUND_LOG, "w");
87    UINT32           stream_buffer_size;
88    UINT32           stream_buffer_in;
8889
89   // skip if sound disabled
90   if (m_machine.sample_rate() != 0)
91   {
92      if (initialized_audio)
93      {
94         //sound_exit();
95      }
90    // buffer over/underflow counts
91    int              buffer_underflows;
92    int              buffer_overflows;
9693
97      // attempt to initialize SDL
98      if (sdl_init(m_machine))
99         return;
10094
101      // set the startup volume
102      set_mastervolume(attenuation);
103   }
104}
95};
10596
10697
107
10898//============================================================
109//  sound_sdl - destructor
99//  PARAMETERS
110100//============================================================
111101
112sound_sdl::~sound_sdl()
113{
114   // if nothing to do, don't do it
115   if (m_machine.sample_rate() == 0)
116      return;
102// maximum audio latency
103#define MAX_AUDIO_LATENCY       5
117104
118   // kill the buffers and dsound
119   sdl_kill(m_machine);
120   sdl_destroy_buffers();
105//============================================================
106//  LOCAL VARIABLES
107//============================================================
121108
122   // print out over/underflow stats
123   if (buffer_overflows || buffer_underflows)
124      osd_printf_verbose("Sound buffer: overflows=%d underflows=%d\n", buffer_overflows, buffer_underflows);
109// debugging
110static FILE *sound_log;
125111
126   if (LOG_SOUND)
127   {
128      fprintf(sound_log, "Sound buffer: overflows=%d underflows=%d\n", buffer_overflows, buffer_underflows);
129      fclose(sound_log);
130   }
131}
112//============================================================
113//  sound_sdl - destructor
114//============================================================
132115
133116//============================================================
134117//  lock_buffer
135118//============================================================
136static int lock_buffer(running_machine &machine, long offset, long size, void **buffer1, long *length1, void **buffer2, long *length2)
119int sound_sdl::lock_buffer(bool is_throttled, long offset, long size, void **buffer1, long *length1, void **buffer2, long *length2)
137120{
138121   volatile long pstart, pend, lstart, lend;
139122
140123   if (!buf_locked)
141124   {
142      if (machine.video().throttled())
125      if (is_throttled)
143126      {
144127         pstart = stream_playpos;
145128         pend = (pstart + sdl_xfer_samples);
r243095r243096
185168//============================================================
186169//  unlock_buffer
187170//============================================================
188static void unlock_buffer(void)
171void sound_sdl::unlock_buffer(void)
189172{
190173   buf_locked--;
191174   if (!buf_locked)
r243095r243096
200183//  Apply attenuation
201184//============================================================
202185
203static void att_memcpy(void *dest, const INT16 *data, int bytes_to_copy)
186void sound_sdl::att_memcpy(void *dest, const INT16 *data, int bytes_to_copy)
204187{
205188   int level= (int) (pow(10.0, (float) attenuation / 20.0) * 128.0);
206189   INT16 *d = (INT16 *) dest;
r243095r243096
216199//  copy_sample_data
217200//============================================================
218201
219static void copy_sample_data(running_machine &machine, const INT16 *data, int bytes_to_copy)
202void sound_sdl::copy_sample_data(bool is_throttled, const INT16 *data, int bytes_to_copy)
220203{
221204   void *buffer1, *buffer2 = (void *)NULL;
222205   long length1, length2;
223206   int cur_bytes;
224207
225208   // attempt to lock the stream buffer
226   if (lock_buffer(machine, stream_buffer_in, bytes_to_copy, &buffer1, &length1, &buffer2, &length2) < 0)
209   if (lock_buffer(is_throttled, stream_buffer_in, bytes_to_copy, &buffer1, &length1, &buffer2, &length2) < 0)
227210   {
228211      buffer_underflows++;
229212      return;
r243095r243096
264247//  update_audio_stream
265248//============================================================
266249
267void sound_sdl::update_audio_stream(const INT16 *buffer, int samples_this_frame)
250void sound_sdl::update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame)
268251{
269252   // if nothing to do, don't do it
270   if (m_machine.sample_rate() != 0 && stream_buffer)
253   if (sample_rate() != 0 && stream_buffer)
271254   {
272255      int bytes_this_frame = samples_this_frame * sizeof(INT16) * 2;
273256      int play_position, write_position, stream_in;
r243095r243096
275258
276259      play_position = stream_playpos;
277260
278      write_position = stream_playpos + ((m_machine.sample_rate() / 50) * sizeof(INT16) * 2);
261      write_position = stream_playpos + ((sample_rate() / 50) * sizeof(INT16) * 2);
279262      orig_write = write_position;
280263
281264      if (!stream_in_initialized)
r243095r243096
336319
337320      // now we know where to copy; let's do it
338321      stream_buffer_in = stream_in;
339      copy_sample_data(m_machine, buffer, bytes_this_frame);
322      copy_sample_data(is_throttled, buffer, bytes_this_frame);
340323   }
341324}
342325
r243095r243096
371354//============================================================
372355static void sdl_callback(void *userdata, Uint8 *stream, int len)
373356{
357    sound_sdl *thiz = (sound_sdl *) userdata;
374358   int len1, len2, sb_in;
375359
376   sb_in = stream_buffer_in;
377   if (stream_loop)
378      sb_in += stream_buffer_size;
360   sb_in = thiz->stream_buffer_in;
361   if (thiz->stream_loop)
362      sb_in += thiz->stream_buffer_size;
379363
380   if (sb_in < (stream_playpos+len))
364   if (sb_in < (thiz->stream_playpos+len))
381365   {
382366      if (LOG_SOUND)
383         fprintf(sound_log, "Underflow at sdl_callback: SPP=%d SBI=%d(%d) Len=%d\n", (int)stream_playpos, (int)sb_in, (int)stream_buffer_in, (int)len);
367         fprintf(sound_log, "Underflow at sdl_callback: SPP=%d SBI=%d(%d) Len=%d\n", (int)thiz->stream_playpos, (int)sb_in, (int)thiz->stream_buffer_in, (int)len);
384368
385369      return;
386370   }
387   else if ((stream_playpos+len) > stream_buffer_size)
371   else if ((thiz->stream_playpos+len) > thiz->stream_buffer_size)
388372   {
389      len1 = stream_buffer_size - stream_playpos;
373      len1 = thiz->stream_buffer_size - thiz->stream_playpos;
390374      len2 = len - len1;
391375   }
392376   else
r243095r243096
395379      len2 = 0;
396380   }
397381
398   if (snd_enabled)
399   {
400      memcpy(stream, stream_buffer + stream_playpos, len1);
401      memset(stream_buffer + stream_playpos, 0, len1); // no longer needed
402      if (len2)
403      {
404         memcpy(stream+len1, stream_buffer, len2);
405         memset(stream_buffer, 0, len2); // no longer needed
406      }
382    memcpy(stream, thiz->stream_buffer + thiz->stream_playpos, len1);
383    memset(thiz->stream_buffer + thiz->stream_playpos, 0, len1); // no longer needed
384    if (len2)
385    {
386        memcpy(stream+len1, thiz->stream_buffer, len2);
387        memset(thiz->stream_buffer, 0, len2); // no longer needed
388    }
407389
408   }
409   else
410   {
411      memset(stream, 0, len);
412   }
413390
414391   // move the play cursor
415   stream_playpos += len1 + len2;
416   if (stream_playpos >= stream_buffer_size)
392    thiz->stream_playpos += len1 + len2;
393   if (thiz->stream_playpos >= thiz->stream_buffer_size)
417394   {
418      stream_playpos -= stream_buffer_size;
419      stream_loop = 0;
395       thiz->stream_playpos -= thiz->stream_buffer_size;
396      thiz->stream_loop = 0;
420397
421398      if (LOG_SOUND)
422399         fprintf(sound_log, "stream_loop set to 0 (stream_playpos looped)\n");
r243095r243096
424401
425402   if (LOG_SOUND)
426403      fprintf(sound_log, "callback: xfer len1 %d len2 %d, playpos %d\n",
427            len1, len2, stream_playpos);
404            len1, len2, thiz->stream_playpos);
428405}
429406
430407
431408//============================================================
432//  sdl_init
409//  sound_sdl::init
433410//============================================================
434static int sdl_init(running_machine &machine)
411
412int sound_sdl::init()
435413{
436414   int         n_channels = 2;
437415   int         audio_latency;
438416   SDL_AudioSpec   aspec, obtained;
439417   char audio_driver[16] = "";
440418
441   if (SDL_InitSubSystem(SDL_INIT_AUDIO)) {
442      osd_printf_error("Could not initialize SDL %s\n", SDL_GetError());
443      exit(-1);
444   }
419    if (LOG_SOUND)
420        sound_log = fopen(SDLMAME_SOUND_LOG, "w");
445421
446   osd_printf_verbose("Audio: Start initialization\n");
447#if (SDLMAME_SDL2)
448   strncpy(audio_driver, SDL_GetCurrentAudioDriver(), sizeof(audio_driver));
449#else
450   SDL_AudioDriverName(audio_driver, sizeof(audio_driver));
451#endif
452   osd_printf_verbose("Audio: Driver is %s\n", audio_driver);
422    // skip if sound disabled
423    if (sample_rate() != 0)
424    {
425        if (SDL_InitSubSystem(SDL_INIT_AUDIO)) {
426            osd_printf_error("Could not initialize SDL %s\n", SDL_GetError());
427            return -1;
428        }
453429
454   initialized_audio = 0;
430        osd_printf_verbose("Audio: Start initialization\n");
431    #if (SDLMAME_SDL2)
432        strncpy(audio_driver, SDL_GetCurrentAudioDriver(), sizeof(audio_driver));
433    #else
434        SDL_AudioDriverName(audio_driver, sizeof(audio_driver));
435    #endif
436        osd_printf_verbose("Audio: Driver is %s\n", audio_driver);
455437
456   sdl_xfer_samples = SDL_XFER_SAMPLES;
457   stream_in_initialized = 0;
458   stream_loop = 0;
438        sdl_xfer_samples = SDL_XFER_SAMPLES;
439        stream_in_initialized = 0;
440        stream_loop = 0;
459441
460   // set up the audio specs
461   aspec.freq = machine.sample_rate();
462   aspec.format = AUDIO_S16SYS;    // keep endian independent
463   aspec.channels = n_channels;
464   aspec.samples = sdl_xfer_samples;
465   aspec.callback = sdl_callback;
466   aspec.userdata = 0;
442        // set up the audio specs
443        aspec.freq = sample_rate();
444        aspec.format = AUDIO_S16SYS;    // keep endian independent
445        aspec.channels = n_channels;
446        aspec.samples = sdl_xfer_samples;
447        aspec.callback = sdl_callback;
448        aspec.userdata = this;
467449
468   if (SDL_OpenAudio(&aspec, &obtained) < 0)
469      goto cant_start_audio;
450        if (SDL_OpenAudio(&aspec, &obtained) < 0)
451            goto cant_start_audio;
470452
471   initialized_audio = 1;
472   snd_enabled = 1;
453        osd_printf_verbose("Audio: frequency: %d, channels: %d, samples: %d\n",
454                            obtained.freq, obtained.channels, obtained.samples);
473455
474   osd_printf_verbose("Audio: frequency: %d, channels: %d, samples: %d\n",
475                  obtained.freq, obtained.channels, obtained.samples);
456        sdl_xfer_samples = obtained.samples;
476457
477   sdl_xfer_samples = obtained.samples;
458        audio_latency = m_audio_latency;
478459
479   audio_latency = downcast<sdl_options &>(machine.options()).audio_latency();
460        // pin audio latency
461        if (audio_latency > MAX_AUDIO_LATENCY)
462        {
463            audio_latency = MAX_AUDIO_LATENCY;
464        }
465        else if (audio_latency < 1)
466        {
467            audio_latency = 1;
468        }
480469
481   // pin audio latency
482   if (audio_latency > MAX_AUDIO_LATENCY)
483   {
484      audio_latency = MAX_AUDIO_LATENCY;
485   }
486   else if (audio_latency < 1)
487   {
488      audio_latency = 1;
489   }
470        // compute the buffer sizes
471        stream_buffer_size = (sample_rate() * 2 * sizeof(INT16) * (2 + audio_latency)) / 30;
472        stream_buffer_size = (stream_buffer_size / 1024) * 1024;
473        if (stream_buffer_size < 1024)
474            stream_buffer_size = 1024;
490475
491   // compute the buffer sizes
492   stream_buffer_size = (machine.sample_rate() * 2 * sizeof(INT16) * (2 + audio_latency)) / 30;
493   stream_buffer_size = (stream_buffer_size / 1024) * 1024;
494   if (stream_buffer_size < 1024)
495      stream_buffer_size = 1024;
476        // create the buffers
477        if (sdl_create_buffers())
478            goto cant_create_buffers;
496479
497   // create the buffers
498   if (sdl_create_buffers())
499      goto cant_create_buffers;
480        // set the startup volume
481        set_mastervolume(attenuation);
482        osd_printf_verbose("Audio: End initialization\n");
483        return 0;
500484
501   osd_printf_verbose("Audio: End initialization\n");
502   return 0;
485        // error handling
486    cant_create_buffers:
487    cant_start_audio:
488        osd_printf_verbose("Audio: Initialization failed. SDL error: %s\n", SDL_GetError());
503489
504   // error handling
505cant_create_buffers:
506cant_start_audio:
507   osd_printf_verbose("Audio: Initialization failed. SDL error: %s\n", SDL_GetError());
490        return -1;
491    }
508492
509   return 0;
493    return 0;
510494}
511495
512496
r243095r243096
515499//  sdl_kill
516500//============================================================
517501
518static void sdl_kill(running_machine &machine)
502void sound_sdl::exit()
519503{
520   if (initialized_audio)
521   {
522      osd_printf_verbose("sdl_kill: closing audio\n");
504    // if nothing to do, don't do it
505    if (sample_rate() == 0)
506        return;
523507
524      SDL_CloseAudio();
525   }
508    osd_printf_verbose("sdl_kill: closing audio\n");
509   SDL_CloseAudio();
510
526511   SDL_QuitSubSystem(SDL_INIT_AUDIO);
512
513    // kill the buffers
514    sdl_destroy_buffers();
515
516    // print out over/underflow stats
517    if (buffer_overflows || buffer_underflows)
518        osd_printf_verbose("Sound buffer: overflows=%d underflows=%d\n", buffer_overflows, buffer_underflows);
519
520    if (LOG_SOUND)
521    {
522        fprintf(sound_log, "Sound buffer: overflows=%d underflows=%d\n", buffer_overflows, buffer_underflows);
523        fclose(sound_log);
524    }
527525}
528526
529527
r243095r243096
532530//  dsound_create_buffers
533531//============================================================
534532
535static int sdl_create_buffers(void)
533int sound_sdl::sdl_create_buffers(void)
536534{
537535   osd_printf_verbose("sdl_create_buffers: creating stream buffer of %u bytes\n", stream_buffer_size);
538536
r243095r243096
542540   return 0;
543541}
544542
545
546
547543//============================================================
548544//  sdl_destroy_buffers
549545//============================================================
550546
551static void sdl_destroy_buffers(void)
547void sound_sdl::sdl_destroy_buffers(void)
552548{
553549   // release the buffer
554550   if (stream_buffer)
555551      global_free_array(stream_buffer);
556552   stream_buffer = NULL;
557553}
554
555
556
557#else /* SDLMAME_UNIX */
558    MODULE_NOT_SUPPORTED(sound_sdl, OSD_SOUND_PROVIDER, "sdl")
559#endif
560
561MODULE_DEFINITION(SOUND_SDL, sound_sdl)
trunk/src/osd/modules/sound/sdl_sound.h
r243095r243096
1//============================================================
2//
3//  sound.c - SDL implementation of MAME sound routines
4//
5//  Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team.
6//  Visit http://mamedev.org for licensing and usage restrictions.
7//
8//  SDLMAME by Olivier Galibert and R. Belmont
9//
10//============================================================
11#pragma once
12
13#ifndef __SOUND_SDL_H__
14#define __SOUND_SDL_H__
15
16#include "osdepend.h"
17#include "modules/lib/osdobj_common.h"
18
19class sound_sdl : public osd_sound_interface
20{
21public:
22   // construction/destruction
23   sound_sdl(const osd_interface &osd, running_machine &machine);
24   virtual ~sound_sdl();
25
26   virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame);
27   virtual void set_mastervolume(int attenuation);
28};
29
30extern const osd_sound_type OSD_SOUND_SDL;
31
32#endif  /* __SOUND_SDL_H__ */
trunk/src/osd/modules/sound/sound_module.h
r0r243096
1/*
2 * sound_module.h
3 *
4 */
5
6#ifndef SOUND_MODULE_H_
7#define SOUND_MODULE_H_
8
9#include "osdepend.h"
10#include "modules/osdmodule.h"
11
12//============================================================
13//  CONSTANTS
14//============================================================
15
16#define OSD_SOUND_PROVIDER   "sound"
17
18class sound_module
19{
20public:
21    sound_module() : m_sample_rate(0), m_audio_latency(1) { }
22
23    virtual ~sound_module() { }
24
25    virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame) = 0;
26    virtual void set_mastervolume(int attenuation) = 0;
27
28    int sample_rate() { return m_sample_rate; }
29
30    int m_sample_rate;
31    int m_audio_latency;
32};
33
34#endif /* FONT_MODULE_H_ */
trunk/src/osd/sdl/osdsdl.h
r243095r243096
189189   virtual void customize_input_type_list(simple_list<input_type_entry> &typelist);
190190
191191   virtual void video_register();
192   virtual void sound_register();
193192   virtual void debugger_register();
194193
195194   virtual bool video_init();
trunk/src/osd/sdl/sdl.mak
r243095r243096
204204ifeq ($(TARGETOS),unix)
205205BASE_TARGETOS = unix
206206SYNC_IMPLEMENTATION = tc
207FONT_IMPLEMENTATION = sdl
208207endif
209208
210209ifeq ($(TARGETOS),linux)
211210BASE_TARGETOS = unix
212211SYNC_IMPLEMENTATION = tc
213212SDL_NETWORK = taptun
214FONT_IMPLEMENTATION = sdl
215213
216214ifndef NO_USE_MIDI
217215INCPATH += `pkg-config --cflags alsa`
r243095r243096
223221ifeq ($(TARGETOS),freebsd)
224222BASE_TARGETOS = unix
225223SYNC_IMPLEMENTATION = tc
226FONT_IMPLEMENTATION = sdl
227224DEFS += -DNO_AFFINITY_NP
228225LIBS += -lutil
229226# /usr/local/include is not considered a system include directory
r243095r243096
235232ifeq ($(TARGETOS),openbsd)
236233BASE_TARGETOS = unix
237234SYNC_IMPLEMENTATION = ntc
238FONT_IMPLEMENTATION = sdl
239235LIBS += -lutil
240236NO_USE_MIDI = 1
241237endif
r243095r243096
243239ifeq ($(TARGETOS),netbsd)
244240BASE_TARGETOS = unix
245241SYNC_IMPLEMENTATION = ntc
246FONT_IMPLEMENTATION = sdl
247242LIBS += -lutil
248243NO_USE_MIDI = 1
249244endif
r243095r243096
252247BASE_TARGETOS = unix
253248DEFS += -DNO_AFFINITY_NP -UHAVE_VSNPRINTF -DNO_vsnprintf
254249SYNC_IMPLEMENTATION = tc
255FONT_IMPLEMENTATION = sdl
256250NO_USE_MIDI = 1
257251endif
258252
259253ifeq ($(TARGETOS),haiku)
260254BASE_TARGETOS = unix
261255SYNC_IMPLEMENTATION = ntc
262FONT_IMPLEMENTATION = sdl
263256NO_X11 = 1
264257NO_USE_XINPUT = 1
265258NO_USE_MIDI = 1
r243095r243096
270263ifeq ($(TARGETOS),emscripten)
271264BASE_TARGETOS = unix
272265SYNC_IMPLEMENTATION = mini
273FONT_IMPLEMENTATION = none
274266NO_DEBUGGER = 1
275267NO_X11 = 1
276268NO_USE_XINPUT = 1
r243095r243096
282274ifeq ($(TARGETOS),macosx)
283275NO_USE_QTDEBUG = 1
284276BASE_TARGETOS = unix
285FONT_IMPLEMENTATION = osx
286277DEFS += -DSDLMAME_UNIX -DSDLMAME_MACOSX -DSDLMAME_DARWIN
287278
288279ifndef NO_USE_MIDI
r243095r243096
335326ifeq ($(TARGETOS),win32)
336327BASE_TARGETOS = win32
337328SYNC_IMPLEMENTATION = windows
338FONT_IMPLEMENTATION = windows
339329NO_X11 = 1
340330NO_USE_XINPUT = 1
341331DEFS += -DSDLMAME_WIN32 -DX64_WINDOWS_ABI
r243095r243096
373363BASE_TARGETOS = os2
374364DEFS += -DSDLMAME_OS2
375365SYNC_IMPLEMENTATION = os2
376FONT_IMPLEMENTATION = none
377366NO_DEBUGGER = 1
378367NO_X11 = 1
379368NO_USE_XINPUT = 1
r243095r243096
398387endif
399388endif
400389
401ifndef FONT_IMPLEMENTATION
402$(error Please define FONT_IMPLEMENTATION !)
403endif
404
405
406390#-------------------------------------------------
407391# object and source roots
408392#-------------------------------------------------
r243095r243096
444428   $(SDLMAIN) \
445429   $(SDLOBJ)/sdlmain.o \
446430   $(SDLOBJ)/input.o \
431   $(OSDOBJ)/modules/sound/js_sound.o  \
432   $(OSDOBJ)/modules/sound/direct_sound.o  \
447433   $(OSDOBJ)/modules/sound/sdl_sound.o  \
434   $(OSDOBJ)/modules/sound/none.o  \
448435   $(SDLOBJ)/video.o \
449436   $(SDLOBJ)/drawsdl.o \
450437   $(SDLOBJ)/window.o \
trunk/src/osd/sdl/sdlmain.c
r243095r243096
5757#include "osdsdl.h"
5858#include "modules/lib/osdlib.h"
5959
60#include "modules/sound/sdl_sound.h"
61
62#if defined(SDLMAME_EMSCRIPTEN)
63#include "modules/sound/js_sound.h"
64#endif
65#if defined(SDLMAME_WIN32)
66#include "modules/sound/direct_sound.h"
67#endif
6860#if !defined(NO_DEBUGGER)
6961#include "modules/debugger/debugqt.h"
7062#endif
r243095r243096
539531}
540532
541533//============================================================
542//  sound_register
543//============================================================
544
545void sdl_osd_interface::sound_register()
546{
547   sound_options_add("sdl", OSD_SOUND_SDL);
548#if defined(SDLMAME_WIN32)
549   sound_options_add("dsound", OSD_SOUND_DIRECT_SOUND);
550#endif
551
552#if defined(SDLMAME_EMSCRIPTEN)
553   sound_options_add("js", OSD_SOUND_JS);
554   sound_options_add("auto", OSD_SOUND_JS); // making JS audio default one
555#else
556   sound_options_add("auto", OSD_SOUND_SDL); // making SDL audio default one
557#endif
558}
559
560//============================================================
561534//  debugger_register
562535//============================================================
563536
trunk/src/osd/windows/windows.mak
r243095r243096
357357   $(WINOBJ)/winsocket.o \
358358   $(OSDOBJ)/modules/sync/work_osd.o \
359359   $(OSDOBJ)/modules/lib/osdlib_win32.o \
360   $(OSDOBJ)/modules/font/font_windows.o \
361360   $(OSDOBJ)/modules/osdmodule.o \
362361   $(WINOBJ)/winptty.o \
363362
r243095r243096
375374   $(WINOBJ)/drawnone.o \
376375   $(WINOBJ)/input.o \
377376   $(WINOBJ)/output.o \
378   $(OSDOBJ)/modules/sound/direct_sound.o \
377   $(OSDOBJ)/modules/sound/js_sound.o  \
378   $(OSDOBJ)/modules/sound/direct_sound.o  \
379   $(OSDOBJ)/modules/sound/sdl_sound.o  \
380   $(OSDOBJ)/modules/sound/none.o  \
379381   $(WINOBJ)/video.o \
380382   $(WINOBJ)/window.o \
381383   $(WINOBJ)/winmenu.o \
trunk/src/osd/windows/winmain.c
r243095r243096
3939#include "debugger.h"
4040#include "winfile.h"
4141
42#include "modules/sound/direct_sound.h"
43#if (USE_SDL)
44#include "modules/sound/sdl_sound.h"
45#endif
46
4742#include "modules/debugger/debugwin.h"
4843
4944#if (USE_QTDEBUG)
r243095r243096
541536}
542537
543538//============================================================
544//  sound_register
545//============================================================
546
547void windows_osd_interface::sound_register()
548{
549   sound_options_add("dsound", OSD_SOUND_DIRECT_SOUND);
550#if (USE_SDL)
551   sound_options_add("sdl", OSD_SOUND_SDL);
552#endif
553   sound_options_add("auto", OSD_SOUND_DIRECT_SOUND); // making Direct Sound audio default one
554}
555
556
557//============================================================
558539//  debugger_register
559540//============================================================
560541
trunk/src/osd/windows/winmain.h
r243095r243096
253253   virtual void customize_input_type_list(simple_list<input_type_entry> &typelist);
254254
255255   virtual void video_register();
256   virtual void sound_register();
257256   virtual void debugger_register();
258257
259258   virtual bool video_init();


Previous 199869 Revisions Next


© 1997-2024 The MAME Team