X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=libs%2Fmikmod%2Fdrivers%2Fdrv_ds.c;fp=libs%2Fmikmod%2Fdrivers%2Fdrv_ds.c;h=69e454076c6a5d1a103a97679ef308c45bd7578d;hp=0000000000000000000000000000000000000000;hb=b2c24e9d5b637bb78d18a377d9957c07d0759030;hpb=67c749060592270c9cd8b4f7dafe7d7c7a61a614 diff --git a/libs/mikmod/drivers/drv_ds.c b/libs/mikmod/drivers/drv_ds.c new file mode 100644 index 0000000..69e4540 --- /dev/null +++ b/libs/mikmod/drivers/drv_ds.c @@ -0,0 +1,417 @@ +/* MikMod sound library + (c) 1998-2005 Miodrag Vallat and others - see file AUTHORS for + complete list. + + This library is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ + +/*============================================================================== + + $Id$ + + Driver for output on win32 platforms using DirectSound + +==============================================================================*/ + +/* + + Written by Brian McKinney + +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "mikmod_internals.h" + +#ifdef DRV_DS + +#include +#include + +#define INITGUID +#if !defined(__cplusplus) && !defined(CINTERFACE) +#define CINTERFACE +#endif +#include + +#ifdef __WATCOMC__ +/* If you encounter build failures from Open Watcom's dsound.h, + * see: https://github.com/open-watcom/open-watcom-v2/pull/313 + */ +/* Open Watcom has broken __cdecl (leading underscore) name mangling for Windows + * internal var names. It is fixed in Open Watcom V2 fork as of May/2014: + * https://github.com/open-watcom/open-watcom-v2/commit/961ef1ff756f3ec5a7248cefcae00a6ecaa97ff4 + * Therefore, we define and use a local copy of IID_IDirectSoundNotify here. + */ +#include +DEFINE_GUID(IID_IDirectSoundNotify,0xB0210783,0x89cd,0x11d0,0xAF,0x08,0x00,0xA0,0xC9,0x25,0xCD,0x16); +#endif + +/* PF_XMMI64_INSTRUCTIONS_AVAILABLE not in all SDKs */ +#ifndef PF_XMMI64_INSTRUCTIONS_AVAILABLE +#define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10 +#endif + +/* DSBCAPS_CTRLALL is not defined anymore with DirectX 7. Of course DirectSound + is a coherent, backwards compatible API... */ +#ifndef DSBCAPS_CTRLALL +#define DSBCAPS_CTRLALL ( DSBCAPS_CTRLPOSITIONNOTIFY | DSBCAPS_CTRLVOLUME | \ + DSBCAPS_CTRLPAN | DSBCAPS_CTRLFREQUENCY | \ + DSBCAPS_CTRL3D ) +#endif + +#ifndef WAVE_FORMAT_IEEE_FLOAT +#define WAVE_FORMAT_IEEE_FLOAT 0x0003 +#endif + +/* size of each buffer */ +#define FRAGSIZE 16 +/* buffer count */ +#define UPDATES 2 + +static LPDIRECTSOUND pSoundCard = NULL; +static LPDIRECTSOUNDBUFFER pPrimarySoundBuffer = NULL, pSoundBuffer = NULL; +static LPDIRECTSOUNDNOTIFY pSoundBufferNotify = NULL; + +static HANDLE notifyUpdateHandle = NULL, updateBufferHandle = NULL; +static BOOL threadInUse = FALSE; +static int fragsize=1<19)) buf=FRAGSIZE; + fragsize=1<