Previous 199869 Revisions Next

r32071 Friday 12th September, 2014 at 02:07:46 UTC by R. Belmont
Fixes to try and make direct_sound work minus WinOSD (nw)
[src/osd/modules/sound]direct_sound.c
[src/osd/sdl]sdl.mak

trunk/src/osd/modules/sound/direct_sound.c
r32070r32071
2323
2424// MAMEOS headers
2525#include "direct_sound.h"
26
27#ifdef SDLMAME_WIN32
28#include "../../sdl/osdsdl.h"
29#else
2630#include "winmain.h"
2731#include "window.h"
32#endif
2833
2934//============================================================
3035//  DEBUGGING
r32070r32071
234239   }
235240
236241   // set the cooperative level
242   #ifndef SDLMAME_WIN32
237243   result = IDirectSound_SetCooperativeLevel(dsound, win_window_list->m_hwnd, DSSCL_PRIORITY);
238244   if (result != DS_OK)
239245   {
240246      osd_printf_error("Error setting DirectSound cooperative level: %08x\n", (UINT32)result);
241247      goto error;
242248   }
249   #endif
243250
244251   // make a format description for what we want
245252   stream_format.wBitsPerSample    = 16;
r32070r32071
249256   stream_format.nBlockAlign       = stream_format.wBitsPerSample * stream_format.nChannels / 8;
250257   stream_format.nAvgBytesPerSec   = stream_format.nSamplesPerSec * stream_format.nBlockAlign;
251258
259
252260   // compute the buffer size based on the output sample rate
253   stream_buffer_size = stream_format.nSamplesPerSec * stream_format.nBlockAlign * downcast<windows_options &>(m_osd.machine().options()).audio_latency() / 10;
261   int audio_latency;
262   #ifdef SDLMAME_WIN32
263   audio_latency = downcast<sdl_options &>(machine.options()).audio_latency();
264   #else
265   audio_latency = downcast<windows_options &>(m_osd.machine().options()).audio_latency();
266   #endif
267   stream_buffer_size = stream_format.nSamplesPerSec * stream_format.nBlockAlign * audio_latency / 10;
254268   stream_buffer_size = (stream_buffer_size / 1024) * 1024;
255269   if (stream_buffer_size < 1024)
256270      stream_buffer_size = 1024;
trunk/src/osd/sdl/sdl.mak
r32070r32071
410410   $(SDLOBJ)/watchdog.o \
411411
412412ifeq ($(BASE_TARGETOS),win32)
413   $(OSDOBJ)/modules/sound/direct_sound.o
413   OSDOBJS += $(OSDOBJ)/modules/sound/direct_sound.o
414414endif
415415
416416ifdef NO_USE_MIDI

Previous 199869 Revisions Next


© 1997-2024 The MAME Team