mirror of
https://github.com/reactos/reactos.git
synced 2025-06-04 08:50:27 +00:00
- fix some prototypes, remove dxroslayer from dsound
- sync dsound with wine head, it now works again (tested on win xp and reactos) svn path=/trunk/; revision=39921
This commit is contained in:
parent
2c38f28ad1
commit
3ec78e9525
23 changed files with 5205 additions and 5076 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -18,6 +18,7 @@
|
|||
<file>buffer.c</file>
|
||||
<file>capture.c</file>
|
||||
<file>dsound.c</file>
|
||||
<file>dsound_convert.c</file>
|
||||
<file>dsound_main.c</file>
|
||||
<file>duplex.c</file>
|
||||
<file>mixer.c</file>
|
||||
|
@ -25,10 +26,4 @@
|
|||
<file>propset.c</file>
|
||||
<file>regsvr.c</file>
|
||||
<file>sound3d.c</file>
|
||||
<directory name="dxroslayer">
|
||||
<file>dxrosdrv_querydsounddesc.c</file>
|
||||
<file>dxrosdrv_querydsoundiface.c</file>
|
||||
<file>dxroslayer.c</file>
|
||||
<file>getguidfromstring.c</file>
|
||||
</directory>
|
||||
</module>
|
||||
|
|
435
reactos/dll/directx/dsound/dsound_convert.c
Normal file
435
reactos/dll/directx/dsound/dsound_convert.c
Normal file
|
@ -0,0 +1,435 @@
|
|||
/* DirectSound format conversion and mixing routines
|
||||
*
|
||||
* Copyright 2007 Maarten Lankhorst
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/* 8 bits is unsigned, the rest is signed.
|
||||
* First I tried to reuse existing stuff from alsa-lib, after that
|
||||
* didn't work, I gave up and just went for individual hacks.
|
||||
*
|
||||
* 24 bit is expensive to do, due to unaligned access.
|
||||
* In dlls/winex11.drv/dib_convert.c convert_888_to_0888_asis there is a way
|
||||
* around it, but I'm happy current code works, maybe something for later.
|
||||
*
|
||||
* The ^ 0x80 flips the signed bit, this is the conversion from
|
||||
* signed (-128.. 0.. 127) to unsigned (0...255)
|
||||
* This is only temporary: All 8 bit data should be converted to signed.
|
||||
* then when fed to the sound card, it should be converted to unsigned again.
|
||||
*
|
||||
* Sound is LITTLE endian
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#define NONAMELESSSTRUCT
|
||||
#define NONAMELESSUNION
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "mmsystem.h"
|
||||
#include "winternl.h"
|
||||
#include "wine/debug.h"
|
||||
#include "dsound.h"
|
||||
#include "dsdriver.h"
|
||||
#include "dsound_private.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dsound);
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#define le16(x) RtlUshortByteSwap((x))
|
||||
#define le32(x) RtlUlongByteSwap((x))
|
||||
#else
|
||||
#define le16(x) (x)
|
||||
#define le32(x) (x)
|
||||
#endif
|
||||
|
||||
static inline void src_advance(const void **src, UINT stride, INT *count, UINT *freqAcc, UINT adj)
|
||||
{
|
||||
*freqAcc += adj;
|
||||
if (*freqAcc >= (1 << DSOUND_FREQSHIFT))
|
||||
{
|
||||
ULONG adv = (*freqAcc >> DSOUND_FREQSHIFT);
|
||||
*freqAcc &= (1 << DSOUND_FREQSHIFT) - 1;
|
||||
*(const char **)src += adv * stride;
|
||||
*count -= adv;
|
||||
}
|
||||
}
|
||||
|
||||
static void convert_8_to_8 (const void *src, void *dst, UINT src_stride,
|
||||
UINT dst_stride, INT count, UINT freqAcc, UINT adj)
|
||||
{
|
||||
while (count > 0)
|
||||
{
|
||||
*(BYTE *)dst = *(const BYTE *)src;
|
||||
|
||||
dst = (char *)dst + dst_stride;
|
||||
src_advance(&src, src_stride, &count, &freqAcc, adj);
|
||||
}
|
||||
}
|
||||
|
||||
static void convert_8_to_16 (const void *src, void *dst, UINT src_stride,
|
||||
UINT dst_stride, INT count, UINT freqAcc, UINT adj)
|
||||
{
|
||||
while (count > 0)
|
||||
{
|
||||
WORD dest = *(const BYTE *)src, *dest16 = dst;
|
||||
*dest16 = le16(dest * 257 - 32768);
|
||||
|
||||
dst = (char *)dst + dst_stride;
|
||||
src_advance(&src, src_stride, &count, &freqAcc, adj);
|
||||
}
|
||||
}
|
||||
|
||||
static void convert_8_to_24 (const void *src, void *dst, UINT src_stride,
|
||||
UINT dst_stride, INT count, UINT freqAcc, UINT adj)
|
||||
{
|
||||
while (count > 0)
|
||||
{
|
||||
BYTE dest = *(const BYTE *)src;
|
||||
BYTE *dest24 = dst;
|
||||
dest24[0] = dest;
|
||||
dest24[1] = dest;
|
||||
dest24[2] = dest - 0x80;
|
||||
|
||||
dst = (char *)dst + dst_stride;
|
||||
src_advance(&src, src_stride, &count, &freqAcc, adj);
|
||||
}
|
||||
}
|
||||
|
||||
static void convert_8_to_32 (const void *src, void *dst, UINT src_stride,
|
||||
UINT dst_stride, INT count, UINT freqAcc, UINT adj)
|
||||
{
|
||||
while (count > 0)
|
||||
{
|
||||
DWORD dest = *(const BYTE *)src, *dest32 = dst;
|
||||
*dest32 = le32(dest * 16843009 - 2147483648U);
|
||||
|
||||
dst = (char *)dst + dst_stride;
|
||||
src_advance(&src, src_stride, &count, &freqAcc, adj);
|
||||
}
|
||||
}
|
||||
|
||||
static void convert_16_to_8 (const void *src, void *dst, UINT src_stride,
|
||||
UINT dst_stride, INT count, UINT freqAcc, UINT adj)
|
||||
{
|
||||
while (count > 0)
|
||||
{
|
||||
BYTE *dst8 = dst;
|
||||
*dst8 = (le16(*(const WORD *)src)) / 256;
|
||||
*dst8 -= 0x80;
|
||||
|
||||
dst = (char *)dst + dst_stride;
|
||||
src_advance(&src, src_stride, &count, &freqAcc, adj);
|
||||
}
|
||||
}
|
||||
|
||||
static void convert_16_to_16 (const void *src, void *dst, UINT src_stride,
|
||||
UINT dst_stride, INT count, UINT freqAcc, UINT adj)
|
||||
{
|
||||
while (count > 0)
|
||||
{
|
||||
*(WORD *)dst = *(const WORD *)src;
|
||||
|
||||
dst = (char *)dst + dst_stride;
|
||||
src_advance(&src, src_stride, &count, &freqAcc, adj);
|
||||
}
|
||||
}
|
||||
|
||||
static void convert_16_to_24 (const void *src, void *dst, UINT src_stride,
|
||||
UINT dst_stride, INT count, UINT freqAcc, UINT adj)
|
||||
{
|
||||
while (count > 0)
|
||||
{
|
||||
WORD dest = le16(*(const WORD *)src);
|
||||
BYTE *dest24 = dst;
|
||||
|
||||
dest24[0] = dest / 256;
|
||||
dest24[1] = dest;
|
||||
dest24[2] = dest / 256;
|
||||
|
||||
dst = (char *)dst + dst_stride;
|
||||
src_advance(&src, src_stride, &count, &freqAcc, adj);
|
||||
}
|
||||
}
|
||||
|
||||
static void convert_16_to_32 (const void *src, void *dst, UINT src_stride,
|
||||
UINT dst_stride, INT count, UINT freqAcc, UINT adj)
|
||||
{
|
||||
while (count > 0)
|
||||
{
|
||||
DWORD dest = *(const WORD *)src, *dest32 = dst;
|
||||
*dest32 = dest * 65537;
|
||||
|
||||
dst = (char *)dst + dst_stride;
|
||||
src_advance(&src, src_stride, &count, &freqAcc, adj);
|
||||
}
|
||||
}
|
||||
|
||||
static void convert_24_to_8 (const void *src, void *dst, UINT src_stride,
|
||||
UINT dst_stride, INT count, UINT freqAcc, UINT adj)
|
||||
{
|
||||
while (count > 0)
|
||||
{
|
||||
BYTE *dst8 = dst;
|
||||
*dst8 = ((const BYTE *)src)[2];
|
||||
|
||||
dst = (char *)dst + dst_stride;
|
||||
src_advance(&src, src_stride, &count, &freqAcc, adj);
|
||||
}
|
||||
}
|
||||
|
||||
static void convert_24_to_16 (const void *src, void *dst, UINT src_stride,
|
||||
UINT dst_stride, INT count, UINT freqAcc, UINT adj)
|
||||
{
|
||||
while (count > 0)
|
||||
{
|
||||
WORD *dest16 = dst;
|
||||
const BYTE *source = src;
|
||||
*dest16 = le16(source[2] * 256 + source[1]);
|
||||
|
||||
dst = (char *)dst + dst_stride;
|
||||
src_advance(&src, src_stride, &count, &freqAcc, adj);
|
||||
}
|
||||
}
|
||||
|
||||
static void convert_24_to_24 (const void *src, void *dst, UINT src_stride,
|
||||
UINT dst_stride, INT count, UINT freqAcc, UINT adj)
|
||||
{
|
||||
while (count > 0)
|
||||
{
|
||||
BYTE *dest24 = dst;
|
||||
const BYTE *src24 = src;
|
||||
|
||||
dest24[0] = src24[0];
|
||||
dest24[1] = src24[1];
|
||||
dest24[2] = src24[2];
|
||||
|
||||
dst = (char *)dst + dst_stride;
|
||||
src_advance(&src, src_stride, &count, &freqAcc, adj);
|
||||
}
|
||||
}
|
||||
|
||||
static void convert_24_to_32 (const void *src, void *dst, UINT src_stride,
|
||||
UINT dst_stride, INT count, UINT freqAcc, UINT adj)
|
||||
{
|
||||
while (count > 0)
|
||||
{
|
||||
DWORD *dest32 = dst;
|
||||
const BYTE *source = src;
|
||||
*dest32 = le32(source[2] * 16777217 + source[1] * 65536 + source[0] * 256);
|
||||
|
||||
dst = (char *)dst + dst_stride;
|
||||
src_advance(&src, src_stride, &count, &freqAcc, adj);
|
||||
}
|
||||
}
|
||||
|
||||
static void convert_32_to_8 (const void *src, void *dst, UINT src_stride,
|
||||
UINT dst_stride, INT count, UINT freqAcc, UINT adj)
|
||||
{
|
||||
while (count > 0)
|
||||
{
|
||||
BYTE *dst8 = dst;
|
||||
*dst8 = (le32(*(const DWORD *)src) / 16777216);
|
||||
*dst8 -= 0x80;
|
||||
|
||||
dst = (char *)dst + dst_stride;
|
||||
src_advance(&src, src_stride, &count, &freqAcc, adj);
|
||||
}
|
||||
}
|
||||
|
||||
static void convert_32_to_16 (const void *src, void *dst, UINT src_stride,
|
||||
UINT dst_stride, INT count, UINT freqAcc, UINT adj)
|
||||
{
|
||||
while (count > 0)
|
||||
{
|
||||
WORD *dest16 = dst;
|
||||
*dest16 = le16(le32(*(const DWORD *)src) / 65536);
|
||||
|
||||
dst = (char *)dst + dst_stride;
|
||||
src_advance(&src, src_stride, &count, &freqAcc, adj);
|
||||
}
|
||||
}
|
||||
|
||||
static void convert_32_to_24 (const void *src, void *dst, UINT src_stride,
|
||||
UINT dst_stride, INT count, UINT freqAcc, UINT adj)
|
||||
{
|
||||
while (count > 0)
|
||||
{
|
||||
DWORD dest = le32(*(const DWORD *)src);
|
||||
BYTE *dest24 = dst;
|
||||
|
||||
dest24[0] = dest / 256;
|
||||
dest24[1] = dest / 65536;
|
||||
dest24[2] = dest / 16777216;
|
||||
|
||||
dst = (char *)dst + dst_stride;
|
||||
src_advance(&src, src_stride, &count, &freqAcc, adj);
|
||||
}
|
||||
}
|
||||
|
||||
static void convert_32_to_32 (const void *src, void *dst, UINT src_stride,
|
||||
UINT dst_stride, INT count, UINT freqAcc, UINT adj)
|
||||
{
|
||||
while (count > 0)
|
||||
{
|
||||
DWORD *dest = dst;
|
||||
*dest = *(const DWORD *)src;
|
||||
|
||||
dst = (char *)dst + dst_stride;
|
||||
src_advance(&src, src_stride, &count, &freqAcc, adj);
|
||||
}
|
||||
}
|
||||
|
||||
const bitsconvertfunc convertbpp[4][4] = {
|
||||
{ convert_8_to_8, convert_8_to_16, convert_8_to_24, convert_8_to_32 },
|
||||
{ convert_16_to_8, convert_16_to_16, convert_16_to_24, convert_16_to_32 },
|
||||
{ convert_24_to_8, convert_24_to_16, convert_24_to_24, convert_24_to_32 },
|
||||
{ convert_32_to_8, convert_32_to_16, convert_32_to_24, convert_32_to_32 },
|
||||
};
|
||||
|
||||
static void mix8(signed char *src, INT *dst, unsigned len)
|
||||
{
|
||||
TRACE("%p - %p %d\n", src, dst, len);
|
||||
while (len--)
|
||||
/* 8-bit WAV is unsigned, it's here converted to signed, normalize function will convert it back again */
|
||||
*(dst++) += (signed char)((BYTE)*(src++) - (BYTE)0x80);
|
||||
}
|
||||
|
||||
static void mix16(SHORT *src, INT *dst, unsigned len)
|
||||
{
|
||||
TRACE("%p - %p %d\n", src, dst, len);
|
||||
len /= 2;
|
||||
while (len--)
|
||||
{
|
||||
*dst += le16(*src);
|
||||
++dst; ++src;
|
||||
}
|
||||
}
|
||||
|
||||
static void mix24(BYTE *src, INT *dst, unsigned len)
|
||||
{
|
||||
TRACE("%p - %p %d\n", src, dst, len);
|
||||
len /= 3;
|
||||
while (len--)
|
||||
{
|
||||
DWORD field;
|
||||
field = ((DWORD)src[2] << 16) + ((DWORD)src[1] << 8) + (DWORD)src[0];
|
||||
if (src[2] & 0x80)
|
||||
field |= 0xFF000000U;
|
||||
*(dst++) += field;
|
||||
++src;
|
||||
}
|
||||
}
|
||||
|
||||
static void mix32(INT *src, LONGLONG *dst, unsigned len)
|
||||
{
|
||||
TRACE("%p - %p %d\n", src, dst, len);
|
||||
len /= 4;
|
||||
while (len--)
|
||||
*(dst++) += le32(*(src++));
|
||||
}
|
||||
|
||||
const mixfunc mixfunctions[4] = {
|
||||
(mixfunc)mix8,
|
||||
(mixfunc)mix16,
|
||||
(mixfunc)mix24,
|
||||
(mixfunc)mix32
|
||||
};
|
||||
|
||||
static void norm8(INT *src, signed char *dst, unsigned len)
|
||||
{
|
||||
TRACE("%p - %p %d\n", src, dst, len);
|
||||
while (len--)
|
||||
{
|
||||
*dst = (*src) + 0x80;
|
||||
if (*src < -0x80)
|
||||
*dst = 0;
|
||||
else if (*src > 0x7f)
|
||||
*dst = 0xff;
|
||||
++dst;
|
||||
++src;
|
||||
}
|
||||
}
|
||||
|
||||
static void norm16(INT *src, SHORT *dst, unsigned len)
|
||||
{
|
||||
TRACE("%p - %p %d\n", src, dst, len);
|
||||
len /= 2;
|
||||
while (len--)
|
||||
{
|
||||
*dst = le16(*src);
|
||||
if (*src <= -0x8000)
|
||||
*dst = le16(0x8000);
|
||||
else if (*src > 0x7fff)
|
||||
*dst = le16(0x7fff);
|
||||
++dst;
|
||||
++src;
|
||||
}
|
||||
}
|
||||
|
||||
static void norm24(INT *src, BYTE *dst, unsigned len)
|
||||
{
|
||||
TRACE("%p - %p %d\n", src, dst, len);
|
||||
len /= 3;
|
||||
while (len--)
|
||||
{
|
||||
if (*src <= -0x800000)
|
||||
{
|
||||
dst[0] = 0;
|
||||
dst[1] = 0;
|
||||
dst[2] = 0x80;
|
||||
}
|
||||
else if (*src > 0x7fffff)
|
||||
{
|
||||
dst[0] = 0xff;
|
||||
dst[1] = 0xff;
|
||||
dst[2] = 0x7f;
|
||||
}
|
||||
else
|
||||
{
|
||||
dst[0] = *src;
|
||||
dst[1] = *src >> 8;
|
||||
dst[2] = *src >> 16;
|
||||
}
|
||||
++dst;
|
||||
++src;
|
||||
}
|
||||
}
|
||||
|
||||
static void norm32(LONGLONG *src, INT *dst, unsigned len)
|
||||
{
|
||||
TRACE("%p - %p %d\n", src, dst, len);
|
||||
len /= 4;
|
||||
while (len--)
|
||||
{
|
||||
*dst = le32(*src);
|
||||
if (*src <= -(LONGLONG)0x80000000)
|
||||
*dst = le32(0x80000000);
|
||||
else if (*src > 0x7fffffff)
|
||||
*dst = le32(0x7fffffff);
|
||||
++dst;
|
||||
++src;
|
||||
}
|
||||
}
|
||||
|
||||
const normfunc normfunctions[4] = {
|
||||
(normfunc)norm8,
|
||||
(normfunc)norm16,
|
||||
(normfunc)norm24,
|
||||
(normfunc)norm32,
|
||||
};
|
|
@ -16,15 +16,11 @@
|
|||
*
|
||||
* You should have received a copy of the GNU Lesser 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
|
||||
*/
|
||||
/*
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
* Most thread locking is complete. There may be a few race
|
||||
* conditions still lurking.
|
||||
*
|
||||
* Tested with a Soundblaster clone, a Gravis UltraSound Classic,
|
||||
* and a Turtle Beach Tropez+.
|
||||
*
|
||||
* TODO:
|
||||
* Implement SetCooperativeLevel properly (need to address focus issues)
|
||||
* Implement DirectSound3DBuffers (stubs in place)
|
||||
|
@ -32,8 +28,8 @@
|
|||
* Add critical section locking inside Release and AddRef methods
|
||||
* Handle static buffers - put those in hardware, non-static not in hardware
|
||||
* Hardware DuplicateSoundBuffer
|
||||
* Proper volume calculation, and setting volume in HEL primary buffer
|
||||
* Optimize WINMM and negotiate fragment size, decrease DS_HEL_MARGIN
|
||||
* Proper volume calculation for 3d buffers
|
||||
* Remove DS_HEL_FRAGS and use mixer fragment length for it
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
@ -43,6 +39,7 @@
|
|||
#define NONAMELESSUNION
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winuser.h"
|
||||
#include "winnls.h"
|
||||
#include "winreg.h"
|
||||
#include "mmsystem.h"
|
||||
|
@ -50,24 +47,16 @@
|
|||
#include "mmddk.h"
|
||||
#include "wine/debug.h"
|
||||
#include "dsound.h"
|
||||
#include "dsdriver.h"
|
||||
#include "dsound_private.h"
|
||||
#include "dsconf.h"
|
||||
#include "ks.h"
|
||||
#include "initguid.h"
|
||||
#include "ksmedia.h"
|
||||
#include "dsdriver.h"
|
||||
|
||||
#include "dsound_private.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dsound);
|
||||
|
||||
/* these are eligible for tuning... they must be high on slow machines... */
|
||||
/* some stuff may get more responsive with lower values though... */
|
||||
#define DS_EMULDRIVER 0 /* some games (Quake 2, UT) refuse to accept
|
||||
emulated dsound devices. set to 0 ! */
|
||||
#define DS_HEL_MARGIN 5 /* HEL only: number of waveOut fragments ahead to mix in new buffers
|
||||
* (keep this close or equal to DS_HEL_QUEUE for best results) */
|
||||
#define DS_HEL_QUEUE 5 /* HEL only: number of waveOut fragments ahead to queue to driver
|
||||
* (this will affect HEL sound reliability and latency) */
|
||||
|
||||
#define DS_SND_QUEUE_MAX 28 /* max number of fragments to prebuffer */
|
||||
#define DS_SND_QUEUE_MIN 12 /* min number of fragments to prebuffer */
|
||||
|
||||
DirectSoundDevice* DSOUND_renderer[MAXWAVEDRIVERS];
|
||||
GUID DSOUND_renderer_guids[MAXWAVEDRIVERS];
|
||||
GUID DSOUND_capture_guids[MAXWAVEDRIVERS];
|
||||
|
@ -99,20 +88,23 @@ HRESULT mmErr(UINT err)
|
|||
}
|
||||
}
|
||||
|
||||
int ds_emuldriver = DS_EMULDRIVER;
|
||||
int ds_hel_margin = DS_HEL_MARGIN;
|
||||
int ds_hel_queue = DS_HEL_QUEUE;
|
||||
int ds_snd_queue_max = DS_SND_QUEUE_MAX;
|
||||
int ds_snd_queue_min = DS_SND_QUEUE_MIN;
|
||||
/* All default settings, you most likely don't want to touch these, see wiki on UsefulRegistryKeys */
|
||||
int ds_emuldriver = 0;
|
||||
int ds_hel_buflen = 32768 * 2;
|
||||
int ds_snd_queue_max = 10;
|
||||
int ds_snd_queue_min = 6;
|
||||
int ds_snd_shadow_maxsize = 2;
|
||||
int ds_hw_accel = DS_HW_ACCEL_FULL;
|
||||
int ds_default_playback = 0;
|
||||
int ds_default_capture = 0;
|
||||
int ds_default_sample_rate = 44100;
|
||||
int ds_default_bits_per_sample = 16;
|
||||
static int ds_default_playback;
|
||||
static int ds_default_capture;
|
||||
|
||||
/*
|
||||
* Get a config key from either the app-specific or the default config
|
||||
*/
|
||||
|
||||
inline static DWORD get_config_key( HKEY defkey, HKEY appkey, const char *name,
|
||||
static inline DWORD get_config_key( HKEY defkey, HKEY appkey, const char *name,
|
||||
char *buffer, DWORD size )
|
||||
{
|
||||
if (appkey && !RegQueryValueExA( appkey, name, 0, NULL, (LPBYTE)buffer, &size )) return 0;
|
||||
|
@ -147,7 +139,7 @@ void setup_dsound_options(void)
|
|||
if ((p = strrchr( appname, '/' ))) appname = p + 1;
|
||||
if ((p = strrchr( appname, '\\' ))) appname = p + 1;
|
||||
strcat( appname, "\\DirectSound" );
|
||||
TRACE("appname = [%s] \n",appname);
|
||||
TRACE("appname = [%s]\n", appname);
|
||||
if (RegOpenKeyA( tmpkey, appname, &appkey )) appkey = 0;
|
||||
RegCloseKey( tmpkey );
|
||||
}
|
||||
|
@ -158,11 +150,8 @@ void setup_dsound_options(void)
|
|||
if (!get_config_key( hkey, appkey, "EmulDriver", buffer, MAX_PATH ))
|
||||
ds_emuldriver = strcmp(buffer, "N");
|
||||
|
||||
if (!get_config_key( hkey, appkey, "HELmargin", buffer, MAX_PATH ))
|
||||
ds_hel_margin = atoi(buffer);
|
||||
|
||||
if (!get_config_key( hkey, appkey, "HELqueue", buffer, MAX_PATH ))
|
||||
ds_hel_queue = atoi(buffer);
|
||||
if (!get_config_key( hkey, appkey, "HelBuflen", buffer, MAX_PATH ))
|
||||
ds_hel_buflen = atoi(buffer);
|
||||
|
||||
if (!get_config_key( hkey, appkey, "SndQueueMax", buffer, MAX_PATH ))
|
||||
ds_snd_queue_max = atoi(buffer);
|
||||
|
@ -180,42 +169,43 @@ void setup_dsound_options(void)
|
|||
else if (strcmp(buffer, "Emulation") == 0)
|
||||
ds_hw_accel = DS_HW_ACCEL_EMULATION;
|
||||
}
|
||||
FIXME("dsound is hardcoded to software emulation until we fix it in ros\n");
|
||||
ds_hw_accel = DS_HW_ACCEL_EMULATION;
|
||||
|
||||
if (!get_config_key( hkey, appkey, "DefaultPlayback", buffer, MAX_PATH ))
|
||||
ds_default_playback = atoi(buffer);
|
||||
ds_default_playback = atoi(buffer);
|
||||
|
||||
if (!get_config_key( hkey, appkey, "MaxShadowSize", buffer, MAX_PATH ))
|
||||
ds_snd_shadow_maxsize = atoi(buffer);
|
||||
|
||||
if (!get_config_key( hkey, appkey, "DefaultCapture", buffer, MAX_PATH ))
|
||||
ds_default_capture = atoi(buffer);
|
||||
ds_default_capture = atoi(buffer);
|
||||
|
||||
if (!get_config_key( hkey, appkey, "DefaultSampleRate", buffer, MAX_PATH ))
|
||||
ds_default_sample_rate = atoi(buffer);
|
||||
|
||||
if (!get_config_key( hkey, appkey, "DefaultBitsPerSample", buffer, MAX_PATH ))
|
||||
ds_default_bits_per_sample = atoi(buffer);
|
||||
|
||||
if (appkey) RegCloseKey( appkey );
|
||||
if (hkey) RegCloseKey( hkey );
|
||||
|
||||
if (ds_emuldriver != DS_EMULDRIVER )
|
||||
WARN("ds_emuldriver = %d (default=%d)\n",ds_emuldriver, DS_EMULDRIVER);
|
||||
if (ds_hel_margin != DS_HEL_MARGIN )
|
||||
WARN("ds_hel_margin = %d (default=%d)\n",ds_hel_margin, DS_HEL_MARGIN );
|
||||
if (ds_hel_queue != DS_HEL_QUEUE )
|
||||
WARN("ds_hel_queue = %d (default=%d)\n",ds_hel_queue, DS_HEL_QUEUE );
|
||||
if (ds_snd_queue_max != DS_SND_QUEUE_MAX)
|
||||
WARN("ds_snd_queue_max = %d (default=%d)\n",ds_snd_queue_max ,DS_SND_QUEUE_MAX);
|
||||
if (ds_snd_queue_min != DS_SND_QUEUE_MIN)
|
||||
WARN("ds_snd_queue_min = %d (default=%d)\n",ds_snd_queue_min ,DS_SND_QUEUE_MIN);
|
||||
if (ds_hw_accel != DS_HW_ACCEL_FULL)
|
||||
WARN("ds_hw_accel = %s (default=Full)\n",
|
||||
ds_hw_accel==DS_HW_ACCEL_FULL ? "Full" :
|
||||
ds_hw_accel==DS_HW_ACCEL_STANDARD ? "Standard" :
|
||||
ds_hw_accel==DS_HW_ACCEL_BASIC ? "Basic" :
|
||||
ds_hw_accel==DS_HW_ACCEL_EMULATION ? "Emulation" :
|
||||
"Unknown");
|
||||
if (ds_default_playback != 0)
|
||||
WARN("ds_default_playback = %d (default=0)\n",ds_default_playback);
|
||||
if (ds_default_capture != 0)
|
||||
WARN("ds_default_capture = %d (default=0)\n",ds_default_playback);
|
||||
TRACE("ds_emuldriver = %d\n", ds_emuldriver);
|
||||
TRACE("ds_hel_buflen = %d\n", ds_hel_buflen);
|
||||
TRACE("ds_snd_queue_max = %d\n", ds_snd_queue_max);
|
||||
TRACE("ds_snd_queue_min = %d\n", ds_snd_queue_min);
|
||||
TRACE("ds_hw_accel = %s\n",
|
||||
ds_hw_accel==DS_HW_ACCEL_FULL ? "Full" :
|
||||
ds_hw_accel==DS_HW_ACCEL_STANDARD ? "Standard" :
|
||||
ds_hw_accel==DS_HW_ACCEL_BASIC ? "Basic" :
|
||||
ds_hw_accel==DS_HW_ACCEL_EMULATION ? "Emulation" :
|
||||
"Unknown");
|
||||
TRACE("ds_default_playback = %d\n", ds_default_playback);
|
||||
TRACE("ds_default_capture = %d\n", ds_default_playback);
|
||||
TRACE("ds_default_sample_rate = %d\n", ds_default_sample_rate);
|
||||
TRACE("ds_default_bits_per_sample = %d\n", ds_default_bits_per_sample);
|
||||
TRACE("ds_snd_shadow_maxsize = %d\n", ds_snd_shadow_maxsize);
|
||||
}
|
||||
|
||||
const char * get_device_id(LPCGUID pGuid)
|
||||
static const char * get_device_id(LPCGUID pGuid)
|
||||
{
|
||||
if (IsEqualGUID(&DSDEVID_DefaultPlayback, pGuid))
|
||||
return "DSDEVID_DefaultPlayback";
|
||||
|
@ -264,19 +254,19 @@ HRESULT WINAPI GetDeviceID(LPCGUID pGuidSrc, LPGUID pGuidDest)
|
|||
|
||||
if ( IsEqualGUID( &DSDEVID_DefaultPlayback, pGuidSrc ) ||
|
||||
IsEqualGUID( &DSDEVID_DefaultVoicePlayback, pGuidSrc ) ) {
|
||||
CopyMemory(pGuidDest, &DSOUND_renderer_guids[ds_default_playback], sizeof(GUID));
|
||||
*pGuidDest = DSOUND_renderer_guids[ds_default_playback];
|
||||
TRACE("returns %s\n", get_device_id(pGuidDest));
|
||||
return DS_OK;
|
||||
}
|
||||
|
||||
if ( IsEqualGUID( &DSDEVID_DefaultCapture, pGuidSrc ) ||
|
||||
IsEqualGUID( &DSDEVID_DefaultVoiceCapture, pGuidSrc ) ) {
|
||||
CopyMemory(pGuidDest, &DSOUND_capture_guids[ds_default_capture], sizeof(GUID));
|
||||
*pGuidDest = DSOUND_capture_guids[ds_default_capture];
|
||||
TRACE("returns %s\n", get_device_id(pGuidDest));
|
||||
return DS_OK;
|
||||
}
|
||||
|
||||
CopyMemory(pGuidDest, pGuidSrc, sizeof(GUID));
|
||||
*pGuidDest = *pGuidSrc;
|
||||
TRACE("returns %s\n", get_device_id(pGuidDest));
|
||||
|
||||
return DS_OK;
|
||||
|
@ -318,11 +308,11 @@ HRESULT WINAPI DirectSoundEnumerateA(
|
|||
if (GetDeviceID(&DSDEVID_DefaultPlayback, &guid) == DS_OK) {
|
||||
for (wod = 0; wod < devs; ++wod) {
|
||||
if (IsEqualGUID( &guid, &DSOUND_renderer_guids[wod]) ) {
|
||||
err = mmErr(WineWaveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,0));
|
||||
err = mmErr(waveOutMessage(UlongToHandle(wod),DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,0));
|
||||
if (err == DS_OK) {
|
||||
TRACE("calling lpDSEnumCallback(NULL,\"%s\",\"%s\",%p)\n",
|
||||
"Primary Sound Driver",desc.szDrvname,lpContext);
|
||||
if (lpDSEnumCallback(NULL, "Primary Sound Driver", desc.szDrvname, lpContext) == FALSE)
|
||||
"Primary Sound Driver","",lpContext);
|
||||
if (lpDSEnumCallback(NULL, "Primary Sound Driver", "", lpContext) == FALSE)
|
||||
return DS_OK;
|
||||
}
|
||||
}
|
||||
|
@ -331,7 +321,7 @@ HRESULT WINAPI DirectSoundEnumerateA(
|
|||
}
|
||||
|
||||
for (wod = 0; wod < devs; ++wod) {
|
||||
err = mmErr(WineWaveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,0));
|
||||
err = mmErr(waveOutMessage(UlongToHandle(wod),DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,0));
|
||||
if (err == DS_OK) {
|
||||
TRACE("calling lpDSEnumCallback(%s,\"%s\",\"%s\",%p)\n",
|
||||
debugstr_guid(&DSOUND_renderer_guids[wod]),desc.szDesc,desc.szDrvname,lpContext);
|
||||
|
@ -377,17 +367,16 @@ HRESULT WINAPI DirectSoundEnumerateW(
|
|||
devs = waveOutGetNumDevs();
|
||||
if (devs > 0) {
|
||||
if (GetDeviceID(&DSDEVID_DefaultPlayback, &guid) == DS_OK) {
|
||||
static const WCHAR empty[] = { 0 };
|
||||
for (wod = 0; wod < devs; ++wod) {
|
||||
if (IsEqualGUID( &guid, &DSOUND_renderer_guids[wod] ) ) {
|
||||
err = mmErr(WineWaveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,0));
|
||||
err = mmErr(waveOutMessage(UlongToHandle(wod),DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,0));
|
||||
if (err == DS_OK) {
|
||||
TRACE("calling lpDSEnumCallback(NULL,\"%s\",\"%s\",%p)\n",
|
||||
"Primary Sound Driver",desc.szDrvname,lpContext);
|
||||
MultiByteToWideChar( CP_ACP, 0, "Primary Sound Driver", -1,
|
||||
wDesc, sizeof(wDesc)/sizeof(WCHAR) );
|
||||
MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1,
|
||||
wName, sizeof(wName)/sizeof(WCHAR) );
|
||||
if (lpDSEnumCallback(NULL, wDesc, wName, lpContext) == FALSE)
|
||||
if (lpDSEnumCallback(NULL, wDesc, empty, lpContext) == FALSE)
|
||||
return DS_OK;
|
||||
}
|
||||
}
|
||||
|
@ -396,7 +385,7 @@ HRESULT WINAPI DirectSoundEnumerateW(
|
|||
}
|
||||
|
||||
for (wod = 0; wod < devs; ++wod) {
|
||||
err = mmErr(WineWaveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,0));
|
||||
err = mmErr(waveOutMessage(UlongToHandle(wod),DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,0));
|
||||
if (err == DS_OK) {
|
||||
TRACE("calling lpDSEnumCallback(%s,\"%s\",\"%s\",%p)\n",
|
||||
debugstr_guid(&DSOUND_renderer_guids[wod]),desc.szDesc,desc.szDrvname,lpContext);
|
||||
|
@ -415,19 +404,38 @@ HRESULT WINAPI DirectSoundEnumerateW(
|
|||
* DirectSound ClassFactory
|
||||
*/
|
||||
|
||||
static HRESULT WINAPI
|
||||
DSCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
|
||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
||||
typedef HRESULT (*FnCreateInstance)(REFIID riid, LPVOID *ppobj);
|
||||
|
||||
typedef struct {
|
||||
const IClassFactoryVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
REFCLSID rclsid;
|
||||
FnCreateInstance pfnCreateInstance;
|
||||
} IClassFactoryImpl;
|
||||
|
||||
FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
|
||||
return E_NOINTERFACE;
|
||||
static HRESULT WINAPI
|
||||
DSCF_QueryInterface(LPCLASSFACTORY iface, REFIID riid, LPVOID *ppobj)
|
||||
{
|
||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
||||
TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppobj);
|
||||
if (ppobj == NULL)
|
||||
return E_POINTER;
|
||||
if (IsEqualIID(riid, &IID_IUnknown) ||
|
||||
IsEqualIID(riid, &IID_IClassFactory))
|
||||
{
|
||||
*ppobj = iface;
|
||||
IUnknown_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
*ppobj = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI DSCF_AddRef(LPCLASSFACTORY iface)
|
||||
{
|
||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
||||
ULONG ref = InterlockedIncrement(&(This->ref));
|
||||
TRACE("(%p) ref was %ld\n", This, ref - 1);
|
||||
TRACE("(%p) ref was %d\n", This, ref - 1);
|
||||
return ref;
|
||||
}
|
||||
|
||||
|
@ -435,121 +443,56 @@ static ULONG WINAPI DSCF_Release(LPCLASSFACTORY iface)
|
|||
{
|
||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
||||
ULONG ref = InterlockedDecrement(&(This->ref));
|
||||
TRACE("(%p) ref was %ld\n", This, ref + 1);
|
||||
TRACE("(%p) ref was %d\n", This, ref + 1);
|
||||
/* static class, won't be freed */
|
||||
return ref;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DSCF_CreateInstance(
|
||||
LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
|
||||
) {
|
||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
||||
TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
|
||||
LPCLASSFACTORY iface,
|
||||
LPUNKNOWN pOuter,
|
||||
REFIID riid,
|
||||
LPVOID *ppobj)
|
||||
{
|
||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
||||
TRACE("(%p, %p, %s, %p)\n", This, pOuter, debugstr_guid(riid), ppobj);
|
||||
|
||||
if (pOuter)
|
||||
return CLASS_E_NOAGGREGATION;
|
||||
if (pOuter)
|
||||
return CLASS_E_NOAGGREGATION;
|
||||
|
||||
if (ppobj == NULL) {
|
||||
WARN("invalid parameter\n");
|
||||
return DSERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
*ppobj = NULL;
|
||||
|
||||
if ( IsEqualIID( &IID_IDirectSound, riid ) )
|
||||
return DSOUND_Create((LPDIRECTSOUND*)ppobj,pOuter);
|
||||
|
||||
if ( IsEqualIID( &IID_IDirectSound8, riid ) )
|
||||
return DSOUND_Create8((LPDIRECTSOUND8*)ppobj,pOuter);
|
||||
|
||||
WARN("(%p,%p,%s,%p) Interface not found!\n",This,pOuter,debugstr_guid(riid),ppobj);
|
||||
return E_NOINTERFACE;
|
||||
if (ppobj == NULL) {
|
||||
WARN("invalid parameter\n");
|
||||
return DSERR_INVALIDPARAM;
|
||||
}
|
||||
*ppobj = NULL;
|
||||
return This->pfnCreateInstance(riid, ppobj);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DSCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
|
||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
||||
FIXME("(%p)->(%d),stub!\n",This,dolock);
|
||||
return S_OK;
|
||||
|
||||
static HRESULT WINAPI DSCF_LockServer(LPCLASSFACTORY iface, BOOL dolock)
|
||||
{
|
||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
||||
FIXME("(%p, %d) stub!\n", This, dolock);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const IClassFactoryVtbl DSCF_Vtbl = {
|
||||
DSCF_QueryInterface,
|
||||
DSCF_AddRef,
|
||||
DSCF_Release,
|
||||
DSCF_CreateInstance,
|
||||
DSCF_LockServer
|
||||
DSCF_QueryInterface,
|
||||
DSCF_AddRef,
|
||||
DSCF_Release,
|
||||
DSCF_CreateInstance,
|
||||
DSCF_LockServer
|
||||
};
|
||||
|
||||
static IClassFactoryImpl DSOUND_CF = { &DSCF_Vtbl, 1 };
|
||||
|
||||
/*******************************************************************************
|
||||
* DirectSoundPrivate ClassFactory
|
||||
*/
|
||||
|
||||
static HRESULT WINAPI
|
||||
DSPCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
|
||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
||||
|
||||
FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI DSPCF_AddRef(LPCLASSFACTORY iface)
|
||||
{
|
||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
||||
ULONG ref = InterlockedIncrement(&(This->ref));
|
||||
TRACE("(%p) ref was %ld\n", This, ref - 1);
|
||||
return ref;
|
||||
}
|
||||
|
||||
static ULONG WINAPI DSPCF_Release(LPCLASSFACTORY iface)
|
||||
{
|
||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
||||
ULONG ref = InterlockedDecrement(&(This->ref));
|
||||
TRACE("(%p) ref was %ld\n", This, ref + 1);
|
||||
/* static class, won't be freed */
|
||||
return ref;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
DSPCF_CreateInstance(
|
||||
LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
|
||||
) {
|
||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
||||
TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
|
||||
|
||||
if (ppobj == NULL) {
|
||||
WARN("invalid parameter\n");
|
||||
return DSERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
*ppobj = NULL;
|
||||
|
||||
if ( IsEqualGUID( &IID_IKsPropertySet, riid ) ) {
|
||||
return IKsPrivatePropertySetImpl_Create((IKsPrivatePropertySetImpl**)ppobj);
|
||||
}
|
||||
|
||||
WARN("(%p,%p,%s,%p) Interface not found!\n",This,pOuter,debugstr_guid(riid),ppobj);
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
DSPCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
|
||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
||||
FIXME("(%p)->(%d),stub!\n",This,dolock);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const IClassFactoryVtbl DSPCF_Vtbl = {
|
||||
DSPCF_QueryInterface,
|
||||
DSPCF_AddRef,
|
||||
DSPCF_Release,
|
||||
DSPCF_CreateInstance,
|
||||
DSPCF_LockServer
|
||||
static IClassFactoryImpl DSOUND_CF[] = {
|
||||
{ &DSCF_Vtbl, 1, &CLSID_DirectSound, (FnCreateInstance)DSOUND_Create },
|
||||
{ &DSCF_Vtbl, 1, &CLSID_DirectSound8, (FnCreateInstance)DSOUND_Create8 },
|
||||
{ &DSCF_Vtbl, 1, &CLSID_DirectSoundCapture, (FnCreateInstance)DSOUND_CaptureCreate },
|
||||
{ &DSCF_Vtbl, 1, &CLSID_DirectSoundCapture8, (FnCreateInstance)DSOUND_CaptureCreate8 },
|
||||
{ &DSCF_Vtbl, 1, &CLSID_DirectSoundFullDuplex, (FnCreateInstance)DSOUND_FullDuplexCreate },
|
||||
{ &DSCF_Vtbl, 1, &CLSID_DirectSoundPrivate, (FnCreateInstance)IKsPrivatePropertySetImpl_Create },
|
||||
{ NULL, 0, NULL, NULL }
|
||||
};
|
||||
|
||||
static IClassFactoryImpl DSOUND_PRIVATE_CF = { &DSPCF_Vtbl, 1 };
|
||||
|
||||
/*******************************************************************************
|
||||
* DllGetClassObject [DSOUND.@]
|
||||
* Retrieves class object from a DLL object
|
||||
|
@ -569,62 +512,33 @@ static IClassFactoryImpl DSOUND_PRIVATE_CF = { &DSPCF_Vtbl, 1 };
|
|||
*/
|
||||
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
||||
{
|
||||
TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
||||
int i = 0;
|
||||
TRACE("(%s, %s, %p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
||||
|
||||
if (ppv == NULL) {
|
||||
WARN("invalid parameter\n");
|
||||
return E_INVALIDARG;
|
||||
WARN("invalid parameter\n");
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
*ppv = NULL;
|
||||
|
||||
if ( IsEqualCLSID( &CLSID_DirectSound, rclsid ) ||
|
||||
IsEqualCLSID( &CLSID_DirectSound8, rclsid ) ) {
|
||||
if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
|
||||
*ppv = (LPVOID)&DSOUND_CF;
|
||||
IClassFactory_AddRef((IClassFactory*)*ppv);
|
||||
return S_OK;
|
||||
}
|
||||
WARN("(%s,%s,%p): no interface found.\n",
|
||||
debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
||||
return S_FALSE;
|
||||
if (!IsEqualIID(riid, &IID_IClassFactory) &&
|
||||
!IsEqualIID(riid, &IID_IUnknown)) {
|
||||
WARN("no interface for %s\n", debugstr_guid(riid));
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
if ( IsEqualCLSID( &CLSID_DirectSoundCapture, rclsid ) ||
|
||||
IsEqualCLSID( &CLSID_DirectSoundCapture8, rclsid ) ) {
|
||||
if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
|
||||
*ppv = (LPVOID)&DSOUND_CAPTURE_CF;
|
||||
IClassFactory_AddRef((IClassFactory*)*ppv);
|
||||
return S_OK;
|
||||
}
|
||||
WARN("(%s,%s,%p): no interface found.\n",
|
||||
debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
||||
return S_FALSE;
|
||||
while (NULL != DSOUND_CF[i].rclsid) {
|
||||
if (IsEqualGUID(rclsid, DSOUND_CF[i].rclsid)) {
|
||||
DSCF_AddRef((IClassFactory*) &DSOUND_CF[i]);
|
||||
*ppv = &DSOUND_CF[i];
|
||||
return S_OK;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
if ( IsEqualCLSID( &CLSID_DirectSoundFullDuplex, rclsid ) ) {
|
||||
if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
|
||||
*ppv = (LPVOID)&DSOUND_FULLDUPLEX_CF;
|
||||
IClassFactory_AddRef((IClassFactory*)*ppv);
|
||||
return S_OK;
|
||||
}
|
||||
WARN("(%s,%s,%p): no interface found.\n",
|
||||
debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
if ( IsEqualCLSID( &CLSID_DirectSoundPrivate, rclsid ) ) {
|
||||
if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
|
||||
*ppv = (LPVOID)&DSOUND_PRIVATE_CF;
|
||||
IClassFactory_AddRef((IClassFactory*)*ppv);
|
||||
return S_OK;
|
||||
}
|
||||
WARN("(%s,%s,%p): no interface found.\n",
|
||||
debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
WARN("(%s,%s,%p): no class found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
||||
WARN("(%s, %s, %p): no class found.\n", debugstr_guid(rclsid),
|
||||
debugstr_guid(riid), ppv);
|
||||
return CLASS_E_CLASSNOTAVAILABLE;
|
||||
}
|
||||
|
||||
|
@ -655,7 +569,7 @@ HRESULT WINAPI DllCanUnloadNow(void)
|
|||
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
int i;
|
||||
TRACE("(%p %ld %p)\n", hInstDLL, fdwReason, lpvReserved);
|
||||
TRACE("(%p %d %p)\n", hInstDLL, fdwReason, lpvReserved);
|
||||
|
||||
switch (fdwReason) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
|
@ -666,16 +580,13 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|||
INIT_GUID(DSOUND_renderer_guids[i], 0xbd6dd71a, 0x3deb, 0x11d1, 0xb1, 0x71, 0x00, 0xc0, 0x4f, 0xc2, 0x00, 0x00 + i);
|
||||
INIT_GUID(DSOUND_capture_guids[i], 0xbd6dd71b, 0x3deb, 0x11d1, 0xb1, 0x71, 0x00, 0xc0, 0x4f, 0xc2, 0x00, 0x00 + i);
|
||||
}
|
||||
DisableThreadLibraryCalls(hInstDLL);
|
||||
/* Increase refcount on dsound by 1 */
|
||||
GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCWSTR)hInstDLL, &hInstDLL);
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
TRACE("DLL_PROCESS_DETACH\n");
|
||||
break;
|
||||
case DLL_THREAD_ATTACH:
|
||||
TRACE("DLL_THREAD_ATTACH\n");
|
||||
break;
|
||||
case DLL_THREAD_DETACH:
|
||||
TRACE("DLL_THREAD_DETACH\n");
|
||||
break;
|
||||
default:
|
||||
TRACE("UNKNOWN REASON\n");
|
||||
break;
|
||||
|
|
|
@ -16,20 +16,15 @@
|
|||
*
|
||||
* You should have received a copy of the GNU Lesser 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
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "dxroslayer/dxros_layer.h"
|
||||
|
||||
/* Linux does not support better timing than 10ms */
|
||||
#define DS_TIME_RES 10 /* Resolution of multimedia timer */
|
||||
#define DS_TIME_RES 2 /* Resolution of multimedia timer */
|
||||
#define DS_TIME_DEL 10 /* Delay of multimedia timer callback, and duration of HEL fragment */
|
||||
|
||||
#define DS_HEL_FRAGS 48 /* HEL only: number of waveOut fragments in primary buffer
|
||||
* (changing this won't help you) */
|
||||
#include "wine/list.h"
|
||||
|
||||
/* wine spec */
|
||||
#include "dxroslayer/dxros_layer.h"
|
||||
/* direct sound hardware acceleration levels */
|
||||
#define DS_HW_ACCEL_FULL 0 /* default on Windows 98 */
|
||||
#define DS_HW_ACCEL_STANDARD 1 /* default on Windows 2000 */
|
||||
|
@ -37,13 +32,13 @@
|
|||
#define DS_HW_ACCEL_EMULATION 3
|
||||
|
||||
extern int ds_emuldriver;
|
||||
extern int ds_hel_margin;
|
||||
extern int ds_hel_queue;
|
||||
extern int ds_hel_buflen;
|
||||
extern int ds_snd_queue_max;
|
||||
extern int ds_snd_queue_min;
|
||||
extern int ds_snd_shadow_maxsize;
|
||||
extern int ds_hw_accel;
|
||||
extern int ds_default_playback;
|
||||
extern int ds_default_capture;
|
||||
extern int ds_default_sample_rate;
|
||||
extern int ds_default_bits_per_sample;
|
||||
|
||||
/*****************************************************************************
|
||||
* Predeclare the interface implementation structures
|
||||
|
@ -58,6 +53,10 @@ typedef struct IDirectSoundBufferImpl IDirectSoundBufferImpl;
|
|||
typedef struct IDirectSoundCaptureImpl IDirectSoundCaptureImpl;
|
||||
typedef struct IDirectSoundCaptureBufferImpl IDirectSoundCaptureBufferImpl;
|
||||
typedef struct IDirectSoundFullDuplexImpl IDirectSoundFullDuplexImpl;
|
||||
typedef struct IDirectSoundFullDuplex_IUnknown IDirectSoundFullDuplex_IUnknown;
|
||||
typedef struct IDirectSoundFullDuplex_IDirectSound IDirectSoundFullDuplex_IDirectSound;
|
||||
typedef struct IDirectSoundFullDuplex_IDirectSound8 IDirectSoundFullDuplex_IDirectSound8;
|
||||
typedef struct IDirectSoundFullDuplex_IDirectSoundCapture IDirectSoundFullDuplex_IDirectSoundCapture;
|
||||
typedef struct IDirectSoundNotifyImpl IDirectSoundNotifyImpl;
|
||||
typedef struct IDirectSoundCaptureNotifyImpl IDirectSoundCaptureNotifyImpl;
|
||||
typedef struct IDirectSound3DListenerImpl IDirectSound3DListenerImpl;
|
||||
|
@ -66,25 +65,20 @@ typedef struct IKsBufferPropertySetImpl IKsBufferPropertySetImpl;
|
|||
typedef struct IKsPrivatePropertySetImpl IKsPrivatePropertySetImpl;
|
||||
typedef struct PrimaryBufferImpl PrimaryBufferImpl;
|
||||
typedef struct SecondaryBufferImpl SecondaryBufferImpl;
|
||||
typedef struct IClassFactoryImpl IClassFactoryImpl;
|
||||
typedef struct DirectSoundDevice DirectSoundDevice;
|
||||
typedef struct DirectSoundCaptureDevice DirectSoundCaptureDevice;
|
||||
|
||||
/* dsound_convert.h */
|
||||
typedef void (*bitsconvertfunc)(const void *, void *, UINT, UINT, INT, UINT, UINT);
|
||||
extern const bitsconvertfunc convertbpp[4][4];
|
||||
typedef void (*mixfunc)(const void *, void *, unsigned);
|
||||
extern const mixfunc mixfunctions[4];
|
||||
typedef void (*normfunc)(const void *, void *, unsigned);
|
||||
extern const normfunc normfunctions[4];
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirectSound implementation structure
|
||||
* IDirectSoundDevice implementation structure
|
||||
*/
|
||||
struct IDirectSoundImpl
|
||||
{
|
||||
/* IUnknown fields */
|
||||
const IDirectSound8Vtbl *lpVtbl;
|
||||
LONG ref;
|
||||
|
||||
DirectSoundDevice *device;
|
||||
LPUNKNOWN pUnknown;
|
||||
LPDIRECTSOUND pDS;
|
||||
LPDIRECTSOUND8 pDS8;
|
||||
};
|
||||
|
||||
struct DirectSoundDevice
|
||||
{
|
||||
LONG ref;
|
||||
|
@ -96,13 +90,12 @@ struct DirectSoundDevice
|
|||
DWORD priolevel;
|
||||
PWAVEFORMATEX pwfx;
|
||||
HWAVEOUT hwo;
|
||||
LPWAVEHDR pwave[DS_HEL_FRAGS];
|
||||
UINT timerID, pwplay, pwwrite, pwqueue, prebuf, precount;
|
||||
LPWAVEHDR pwave;
|
||||
UINT timerID, pwplay, pwqueue, prebuf, helfrags;
|
||||
DWORD fraglen;
|
||||
PIDSDRIVERBUFFER hwbuf;
|
||||
LPBYTE buffer;
|
||||
DWORD writelead, buflen, state, playpos, mixpos;
|
||||
BOOL need_remix;
|
||||
int nrofbuffers;
|
||||
IDirectSoundBufferImpl** buffers;
|
||||
RTL_RWLOCK buffer_list_lock;
|
||||
|
@ -110,8 +103,13 @@ struct DirectSoundDevice
|
|||
PrimaryBufferImpl* primary;
|
||||
DSBUFFERDESC dsbd;
|
||||
DWORD speaker_config;
|
||||
LPBYTE tmp_buffer;
|
||||
DWORD tmp_buffer_len;
|
||||
LPBYTE tmp_buffer, mix_buffer;
|
||||
DWORD tmp_buffer_len, mix_buffer_len;
|
||||
|
||||
DSVOLUMEPAN volpan;
|
||||
|
||||
mixfunc mixfunction;
|
||||
normfunc normfunction;
|
||||
|
||||
/* DirectSound3DListener fields */
|
||||
IDirectSound3DListenerImpl* listener;
|
||||
|
@ -124,74 +122,41 @@ typedef struct BufferMemory
|
|||
{
|
||||
LONG ref;
|
||||
LPBYTE memory;
|
||||
struct list buffers;
|
||||
} BufferMemory;
|
||||
|
||||
HRESULT WINAPI IDirectSoundImpl_Create(
|
||||
LPDIRECTSOUND8 * ppds);
|
||||
|
||||
HRESULT WINAPI DSOUND_Create(
|
||||
LPDIRECTSOUND *ppDS,
|
||||
IUnknown *pUnkOuter);
|
||||
|
||||
HRESULT WINAPI DSOUND_Create8(
|
||||
LPDIRECTSOUND8 *ppDS,
|
||||
IUnknown *pUnkOuter);
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirectSound COM components
|
||||
*/
|
||||
struct IDirectSound_IUnknown {
|
||||
const IUnknownVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
LPDIRECTSOUND8 pds;
|
||||
};
|
||||
|
||||
HRESULT WINAPI IDirectSound_IUnknown_Create(
|
||||
LPDIRECTSOUND8 pds,
|
||||
LPUNKNOWN * ppunk);
|
||||
|
||||
struct IDirectSound_IDirectSound {
|
||||
const IDirectSoundVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
LPDIRECTSOUND8 pds;
|
||||
};
|
||||
|
||||
HRESULT WINAPI IDirectSound_IDirectSound_Create(
|
||||
LPDIRECTSOUND8 pds,
|
||||
LPDIRECTSOUND * ppds);
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirectSound8 COM components
|
||||
*/
|
||||
struct IDirectSound8_IUnknown {
|
||||
const IUnknownVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
LPDIRECTSOUND8 pds;
|
||||
};
|
||||
|
||||
HRESULT WINAPI IDirectSound8_IUnknown_Create(
|
||||
LPDIRECTSOUND8 pds,
|
||||
LPUNKNOWN * ppunk);
|
||||
|
||||
struct IDirectSound8_IDirectSound {
|
||||
const IDirectSoundVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
LPDIRECTSOUND8 pds;
|
||||
};
|
||||
|
||||
HRESULT WINAPI IDirectSound8_IDirectSound_Create(
|
||||
LPDIRECTSOUND8 pds,
|
||||
LPDIRECTSOUND * ppds);
|
||||
|
||||
struct IDirectSound8_IDirectSound8 {
|
||||
const IDirectSound8Vtbl *lpVtbl;
|
||||
LONG ref;
|
||||
LPDIRECTSOUND8 pds;
|
||||
};
|
||||
|
||||
HRESULT WINAPI IDirectSound8_IDirectSound8_Create(
|
||||
LPDIRECTSOUND8 pds,
|
||||
LPDIRECTSOUND8 * ppds);
|
||||
ULONG DirectSoundDevice_Release(DirectSoundDevice * device);
|
||||
HRESULT DirectSoundDevice_Initialize(
|
||||
DirectSoundDevice ** ppDevice,
|
||||
LPCGUID lpcGUID);
|
||||
HRESULT DirectSoundDevice_AddBuffer(
|
||||
DirectSoundDevice * device,
|
||||
IDirectSoundBufferImpl * pDSB);
|
||||
HRESULT DirectSoundDevice_RemoveBuffer(
|
||||
DirectSoundDevice * device,
|
||||
IDirectSoundBufferImpl * pDSB);
|
||||
HRESULT DirectSoundDevice_GetCaps(DirectSoundDevice * device, LPDSCAPS lpDSCaps);
|
||||
HRESULT DirectSoundDevice_CreateSoundBuffer(
|
||||
DirectSoundDevice * device,
|
||||
LPCDSBUFFERDESC dsbd,
|
||||
LPLPDIRECTSOUNDBUFFER ppdsb,
|
||||
LPUNKNOWN lpunk,
|
||||
BOOL from8);
|
||||
HRESULT DirectSoundDevice_DuplicateSoundBuffer(
|
||||
DirectSoundDevice * device,
|
||||
LPDIRECTSOUNDBUFFER psb,
|
||||
LPLPDIRECTSOUNDBUFFER ppdsb);
|
||||
HRESULT DirectSoundDevice_SetCooperativeLevel(
|
||||
DirectSoundDevice * devcie,
|
||||
HWND hwnd,
|
||||
DWORD level);
|
||||
HRESULT DirectSoundDevice_Compact(DirectSoundDevice * device);
|
||||
HRESULT DirectSoundDevice_GetSpeakerConfig(
|
||||
DirectSoundDevice * device,
|
||||
LPDWORD lpdwSpeakerConfig);
|
||||
HRESULT DirectSoundDevice_SetSpeakerConfig(
|
||||
DirectSoundDevice * device,
|
||||
DWORD config);
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirectSoundBuffer implementation structure
|
||||
|
@ -203,24 +168,23 @@ struct IDirectSoundBufferImpl
|
|||
const IDirectSoundBuffer8Vtbl *lpVtbl;
|
||||
LONG ref;
|
||||
/* IDirectSoundBufferImpl fields */
|
||||
SecondaryBufferImpl* dsb;
|
||||
IDirectSoundImpl* dsound;
|
||||
CRITICAL_SECTION lock;
|
||||
SecondaryBufferImpl* secondary;
|
||||
DirectSoundDevice* device;
|
||||
RTL_RWLOCK lock;
|
||||
PIDSDRIVERBUFFER hwbuf;
|
||||
PWAVEFORMATEX pwfx;
|
||||
BufferMemory* buffer;
|
||||
LPBYTE tmp_buffer;
|
||||
DWORD playflags,state,leadin;
|
||||
DWORD playpos,startpos,writelead,buflen;
|
||||
DWORD writelead,buflen;
|
||||
DWORD nAvgBytesPerSec;
|
||||
DWORD freq;
|
||||
DSVOLUMEPAN volpan, cvolpan;
|
||||
DWORD freq, tmp_buffer_len, max_buffer_len;
|
||||
DSVOLUMEPAN volpan;
|
||||
DSBUFFERDESC dsbd;
|
||||
/* used for frequency conversion (PerfectPitch) */
|
||||
ULONG freqAdjust, freqAcc;
|
||||
/* used for intelligent (well, sort of) prebuffering */
|
||||
DWORD probably_valid_to, last_playpos;
|
||||
DWORD primary_mixpos, buf_mixpos;
|
||||
BOOL need_remix;
|
||||
ULONG freqneeded, freqAdjust, freqAcc, freqAccNext, resampleinmixer;
|
||||
/* used for mixing */
|
||||
DWORD primary_mixpos, buf_mixpos, sec_mixpos;
|
||||
|
||||
/* IDirectSoundNotifyImpl fields */
|
||||
IDirectSoundNotifyImpl* notify;
|
||||
|
@ -236,13 +200,19 @@ struct IDirectSoundBufferImpl
|
|||
|
||||
/* IKsPropertySet fields */
|
||||
IKsBufferPropertySetImpl* iks;
|
||||
bitsconvertfunc convert;
|
||||
struct list entry;
|
||||
};
|
||||
|
||||
HRESULT WINAPI IDirectSoundBufferImpl_Create(
|
||||
IDirectSoundImpl *ds,
|
||||
IDirectSoundBufferImpl **pdsb,
|
||||
HRESULT IDirectSoundBufferImpl_Create(
|
||||
DirectSoundDevice *device,
|
||||
IDirectSoundBufferImpl **ppdsb,
|
||||
LPCDSBUFFERDESC dsbd);
|
||||
HRESULT WINAPI IDirectSoundBufferImpl_Destroy(
|
||||
HRESULT IDirectSoundBufferImpl_Destroy(
|
||||
IDirectSoundBufferImpl *pdsb);
|
||||
HRESULT IDirectSoundBufferImpl_Duplicate(
|
||||
DirectSoundDevice *device,
|
||||
IDirectSoundBufferImpl **ppdsb,
|
||||
IDirectSoundBufferImpl *pdsb);
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -255,39 +225,28 @@ struct SecondaryBufferImpl
|
|||
IDirectSoundBufferImpl* dsb;
|
||||
};
|
||||
|
||||
HRESULT WINAPI SecondaryBufferImpl_Create(
|
||||
HRESULT SecondaryBufferImpl_Create(
|
||||
IDirectSoundBufferImpl *dsb,
|
||||
SecondaryBufferImpl **pdsb);
|
||||
HRESULT WINAPI SecondaryBufferImpl_Destroy(
|
||||
SecondaryBufferImpl *pdsb);
|
||||
|
||||
/*****************************************************************************
|
||||
* PrimaryBuffer implementation structure
|
||||
*/
|
||||
struct PrimaryBufferImpl
|
||||
{
|
||||
const IDirectSoundBuffer8Vtbl *lpVtbl;
|
||||
const IDirectSoundBufferVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
IDirectSoundImpl* dsound;
|
||||
DirectSoundDevice* device;
|
||||
};
|
||||
|
||||
HRESULT WINAPI PrimaryBufferImpl_Create(
|
||||
IDirectSoundImpl *ds,
|
||||
PrimaryBufferImpl **pdsb,
|
||||
HRESULT PrimaryBufferImpl_Create(
|
||||
DirectSoundDevice * device,
|
||||
PrimaryBufferImpl **ppdsb,
|
||||
LPCDSBUFFERDESC dsbd);
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirectSoundCapture implementation structure
|
||||
* DirectSoundCaptureDevice implementation structure
|
||||
*/
|
||||
struct IDirectSoundCaptureImpl
|
||||
{
|
||||
/* IUnknown fields */
|
||||
const IDirectSoundCaptureVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
|
||||
DirectSoundCaptureDevice *device;
|
||||
};
|
||||
|
||||
struct DirectSoundCaptureDevice
|
||||
{
|
||||
/* IDirectSoundCaptureImpl fields */
|
||||
|
@ -306,7 +265,6 @@ struct DirectSoundCaptureDevice
|
|||
/* more stuff */
|
||||
LPBYTE buffer;
|
||||
DWORD buflen;
|
||||
DWORD read_position;
|
||||
|
||||
PWAVEFORMATEX pwfx;
|
||||
|
||||
|
@ -318,16 +276,11 @@ struct DirectSoundCaptureDevice
|
|||
CRITICAL_SECTION lock;
|
||||
};
|
||||
|
||||
HRESULT WINAPI IDirectSoundCaptureImpl_Create(
|
||||
LPDIRECTSOUNDCAPTURE8 * ppds);
|
||||
|
||||
HRESULT WINAPI DSOUND_CaptureCreate(
|
||||
LPDIRECTSOUNDCAPTURE *ppDSC,
|
||||
IUnknown *pUnkOuter);
|
||||
|
||||
HRESULT WINAPI DSOUND_CaptureCreate8(
|
||||
LPDIRECTSOUNDCAPTURE8 *ppDSC8,
|
||||
IUnknown *pUnkOuter);
|
||||
HRESULT DirectSoundCaptureDevice_Initialize(
|
||||
DirectSoundCaptureDevice ** ppDevice,
|
||||
LPCGUID lpcGUID);
|
||||
ULONG DirectSoundCaptureDevice_Release(
|
||||
DirectSoundCaptureDevice * device);
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirectSoundCaptureBuffer implementation structure
|
||||
|
@ -339,7 +292,7 @@ struct IDirectSoundCaptureBufferImpl
|
|||
LONG ref;
|
||||
|
||||
/* IDirectSoundCaptureBufferImpl fields */
|
||||
IDirectSoundCaptureImpl* dsound;
|
||||
DirectSoundCaptureDevice* device;
|
||||
/* FIXME: don't need this */
|
||||
LPDSCBUFFERDESC pdscbd;
|
||||
DWORD flags;
|
||||
|
@ -351,6 +304,11 @@ struct IDirectSoundCaptureBufferImpl
|
|||
PIDSDRIVERNOTIFY hwnotify;
|
||||
};
|
||||
|
||||
HRESULT IDirectSoundCaptureBufferImpl_Create(
|
||||
DirectSoundCaptureDevice *device,
|
||||
IDirectSoundCaptureBufferImpl ** ppobj,
|
||||
LPCDSCBUFFERDESC lpcDSCBufferDesc);
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirectSoundFullDuplex implementation structure
|
||||
*/
|
||||
|
@ -358,43 +316,44 @@ struct IDirectSoundFullDuplexImpl
|
|||
{
|
||||
/* IUnknown fields */
|
||||
const IDirectSoundFullDuplexVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
LONG ref;
|
||||
|
||||
/* IDirectSoundFullDuplexImpl fields */
|
||||
CRITICAL_SECTION lock;
|
||||
DirectSoundDevice *renderer_device;
|
||||
DirectSoundCaptureDevice *capture_device;
|
||||
|
||||
LPUNKNOWN pUnknown;
|
||||
LPDIRECTSOUND pDS;
|
||||
LPDIRECTSOUND8 pDS8;
|
||||
LPDIRECTSOUNDCAPTURE pDSC;
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirectSoundNotify implementation structure
|
||||
* IDirectSoundFullDuplex COM components
|
||||
*/
|
||||
struct IDirectSoundNotifyImpl
|
||||
{
|
||||
/* IUnknown fields */
|
||||
const IDirectSoundNotifyVtbl *lpVtbl;
|
||||
struct IDirectSoundFullDuplex_IUnknown {
|
||||
const IUnknownVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
IDirectSoundBufferImpl* dsb;
|
||||
IDirectSoundFullDuplexImpl *pdsfd;
|
||||
};
|
||||
|
||||
HRESULT WINAPI IDirectSoundNotifyImpl_Create(
|
||||
IDirectSoundBufferImpl *dsb,
|
||||
IDirectSoundNotifyImpl **pdsn);
|
||||
HRESULT WINAPI IDirectSoundNotifyImpl_Destroy(
|
||||
IDirectSoundNotifyImpl *pdsn);
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirectSoundCaptureNotify implementation structure
|
||||
*/
|
||||
struct IDirectSoundCaptureNotifyImpl
|
||||
{
|
||||
/* IUnknown fields */
|
||||
const IDirectSoundNotifyVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
IDirectSoundCaptureBufferImpl* dscb;
|
||||
struct IDirectSoundFullDuplex_IDirectSound {
|
||||
const IDirectSoundVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
IDirectSoundFullDuplexImpl *pdsfd;
|
||||
};
|
||||
|
||||
HRESULT WINAPI IDirectSoundCaptureNotifyImpl_Create(
|
||||
IDirectSoundCaptureBufferImpl *dscb,
|
||||
IDirectSoundCaptureNotifyImpl ** pdscn);
|
||||
struct IDirectSoundFullDuplex_IDirectSound8 {
|
||||
const IDirectSound8Vtbl *lpVtbl;
|
||||
LONG ref;
|
||||
IDirectSoundFullDuplexImpl *pdsfd;
|
||||
};
|
||||
|
||||
struct IDirectSoundFullDuplex_IDirectSoundCapture {
|
||||
const IDirectSoundCaptureVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
IDirectSoundFullDuplexImpl *pdsfd;
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirectSound3DListener implementation structure
|
||||
|
@ -405,11 +364,11 @@ struct IDirectSound3DListenerImpl
|
|||
const IDirectSound3DListenerVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
/* IDirectSound3DListenerImpl fields */
|
||||
IDirectSoundImpl* dsound;
|
||||
DirectSoundDevice* device;
|
||||
};
|
||||
|
||||
HRESULT WINAPI IDirectSound3DListenerImpl_Create(
|
||||
PrimaryBufferImpl *pb,
|
||||
HRESULT IDirectSound3DListenerImpl_Create(
|
||||
DirectSoundDevice *device,
|
||||
IDirectSound3DListenerImpl **pdsl);
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -424,10 +383,10 @@ struct IKsBufferPropertySetImpl
|
|||
IDirectSoundBufferImpl* dsb;
|
||||
};
|
||||
|
||||
HRESULT WINAPI IKsBufferPropertySetImpl_Create(
|
||||
HRESULT IKsBufferPropertySetImpl_Create(
|
||||
IDirectSoundBufferImpl *dsb,
|
||||
IKsBufferPropertySetImpl **piks);
|
||||
HRESULT WINAPI IKsBufferPropertySetImpl_Destroy(
|
||||
HRESULT IKsBufferPropertySetImpl_Destroy(
|
||||
IKsBufferPropertySetImpl *piks);
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -440,7 +399,8 @@ struct IKsPrivatePropertySetImpl
|
|||
LONG ref;
|
||||
};
|
||||
|
||||
HRESULT WINAPI IKsPrivatePropertySetImpl_Create(
|
||||
HRESULT IKsPrivatePropertySetImpl_Create(
|
||||
REFIID riid,
|
||||
IKsPrivatePropertySetImpl **piks);
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -455,67 +415,74 @@ struct IDirectSound3DBufferImpl
|
|||
IDirectSoundBufferImpl* dsb;
|
||||
};
|
||||
|
||||
HRESULT WINAPI IDirectSound3DBufferImpl_Create(
|
||||
HRESULT IDirectSound3DBufferImpl_Create(
|
||||
IDirectSoundBufferImpl *dsb,
|
||||
IDirectSound3DBufferImpl **pds3db);
|
||||
HRESULT WINAPI IDirectSound3DBufferImpl_Destroy(
|
||||
HRESULT IDirectSound3DBufferImpl_Destroy(
|
||||
IDirectSound3DBufferImpl *pds3db);
|
||||
|
||||
/*******************************************************************************
|
||||
* DirectSound ClassFactory implementation structure
|
||||
*/
|
||||
struct IClassFactoryImpl
|
||||
{
|
||||
/* IUnknown fields */
|
||||
const IClassFactoryVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
};
|
||||
|
||||
extern IClassFactoryImpl DSOUND_CAPTURE_CF;
|
||||
extern IClassFactoryImpl DSOUND_FULLDUPLEX_CF;
|
||||
|
||||
void DSOUND_RecalcVolPan(PDSVOLUMEPAN volpan);
|
||||
void DSOUND_AmpFactorToVolPan(PDSVOLUMEPAN volpan);
|
||||
void DSOUND_RecalcFormat(IDirectSoundBufferImpl *dsb);
|
||||
|
||||
/* dsound.c */
|
||||
|
||||
HRESULT DSOUND_AddBuffer(IDirectSoundImpl * pDS, IDirectSoundBufferImpl * pDSB);
|
||||
HRESULT DSOUND_RemoveBuffer(IDirectSoundImpl * pDS, IDirectSoundBufferImpl * pDSB);
|
||||
HRESULT DSOUND_Create(REFIID riid, LPDIRECTSOUND *ppDS);
|
||||
HRESULT DSOUND_Create8(REFIID riid, LPDIRECTSOUND8 *ppDS);
|
||||
|
||||
/* primary.c */
|
||||
|
||||
DWORD DSOUND_fraglen(DWORD nSamplesPerSec, DWORD nBlockAlign);
|
||||
HRESULT DSOUND_PrimaryCreate(DirectSoundDevice *device);
|
||||
HRESULT DSOUND_PrimaryDestroy(DirectSoundDevice *device);
|
||||
HRESULT DSOUND_PrimaryPlay(DirectSoundDevice *device);
|
||||
HRESULT DSOUND_PrimaryStop(DirectSoundDevice *device);
|
||||
HRESULT DSOUND_PrimaryGetPosition(DirectSoundDevice *device, LPDWORD playpos, LPDWORD writepos);
|
||||
HRESULT DSOUND_PrimarySetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX wfex, BOOL forced);
|
||||
HRESULT DSOUND_ReopenDevice(DirectSoundDevice *device, BOOL forcewave);
|
||||
|
||||
/* buffer.c */
|
||||
|
||||
DWORD DSOUND_CalcPlayPosition(IDirectSoundBufferImpl *This, DWORD pplay, DWORD pwrite);
|
||||
/* duplex.c */
|
||||
|
||||
HRESULT DSOUND_FullDuplexCreate(REFIID riid, LPDIRECTSOUNDFULLDUPLEX* ppDSFD);
|
||||
|
||||
/* mixer.c */
|
||||
DWORD DSOUND_bufpos_to_mixpos(const DirectSoundDevice* device, DWORD pos);
|
||||
void DSOUND_CheckEvent(const IDirectSoundBufferImpl *dsb, DWORD playpos, int len);
|
||||
void DSOUND_RecalcVolPan(PDSVOLUMEPAN volpan);
|
||||
void DSOUND_AmpFactorToVolPan(PDSVOLUMEPAN volpan);
|
||||
void DSOUND_RecalcFormat(IDirectSoundBufferImpl *dsb);
|
||||
void DSOUND_MixToTemporary(const IDirectSoundBufferImpl *dsb, DWORD writepos, DWORD mixlen, BOOL inmixer);
|
||||
DWORD DSOUND_secpos_to_bufpos(const IDirectSoundBufferImpl *dsb, DWORD secpos, DWORD secmixpos, DWORD* overshot);
|
||||
|
||||
void DSOUND_CheckEvent(IDirectSoundBufferImpl *dsb, int len);
|
||||
void DSOUND_ForceRemix(IDirectSoundBufferImpl *dsb);
|
||||
void DSOUND_MixCancelAt(IDirectSoundBufferImpl *dsb, DWORD buf_writepos);
|
||||
void DSOUND_WaveQueue(DirectSoundDevice *device, DWORD mixq);
|
||||
void DSOUND_PerformMix(DirectSoundDevice *device);
|
||||
void CALLBACK DSOUND_timer(UINT timerID, UINT msg, DWORD dwUser, DWORD dw1, DWORD dw2);
|
||||
void CALLBACK DSOUND_callback(HWAVEOUT hwo, UINT msg, DWORD dwUser, DWORD dw1, DWORD dw2);
|
||||
void CALLBACK DSOUND_timer(UINT timerID, UINT msg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2);
|
||||
void CALLBACK DSOUND_callback(HWAVEOUT hwo, UINT msg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2);
|
||||
|
||||
/* sound3d.c */
|
||||
|
||||
void DSOUND_Calc3DBuffer(IDirectSoundBufferImpl *dsb);
|
||||
|
||||
/* capture.c */
|
||||
|
||||
HRESULT DSOUND_CaptureCreate(REFIID riid, LPDIRECTSOUNDCAPTURE *ppDSC);
|
||||
HRESULT DSOUND_CaptureCreate8(REFIID riid, LPDIRECTSOUNDCAPTURE8 *ppDSC8);
|
||||
HRESULT WINAPI IDirectSoundCaptureImpl_CreateCaptureBuffer(
|
||||
LPDIRECTSOUNDCAPTURE iface,
|
||||
LPCDSCBUFFERDESC lpcDSCBufferDesc,
|
||||
LPDIRECTSOUNDCAPTUREBUFFER* lplpDSCaptureBuffer,
|
||||
LPUNKNOWN pUnk);
|
||||
HRESULT WINAPI IDirectSoundCaptureImpl_GetCaps(
|
||||
LPDIRECTSOUNDCAPTURE iface,
|
||||
LPDSCCAPS lpDSCCaps);
|
||||
HRESULT WINAPI IDirectSoundCaptureImpl_Initialize(
|
||||
LPDIRECTSOUNDCAPTURE iface,
|
||||
LPCGUID lpcGUID);
|
||||
|
||||
#define STATE_STOPPED 0
|
||||
#define STATE_STARTING 1
|
||||
#define STATE_PLAYING 2
|
||||
#define STATE_CAPTURING 2
|
||||
#define STATE_STOPPING 3
|
||||
|
||||
#define DSOUND_FREQSHIFT (14)
|
||||
#define DSOUND_FREQSHIFT (20)
|
||||
|
||||
extern DirectSoundDevice* DSOUND_renderer[MAXWAVEDRIVERS];
|
||||
extern GUID DSOUND_renderer_guids[MAXWAVEDRIVERS];
|
||||
|
@ -523,6 +490,6 @@ extern GUID DSOUND_renderer_guids[MAXWAVEDRIVERS];
|
|||
extern DirectSoundCaptureDevice * DSOUND_capture[MAXWAVEDRIVERS];
|
||||
extern GUID DSOUND_capture_guids[MAXWAVEDRIVERS];
|
||||
|
||||
extern HRESULT mmErr(UINT err);
|
||||
extern void setup_dsound_options(void);
|
||||
extern const char * get_device_id(LPCGUID pGuid);
|
||||
HRESULT mmErr(UINT err);
|
||||
void setup_dsound_options(void);
|
||||
const char * dumpCooperativeLevel(DWORD level);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,62 +0,0 @@
|
|||
/*
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser 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
|
||||
*
|
||||
* ReactOS emulation layer betwin wine and windows api for directx
|
||||
* This transform wine specfiy api to native reactos/windows api
|
||||
* wine have done some hack to geting dsound working. But does
|
||||
* hack does not work on windows or reactos. It need to warp thuse
|
||||
* api hack to true native api.
|
||||
*
|
||||
* this include file really need to be clean up.
|
||||
*
|
||||
* copyright 2004 by magnus olsen
|
||||
*/
|
||||
|
||||
#ifdef __REACTOS__
|
||||
#include <mmsystem.h>
|
||||
|
||||
// wine spec
|
||||
#define MAXWAVEDRIVERS 10
|
||||
#define MAXMIDIDRIVERS 10
|
||||
#define MAXAUXDRIVERS 10
|
||||
#define MAXMCIDRIVERS 32
|
||||
#define MAXMIXERDRIVERS 10
|
||||
|
||||
/* where */
|
||||
#ifdef RC_INVOKED
|
||||
#define _HRESULT_TYPEDEF_(x) (x)
|
||||
#else
|
||||
#define _HRESULT_TYPEDEF_(x) ((HRESULT)x)
|
||||
#endif
|
||||
|
||||
/* wine own api */
|
||||
#define DRV_QUERYDSOUNDIFACE (DRV_RESERVED + 20)
|
||||
#define DRV_QUERYDSOUNDDESC (DRV_RESERVED + 21)
|
||||
|
||||
#define WineWaveOutMessage RosWineWaveOutMessage
|
||||
#define WineWaveInMessage RosWineWaveInMessage
|
||||
|
||||
#else
|
||||
#define WineWaveOutMessage WaveOutMessage
|
||||
#define WineWaveInMessage WaveInMessage
|
||||
#endif
|
||||
|
||||
|
||||
/* dxroslayers prototypes */
|
||||
void dxGetGuidFromString( char *in_str, GUID *guid );
|
||||
|
||||
DWORD dxrosdrv_drv_querydsounddescss(int type, HWAVEOUT hwo_out,HWAVEIN hwo_in, PDSDRIVERDESC pDESC);
|
||||
DWORD dxrosdrv_drv_querydsoundiface(HWAVEIN wDevID, PIDSDRIVER* drv);
|
||||
|
||||
DWORD RosWineWaveOutMessage(HWAVEOUT hwo, UINT, DWORD_PTR, DWORD_PTR);
|
||||
DWORD RosWineWaveInMessage(HWAVEIN, UINT, DWORD_PTR, DWORD_PTR);
|
|
@ -1,163 +0,0 @@
|
|||
/*
|
||||
* reactos emulation layer betwin wine and windows api for directx
|
||||
* get hardware dec
|
||||
* Copyright 2004 Magnus Olsen
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser 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
|
||||
*
|
||||
* TODO:
|
||||
* soucre clean
|
||||
* need to rewrite almost everthing so it get all info from the hardware instead
|
||||
* see todo.rtf
|
||||
*
|
||||
* put it in own library that call dxroslayer.a
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/fcntl.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#define NONAMELESSSTRUCT
|
||||
#define NONAMELESSUNION
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winreg.h"
|
||||
#include "winuser.h"
|
||||
#include "wingdi.h"
|
||||
#include "winuser.h"
|
||||
#include "winerror.h"
|
||||
#include "mmsystem.h"
|
||||
#include "winternl.h"
|
||||
#include "mmddk.h"
|
||||
#include "wine/windef16.h"
|
||||
#include "wine/winbase16.h"
|
||||
#include "wine/debug.h"
|
||||
#include "dsound.h"
|
||||
#include "dsdriver.h"
|
||||
#include "dxros_layer.h"
|
||||
#include "dsconf.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dsound);
|
||||
|
||||
DWORD dxrosdrv_drv_querydsounddescss(int type, HWAVEOUT hwo_out,HWAVEIN hwo_in, PDSDRIVERDESC pDESC)
|
||||
{
|
||||
WAVEOUTCAPSA ac_play;
|
||||
WAVEINCAPSA ac_rec;
|
||||
DWORD msg;
|
||||
|
||||
|
||||
|
||||
// type 0 = out
|
||||
// clear data
|
||||
memset(pDESC,0,sizeof(DSDRIVERDESC));
|
||||
memset((char *)pDESC->szDrvname,0,255);
|
||||
if (type==0) memset(&ac_play,0,sizeof(WAVEOUTCAPSA));
|
||||
else memset(&ac_rec,0,sizeof(WAVEINCAPSA));
|
||||
|
||||
// get some data
|
||||
if (type==0) {
|
||||
msg = waveOutGetDevCapsA((UINT)hwo_out,&ac_play,sizeof(WAVEOUTCAPSA));
|
||||
if (ac_play.szPname==NULL) return MMSYSERR_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
else {
|
||||
msg = waveInGetDevCapsA((UINT)hwo_in,&ac_rec,sizeof(WAVEINCAPSA));
|
||||
if (ac_rec.szPname==NULL) return MMSYSERR_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
if (msg!=MMSYSERR_NOERROR) return msg;
|
||||
|
||||
|
||||
|
||||
// setting up value
|
||||
//pDESC->wReserved = NULL;
|
||||
|
||||
|
||||
if (type==0) {
|
||||
pDESC->ulDeviceNum = (ULONG)hwo_out;
|
||||
memcpy((char *)pDESC->szDesc,ac_play.szPname,strlen(ac_play.szPname));
|
||||
}
|
||||
else {
|
||||
pDESC->ulDeviceNum = (ULONG)hwo_in;
|
||||
memcpy((char *)pDESC->szDesc,ac_rec.szPname,strlen(ac_rec.szPname));
|
||||
}
|
||||
|
||||
// FIXME
|
||||
/* how to fill these
|
||||
pDESC->dwFlags |= DSDDESC_DOMMSYSTEMOPEN | DSDDESC_DOMMSYSTEMSETFORMAT |
|
||||
DSDDESC_USESYSTEMMEMORY | DSDDESC_DONTNEEDPRIMARYLOCK |
|
||||
DSDDESC_DONTNEEDSECONDARYLOCK;
|
||||
//pDesc->dnDevNode = WOutDev[This->wDevID].waveDesc.dnDevNode;
|
||||
pDESC->wVxdId = 0;
|
||||
pDESC->wReserved = 0;
|
||||
pDESC->dwHeapType = DSDHEAP_NOHEAP;
|
||||
pDESC->pvDirectDrawHeap = NULL;
|
||||
pDESC->dwMemStartAddress = 0;
|
||||
pDESC->dwMemEndAddress = 0;
|
||||
pDESC->dwMemAllocExtra = 0;
|
||||
pDESC->pvReserved1 = NULL;
|
||||
pDESC->pvReserved2 = NULL;
|
||||
|
||||
*/
|
||||
|
||||
pDESC->pvReserved1 = NULL;
|
||||
pDESC->pvReserved2 = NULL;
|
||||
|
||||
// we need to fill it right so we do not need ddraw.dll
|
||||
pDESC->pvDirectDrawHeap = NULL; // wine dsound does not use ddraw.dll
|
||||
|
||||
|
||||
// need to write dective for it
|
||||
pDESC->dwHeapType = DSDHEAP_NOHEAP;
|
||||
|
||||
// have take the value from wine audio drv
|
||||
pDESC->dwFlags = DSDDESC_DOMMSYSTEMOPEN |
|
||||
DSDDESC_DOMMSYSTEMSETFORMAT |
|
||||
DSDDESC_USESYSTEMMEMORY |
|
||||
DSDDESC_DONTNEEDPRIMARYLOCK |
|
||||
DSDDESC_DONTNEEDSECONDARYLOCK;
|
||||
|
||||
|
||||
//WAVEOPENDESC->DevNode need to fig. how to get it from mmdrv
|
||||
pDESC->dnDevNode = 0; // wine dsound are using this value
|
||||
|
||||
// need to fill the rest also
|
||||
|
||||
// must contain the audio drv name
|
||||
// but how to get it ?
|
||||
//memcpy((char *)pDESC->szDrvname,(char *)&"kx.sys",6);
|
||||
|
||||
|
||||
|
||||
pDESC->dwMemStartAddress = 0;
|
||||
pDESC->dwMemAllocExtra = 0;
|
||||
pDESC->wVxdId = 0;
|
||||
|
||||
|
||||
return MMSYSERR_NOERROR;
|
||||
}
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
* reactos emulation layer betwin wine and windows api for directx
|
||||
*
|
||||
* Copyright 2004 Magnus Olsen
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser 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
|
||||
*
|
||||
* TODO:
|
||||
* write hardware support for windows nt 4.0 and higher
|
||||
* put it in own library that call dxroslayer.a
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/fcntl.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#define NONAMELESSSTRUCT
|
||||
#define NONAMELESSUNION
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winreg.h"
|
||||
#include "winuser.h"
|
||||
#include "wingdi.h"
|
||||
#include "winuser.h"
|
||||
#include "winerror.h"
|
||||
#include "mmsystem.h"
|
||||
#include "winternl.h"
|
||||
#include "mmddk.h"
|
||||
#include "wine/windef16.h"
|
||||
#include "wine/winbase16.h"
|
||||
#include "wine/debug.h"
|
||||
#include "dsound.h"
|
||||
#include "dsdriver.h"
|
||||
#include "dsconf.h"
|
||||
#include "windows.h"
|
||||
#include "dxros_layer.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dsound);
|
||||
|
||||
|
||||
DWORD dxrosdrv_drv_querydsoundiface(HWAVEIN wDevID, PIDSDRIVER* drv)
|
||||
{
|
||||
// no hardware support for dsound NT 4.0 does not support it
|
||||
// but win 2000/xp drv does support hardware support of direct sound
|
||||
drv = NULL;
|
||||
// drv should be fild with hardware pointers see PIDSDRIVER struct
|
||||
return MMSYSERR_NOERROR;
|
||||
}
|
|
@ -1,115 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser 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
|
||||
*
|
||||
* ReactOS emulation layer betwin wine and windows api for directx
|
||||
* This transform wine specfiy api to native reactos/windows api
|
||||
* wine have done some hack to geting dsound working. But does
|
||||
* hack does not work on windows or reactos. It need to warp thuse
|
||||
* api hack to true native api.
|
||||
*
|
||||
* This layer have some weekness
|
||||
* it does not support hardware accleration of the sound card.
|
||||
* it need complete implant of it here, and we need also wdm
|
||||
* in reactos to complete dsound. for monet it is not posibile
|
||||
* to get all value and fill them. eg the soundcard drv name.
|
||||
*
|
||||
* Wine does get almost everthing from there sound drv, then
|
||||
* pass it thurg winmm, then to dsound. but windows drv does
|
||||
* not pass this info to the winmm. it send it on wdm instead.
|
||||
*
|
||||
* Do rember this dsound is hardcode to software mode only.
|
||||
* the program will not notice it. it will think it is hardware.
|
||||
* for the flag never report back it is in software mode.
|
||||
*
|
||||
*
|
||||
* Copyright 2004 Magnus Olsen
|
||||
*
|
||||
*/
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/fcntl.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#define NONAMELESSSTRUCT
|
||||
#define NONAMELESSUNION
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winreg.h"
|
||||
#include "winuser.h"
|
||||
#include "wingdi.h"
|
||||
#include "winuser.h"
|
||||
#include "winerror.h"
|
||||
#include "mmsystem.h"
|
||||
#include "winternl.h"
|
||||
#include "mmddk.h"
|
||||
#include "wine/windef16.h"
|
||||
#include "wine/winbase16.h"
|
||||
#include "wine/debug.h"
|
||||
#include "dsound.h"
|
||||
#include "dsdriver.h"
|
||||
#include "dxros_layer.h"
|
||||
#include "dsconf.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dsound);
|
||||
|
||||
|
||||
DWORD RosWineWaveOutMessage(HWAVEOUT hwo, UINT uMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
|
||||
{
|
||||
DWORD msg;
|
||||
switch (uMsg) {
|
||||
case DRV_QUERYDSOUNDDESC:
|
||||
msg = dxrosdrv_drv_querydsounddescss(0, (HWAVEOUT)((ULONG)hwo),(HWAVEIN) 0, (PDSDRIVERDESC) dwParam1);
|
||||
break;
|
||||
|
||||
case DRV_QUERYDSOUNDIFACE:
|
||||
msg = dxrosdrv_drv_querydsoundiface((HWAVEIN)hwo, (PIDSDRIVER*)dwParam1);
|
||||
break;
|
||||
|
||||
default :
|
||||
msg = waveOutMessage(hwo, uMsg, dwParam1, dwParam2);
|
||||
break;
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
DWORD RosWineWaveInMessage(HWAVEIN hwo, UINT uMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
|
||||
{
|
||||
DWORD msg;
|
||||
switch (uMsg) {
|
||||
case DRV_QUERYDSOUNDDESC:
|
||||
msg = dxrosdrv_drv_querydsounddescss(1, (HWAVEOUT)((ULONG)0),(HWAVEIN)((ULONG)hwo), (PDSDRIVERDESC) dwParam1);
|
||||
break;
|
||||
|
||||
case DRV_QUERYDSOUNDIFACE:
|
||||
msg = dxrosdrv_drv_querydsoundiface(hwo, (PIDSDRIVER*)dwParam1);
|
||||
break;
|
||||
|
||||
default :
|
||||
msg = waveInMessage(hwo, uMsg, dwParam1, dwParam2);
|
||||
break;
|
||||
}
|
||||
return msg;
|
||||
}
|
|
@ -1,176 +0,0 @@
|
|||
/*
|
||||
* ReactOS emulation layer betwin wine and windows api for directx
|
||||
* convort string to GUID
|
||||
*
|
||||
* Copyright 2004 Magnus Olsen
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser 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
|
||||
*
|
||||
*
|
||||
* TODO:
|
||||
* soucre clean
|
||||
* Rewrite so it use unicode instead for asc or find how windows convert it
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/fcntl.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#define NONAMELESSSTRUCT
|
||||
#define NONAMELESSUNION
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winreg.h"
|
||||
#include "winuser.h"
|
||||
#include "wingdi.h"
|
||||
#include "winuser.h"
|
||||
#include "winerror.h"
|
||||
#include "mmsystem.h"
|
||||
#include "winternl.h"
|
||||
#include "mmddk.h"
|
||||
#include "wine/windef16.h"
|
||||
#include "wine/winbase16.h"
|
||||
#include "wine/debug.h"
|
||||
#include "dsound.h"
|
||||
#include "dsdriver.h"
|
||||
#include "dxros_layer.h"
|
||||
#include "dsconf.h"
|
||||
#include "windows.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dsound);
|
||||
|
||||
|
||||
|
||||
void dxGetGuidFromString( char *in_str, GUID *guid )
|
||||
{
|
||||
unsigned long c=0;
|
||||
int i;
|
||||
|
||||
// this string hex converter need to be rewrite or find uhow windows convort a string
|
||||
// to GUID
|
||||
|
||||
for (i=1;i<9;i++)
|
||||
{
|
||||
if (in_str[i]>='0' && in_str[i]<='9')
|
||||
{
|
||||
c=c * 16 + (in_str[i] - 48);
|
||||
}
|
||||
else if (in_str[i]>='A' && in_str[i]<='F')
|
||||
{
|
||||
c=c * 16 + (in_str[i] - 55);
|
||||
}
|
||||
}
|
||||
guid->Data1 = c;
|
||||
c=0;
|
||||
|
||||
for (i=9;i<14;i++)
|
||||
{
|
||||
if (in_str[i]>='0' && in_str[i]<='9')
|
||||
{
|
||||
c=c * 16 + (in_str[i] - 48);
|
||||
}
|
||||
else if (in_str[i]>='A' && in_str[i]<='F')
|
||||
{
|
||||
c=c * 16 + (in_str[i] - 55);
|
||||
}
|
||||
}
|
||||
|
||||
guid->Data2 = (short) c;
|
||||
c=0;
|
||||
|
||||
for (i=14;i<19;i++)
|
||||
{
|
||||
if (in_str[i]>='0' && in_str[i]<='9') c=c * 16 + (in_str[i] - 48);
|
||||
else if (in_str[i]>='A' && in_str[i]<='F') c=c * 16 + (in_str[i] - 55);
|
||||
}
|
||||
guid->Data3 = (short) c;
|
||||
c=0;
|
||||
|
||||
for (i=20;i<22;i++)
|
||||
{
|
||||
if (in_str[i]>='0' && in_str[i]<='9') c=c * 16 + (in_str[i] - 48);
|
||||
else if (in_str[i]>='A' && in_str[i]<='F') c=c * 16 + (in_str[i] - 55);
|
||||
}
|
||||
guid->Data4[0] = (BYTE) c;
|
||||
c=0;
|
||||
|
||||
for (i=22;i<24;i++)
|
||||
{
|
||||
if (in_str[i]>='0' && in_str[i]<='9') c=c * 16 + (in_str[i] - 48);
|
||||
else if (in_str[i]>='A' && in_str[i]<='F') c=c * 16 + (in_str[i] - 55);
|
||||
}
|
||||
guid->Data4[1] = (BYTE) c;
|
||||
c=0;
|
||||
|
||||
|
||||
for (i=25;i<27;i++)
|
||||
{
|
||||
if (in_str[i]>='0' && in_str[i]<='9') c=c * 16 + (in_str[i] - 48);
|
||||
else if (in_str[i]>='A' && in_str[i]<='F') c=c * 16 + (in_str[i] - 55);
|
||||
}
|
||||
guid->Data4[2] = (BYTE) c;
|
||||
c=0;
|
||||
|
||||
for (i=27;i<29;i++)
|
||||
{
|
||||
if (in_str[i]>='0' && in_str[i]<='9') c=c * 16 + (in_str[i] - 48);
|
||||
else if (in_str[i]>='A' && in_str[i]<='F') c=c * 16 + (in_str[i] - 55);
|
||||
}
|
||||
guid->Data4[3] = (BYTE) c;
|
||||
c=0;
|
||||
|
||||
for (i=29;i<31;i++)
|
||||
{
|
||||
if (in_str[i]>='0' && in_str[i]<='9') c=c * 16 + (in_str[i] - 48);
|
||||
else if (in_str[i]>='A' && in_str[i]<='F') c=c * 16 + (in_str[i] - 55);
|
||||
}
|
||||
guid->Data4[4] = (BYTE) c;
|
||||
c=0;
|
||||
|
||||
for (i=31;i<33;i++)
|
||||
{
|
||||
if (in_str[i]>='0' && in_str[i]<='9') c=c * 16 + (in_str[i] - 48);
|
||||
else if (in_str[i]>='A' && in_str[i]<='F') c=c * 16 + (in_str[i] - 55);
|
||||
}
|
||||
guid->Data4[5] = (BYTE) c;
|
||||
c=0;
|
||||
|
||||
for (i=33;i<35;i++)
|
||||
{
|
||||
if (in_str[i]>='0' && in_str[i]<='9') c=c * 16 + (in_str[i] - 48);
|
||||
else if (in_str[i]>='A' && in_str[i]<='F') c=c * 16 + (in_str[i] - 55);
|
||||
}
|
||||
guid->Data4[6] = (BYTE) c;
|
||||
c=0;
|
||||
|
||||
for (i=35;i<37;i++)
|
||||
{
|
||||
if (in_str[i]>='0' && in_str[i]<='9') c=c * 16 + (in_str[i] - 48);
|
||||
else if (in_str[i]>='A' && in_str[i]<='F') c=c * 16 + (in_str[i] - 55);
|
||||
}
|
||||
guid->Data4[7] = (BYTE) c;
|
||||
c=0;
|
||||
}
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -15,26 +15,29 @@
|
|||
*
|
||||
* You should have received a copy of the GNU Lesser 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
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#define NONAMELESSSTRUCT
|
||||
#define NONAMELESSUNION
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
#include "winuser.h"
|
||||
#include "winreg.h"
|
||||
#include "winerror.h"
|
||||
|
||||
#include "mmsystem.h"
|
||||
#include "dsound.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "wine/unicode.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dsound);
|
||||
|
||||
static LSTATUS (WINAPI *pRegDeleteTreeW)(HKEY,LPCWSTR);
|
||||
static LSTATUS (WINAPI *pRegDeleteTreeA)(HKEY,LPCSTR);
|
||||
|
||||
/*
|
||||
* Near the bottom of this file are the exported DllRegisterServer and
|
||||
* DllUnregisterServer, which make all this worthwhile.
|
||||
|
@ -116,9 +119,6 @@ static LONG register_key_defvalueA(HKEY base, WCHAR const *name,
|
|||
static LONG register_progid(WCHAR const *clsid,
|
||||
char const *progid, char const *curver_progid,
|
||||
char const *name, char const *extra);
|
||||
static LONG recursive_delete_key(HKEY key);
|
||||
static LONG recursive_delete_keyA(HKEY base, char const *name);
|
||||
static LONG recursive_delete_keyW(HKEY base, WCHAR const *name);
|
||||
|
||||
/***********************************************************************
|
||||
* register_interfaces
|
||||
|
@ -149,7 +149,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list)
|
|||
}
|
||||
|
||||
if (list->base_iid) {
|
||||
register_key_guid(iid_key, base_ifa_keyname, list->base_iid);
|
||||
res = register_key_guid(iid_key, base_ifa_keyname, list->base_iid);
|
||||
if (res != ERROR_SUCCESS) goto error_close_iid_key;
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list)
|
|||
KEY_READ | KEY_WRITE, NULL, &key, NULL);
|
||||
if (res != ERROR_SUCCESS) goto error_close_iid_key;
|
||||
|
||||
wsprintfW(buf, fmt, list->num_methods);
|
||||
sprintfW(buf, fmt, list->num_methods);
|
||||
res = RegSetValueExW(key, NULL, 0, REG_SZ,
|
||||
(CONST BYTE*)buf,
|
||||
(lstrlenW(buf) + 1) * sizeof(WCHAR));
|
||||
|
@ -171,12 +171,12 @@ static HRESULT register_interfaces(struct regsvr_interface const *list)
|
|||
}
|
||||
|
||||
if (list->ps_clsid) {
|
||||
register_key_guid(iid_key, ps_clsid_keyname, list->ps_clsid);
|
||||
res = register_key_guid(iid_key, ps_clsid_keyname, list->ps_clsid);
|
||||
if (res != ERROR_SUCCESS) goto error_close_iid_key;
|
||||
}
|
||||
|
||||
if (list->ps_clsid32) {
|
||||
register_key_guid(iid_key, ps_clsid32_keyname, list->ps_clsid32);
|
||||
res = register_key_guid(iid_key, ps_clsid32_keyname, list->ps_clsid32);
|
||||
if (res != ERROR_SUCCESS) goto error_close_iid_key;
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,8 @@ static HRESULT unregister_interfaces(struct regsvr_interface const *list)
|
|||
WCHAR buf[39];
|
||||
|
||||
StringFromGUID2(list->iid, buf, 39);
|
||||
res = recursive_delete_keyW(interface_key, buf);
|
||||
res = pRegDeleteTreeW(interface_key, buf);
|
||||
if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
RegCloseKey(interface_key);
|
||||
|
@ -314,16 +315,19 @@ static HRESULT unregister_coclasses(struct regsvr_coclass const *list)
|
|||
WCHAR buf[39];
|
||||
|
||||
StringFromGUID2(list->clsid, buf, 39);
|
||||
res = recursive_delete_keyW(coclass_key, buf);
|
||||
res = pRegDeleteTreeW(coclass_key, buf);
|
||||
if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
|
||||
if (res != ERROR_SUCCESS) goto error_close_coclass_key;
|
||||
|
||||
if (list->progid) {
|
||||
res = recursive_delete_keyA(HKEY_CLASSES_ROOT, list->progid);
|
||||
res = pRegDeleteTreeA(HKEY_CLASSES_ROOT, list->progid);
|
||||
if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
|
||||
if (res != ERROR_SUCCESS) goto error_close_coclass_key;
|
||||
}
|
||||
|
||||
if (list->viprogid) {
|
||||
res = recursive_delete_keyA(HKEY_CLASSES_ROOT, list->viprogid);
|
||||
res = pRegDeleteTreeA(HKEY_CLASSES_ROOT, list->viprogid);
|
||||
if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
|
||||
if (res != ERROR_SUCCESS) goto error_close_coclass_key;
|
||||
}
|
||||
}
|
||||
|
@ -435,70 +439,6 @@ error_close_progid_key:
|
|||
return res;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* recursive_delete_key
|
||||
*/
|
||||
static LONG recursive_delete_key(HKEY key)
|
||||
{
|
||||
LONG res;
|
||||
WCHAR subkey_name[MAX_PATH];
|
||||
DWORD cName;
|
||||
HKEY subkey;
|
||||
|
||||
for (;;) {
|
||||
cName = sizeof(subkey_name) / sizeof(WCHAR);
|
||||
res = RegEnumKeyExW(key, 0, subkey_name, &cName,
|
||||
NULL, NULL, NULL, NULL);
|
||||
if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) {
|
||||
res = ERROR_SUCCESS; /* presumably we're done enumerating */
|
||||
break;
|
||||
}
|
||||
res = RegOpenKeyExW(key, subkey_name, 0,
|
||||
KEY_READ | KEY_WRITE, &subkey);
|
||||
if (res == ERROR_FILE_NOT_FOUND) continue;
|
||||
if (res != ERROR_SUCCESS) break;
|
||||
|
||||
res = recursive_delete_key(subkey);
|
||||
RegCloseKey(subkey);
|
||||
if (res != ERROR_SUCCESS) break;
|
||||
}
|
||||
|
||||
if (res == ERROR_SUCCESS) res = RegDeleteKeyW(key, 0);
|
||||
return res;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* recursive_delete_keyA
|
||||
*/
|
||||
static LONG recursive_delete_keyA(HKEY base, char const *name)
|
||||
{
|
||||
LONG res;
|
||||
HKEY key;
|
||||
|
||||
res = RegOpenKeyExA(base, name, 0, KEY_READ | KEY_WRITE, &key);
|
||||
if (res == ERROR_FILE_NOT_FOUND) return ERROR_SUCCESS;
|
||||
if (res != ERROR_SUCCESS) return res;
|
||||
res = recursive_delete_key(key);
|
||||
RegCloseKey(key);
|
||||
return res;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* recursive_delete_keyW
|
||||
*/
|
||||
static LONG recursive_delete_keyW(HKEY base, WCHAR const *name)
|
||||
{
|
||||
LONG res;
|
||||
HKEY key;
|
||||
|
||||
res = RegOpenKeyExW(base, name, 0, KEY_READ | KEY_WRITE, &key);
|
||||
if (res == ERROR_FILE_NOT_FOUND) return ERROR_SUCCESS;
|
||||
if (res != ERROR_SUCCESS) return res;
|
||||
res = recursive_delete_key(key);
|
||||
RegCloseKey(key);
|
||||
return res;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* coclass list
|
||||
*/
|
||||
|
@ -575,6 +515,12 @@ HRESULT WINAPI DllUnregisterServer(void)
|
|||
{
|
||||
HRESULT hr;
|
||||
|
||||
HMODULE advapi32 = GetModuleHandleA("advapi32");
|
||||
if (!advapi32) return E_FAIL;
|
||||
pRegDeleteTreeA = (void *) GetProcAddress(advapi32, "RegDeleteTreeA");
|
||||
pRegDeleteTreeW = (void *) GetProcAddress(advapi32, "RegDeleteTreeW");
|
||||
if (!pRegDeleteTreeA || !pRegDeleteTreeW) return E_FAIL;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
hr = unregister_coclasses(coclass_list);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
*
|
||||
* You should have received a copy of the GNU Lesser 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
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
/*
|
||||
* Most thread locking is complete. There may be a few race
|
||||
|
@ -44,8 +44,8 @@
|
|||
#define NONAMELESSSTRUCT
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winuser.h"
|
||||
#include "mmsystem.h"
|
||||
#include "winreg.h"
|
||||
#include "winternl.h"
|
||||
#include "mmddk.h"
|
||||
#include "wine/debug.h"
|
||||
|
@ -53,8 +53,6 @@
|
|||
#include "dsdriver.h"
|
||||
#include "dsound_private.h"
|
||||
|
||||
/* default intensity level for human ears */
|
||||
#define DEFAULT_INTENSITY 0.000000000001f
|
||||
/* default velocity of sound in the air */
|
||||
#define DEFAULT_VELOCITY 340
|
||||
|
||||
|
@ -65,29 +63,29 @@ WINE_DEFAULT_DEBUG_CHANNEL(dsound3d);
|
|||
*/
|
||||
|
||||
/* scalar product (i believe it's called dot product in english) */
|
||||
static inline D3DVALUE ScalarProduct (LPD3DVECTOR a, LPD3DVECTOR b)
|
||||
static inline D3DVALUE ScalarProduct (const D3DVECTOR *a, const D3DVECTOR *b)
|
||||
{
|
||||
D3DVALUE c;
|
||||
c = (a->x*b->x) + (a->y*b->y) + (a->z*b->z);
|
||||
TRACE("(%f,%f,%f) * (%f,%f,%f) = %f)\n", a->x, a->y, a->z, b->x, b->y, \
|
||||
TRACE("(%f,%f,%f) * (%f,%f,%f) = %f)\n", a->x, a->y, a->z, b->x, b->y,
|
||||
b->z, c);
|
||||
return c;
|
||||
}
|
||||
|
||||
/* vector product (i believe it's called cross product in english */
|
||||
static inline D3DVECTOR VectorProduct (LPD3DVECTOR a, LPD3DVECTOR b)
|
||||
static inline D3DVECTOR VectorProduct (const D3DVECTOR *a, const D3DVECTOR *b)
|
||||
{
|
||||
D3DVECTOR c;
|
||||
c.x = (a->y*b->z) - (a->z*b->y);
|
||||
c.y = (a->z*b->x) - (a->x*b->z);
|
||||
c.z = (a->x*b->y) - (a->y*b->x);
|
||||
TRACE("(%f,%f,%f) x (%f,%f,%f) = (%f,%f,%f)\n", a->x, a->y, a->z, b->x, b->y, \
|
||||
TRACE("(%f,%f,%f) x (%f,%f,%f) = (%f,%f,%f)\n", a->x, a->y, a->z, b->x, b->y,
|
||||
b->z, c.x, c.y, c.z);
|
||||
return c;
|
||||
}
|
||||
|
||||
/* magnitude (length) of vector */
|
||||
static inline D3DVALUE VectorMagnitude (LPD3DVECTOR a)
|
||||
static inline D3DVALUE VectorMagnitude (const D3DVECTOR *a)
|
||||
{
|
||||
D3DVALUE l;
|
||||
l = sqrt (ScalarProduct (a, a));
|
||||
|
@ -104,49 +102,31 @@ static inline D3DVALUE RadToDeg (D3DVALUE angle)
|
|||
return newangle;
|
||||
}
|
||||
|
||||
/* conversion between degrees and radians */
|
||||
static inline D3DVALUE DegToRad (D3DVALUE angle)
|
||||
{
|
||||
D3DVALUE newangle;
|
||||
newangle = angle * (2*M_PI/360);
|
||||
TRACE("%f deg = %f rad\n", angle, newangle);
|
||||
return newangle;
|
||||
}
|
||||
|
||||
/* angle between vectors - deg version */
|
||||
static inline D3DVALUE AngleBetweenVectorsDeg (LPD3DVECTOR a, LPD3DVECTOR b)
|
||||
{
|
||||
D3DVALUE la, lb, product, angle, cos;
|
||||
/* definition of scalar product: a*b = |a|*|b|*cos...therefore: */
|
||||
product = ScalarProduct (a,b);
|
||||
la = VectorMagnitude (a);
|
||||
lb = VectorMagnitude (b);
|
||||
cos = product/(la*lb);
|
||||
angle = acos(cos);
|
||||
/* we now have angle in radians */
|
||||
angle = RadToDeg(angle);
|
||||
TRACE("angle between (%f,%f,%f) and (%f,%f,%f) = %f degrees\n", a->x, a->y, a->z, b->x,
|
||||
b->y, b->z, angle);
|
||||
return angle;
|
||||
}
|
||||
|
||||
/* angle between vectors - rad version */
|
||||
static inline D3DVALUE AngleBetweenVectorsRad (LPD3DVECTOR a, LPD3DVECTOR b)
|
||||
static inline D3DVALUE AngleBetweenVectorsRad (const D3DVECTOR *a, const D3DVECTOR *b)
|
||||
{
|
||||
D3DVALUE la, lb, product, angle, cos;
|
||||
/* definition of scalar product: a*b = |a|*|b|*cos...therefore: */
|
||||
/* definition of scalar product: a*b = |a|*|b|*cos... therefore: */
|
||||
product = ScalarProduct (a,b);
|
||||
la = VectorMagnitude (a);
|
||||
lb = VectorMagnitude (b);
|
||||
if (!la || !lb)
|
||||
return 0;
|
||||
|
||||
cos = product/(la*lb);
|
||||
angle = acos(cos);
|
||||
TRACE("angle between (%f,%f,%f) and (%f,%f,%f) = %f radians\n", a->x, a->y, a->z, b->x,
|
||||
b->y, b->z, angle);
|
||||
return angle;
|
||||
TRACE("angle between (%f,%f,%f) and (%f,%f,%f) = %f radians (%f degrees)\n", a->x, a->y, a->z, b->x,
|
||||
b->y, b->z, angle, RadToDeg(angle));
|
||||
return angle;
|
||||
}
|
||||
|
||||
static inline D3DVALUE AngleBetweenVectorsDeg (const D3DVECTOR *a, const D3DVECTOR *b)
|
||||
{
|
||||
return RadToDeg(AngleBetweenVectorsRad(a, b));
|
||||
}
|
||||
|
||||
/* calculates vector between two points */
|
||||
static inline D3DVECTOR VectorBetweenTwoPoints (LPD3DVECTOR a, LPD3DVECTOR b)
|
||||
static inline D3DVECTOR VectorBetweenTwoPoints (const D3DVECTOR *a, const D3DVECTOR *b)
|
||||
{
|
||||
D3DVECTOR c;
|
||||
c.x = b->x - a->x;
|
||||
|
@ -158,7 +138,7 @@ static inline D3DVECTOR VectorBetweenTwoPoints (LPD3DVECTOR a, LPD3DVECTOR b)
|
|||
}
|
||||
|
||||
/* calculates the length of vector's projection on another vector */
|
||||
static inline D3DVALUE ProjectVector (LPD3DVECTOR a, LPD3DVECTOR p)
|
||||
static inline D3DVALUE ProjectVector (const D3DVECTOR *a, const D3DVECTOR *p)
|
||||
{
|
||||
D3DVALUE prod, result;
|
||||
prod = ScalarProduct(a, p);
|
||||
|
@ -176,9 +156,6 @@ void DSOUND_Calc3DBuffer(IDirectSoundBufferImpl *dsb)
|
|||
{
|
||||
/* volume, at which the sound will be played after all calcs. */
|
||||
D3DVALUE lVolume = 0;
|
||||
/* intensity (used for distance related stuff) */
|
||||
double flIntensity;
|
||||
double flTemp;
|
||||
/* stuff for distance related stuff calc. */
|
||||
D3DVECTOR vDistance;
|
||||
D3DVALUE flDistance = 0;
|
||||
|
@ -194,19 +171,18 @@ void DSOUND_Calc3DBuffer(IDirectSoundBufferImpl *dsb)
|
|||
|
||||
/* initial buffer volume */
|
||||
lVolume = dsb->ds3db_lVolume;
|
||||
|
||||
|
||||
switch (dsb->ds3db_ds3db.dwMode)
|
||||
{
|
||||
case DS3DMODE_DISABLE:
|
||||
TRACE("3D processing disabled\n");
|
||||
/* this one is here only to eliminate annoying warning message */
|
||||
DSOUND_RecalcVolPan (&dsb->volpan);
|
||||
DSOUND_ForceRemix (dsb);
|
||||
break;
|
||||
case DS3DMODE_NORMAL:
|
||||
TRACE("Normal 3D processing mode\n");
|
||||
/* we need to calculate distance between buffer and listener*/
|
||||
vDistance = VectorBetweenTwoPoints(&dsb->ds3db_ds3db.vPosition, &dsb->dsound->device->ds3dl.vPosition);
|
||||
vDistance = VectorBetweenTwoPoints(&dsb->ds3db_ds3db.vPosition, &dsb->device->ds3dl.vPosition);
|
||||
flDistance = VectorMagnitude (&vDistance);
|
||||
break;
|
||||
case DS3DMODE_HEADRELATIVE:
|
||||
|
@ -215,35 +191,27 @@ void DSOUND_Calc3DBuffer(IDirectSoundBufferImpl *dsb)
|
|||
flDistance = VectorMagnitude (&dsb->ds3db_ds3db.vPosition);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (flDistance > dsb->ds3db_ds3db.flMaxDistance)
|
||||
{
|
||||
/* some apps don't want you to hear too distant sounds... */
|
||||
if (dsb->dsbd.dwFlags & DSBCAPS_MUTE3DATMAXDISTANCE)
|
||||
{
|
||||
dsb->volpan.lVolume = DSBVOLUME_MIN;
|
||||
DSOUND_RecalcVolPan (&dsb->volpan);
|
||||
DSOUND_RecalcVolPan (&dsb->volpan);
|
||||
/* i guess mixing here would be a waste of power */
|
||||
return;
|
||||
}
|
||||
else
|
||||
flDistance = dsb->ds3db_ds3db.flMaxDistance;
|
||||
}
|
||||
}
|
||||
|
||||
if (flDistance < dsb->ds3db_ds3db.flMinDistance)
|
||||
flDistance = dsb->ds3db_ds3db.flMinDistance;
|
||||
|
||||
/* the following formula is taken from my physics book. I think it's ok for the *real* world...i hope m$ does it that way */
|
||||
lVolume += 10000; /* ms likes working with negative volume...i don't */
|
||||
lVolume /= 1000; /* convert hundreths of dB into B */
|
||||
/* intensity level (loudness) = log10(Intensity/DefaultIntensity)...therefore */
|
||||
flIntensity = pow(10,lVolume)*DEFAULT_INTENSITY;
|
||||
flTemp = (flDistance/dsb->ds3db_ds3db.flMinDistance)*(flDistance/dsb->ds3db_ds3db.flMinDistance);
|
||||
flIntensity /= flTemp;
|
||||
lVolume = log10(flIntensity/DEFAULT_INTENSITY);
|
||||
lVolume *= 1000; /* convert back to hundreths of dB */
|
||||
lVolume -= 10000; /* we need to do it in ms way */
|
||||
TRACE("dist. att: Distance = %f, MinDistance = %f => adjusting volume %ld to %f\n", flDistance, dsb->ds3db_ds3db.flMinDistance, dsb->ds3db_lVolume, lVolume);
|
||||
|
||||
/* attenuation proportional to the distance squared, converted to millibels as in lVolume*/
|
||||
lVolume -= log10(flDistance/dsb->ds3db_ds3db.flMinDistance * flDistance/dsb->ds3db_ds3db.flMinDistance)*1000;
|
||||
TRACE("dist. att: Distance = %f, MinDistance = %f => adjusting volume %d to %f\n", flDistance, dsb->ds3db_ds3db.flMinDistance, dsb->ds3db_lVolume, lVolume);
|
||||
|
||||
/* conning */
|
||||
/* sometimes it happens that vConeOrientation vector = (0,0,0); in this case angle is "nan" and it's useless*/
|
||||
|
@ -261,6 +229,9 @@ void DSOUND_Calc3DBuffer(IDirectSoundBufferImpl *dsb)
|
|||
/* my test show that for my way of calc., we need only half of angles */
|
||||
DWORD dwInsideConeAngle = dsb->ds3db_ds3db.dwInsideConeAngle/2;
|
||||
DWORD dwOutsideConeAngle = dsb->ds3db_ds3db.dwOutsideConeAngle/2;
|
||||
if (dwOutsideConeAngle == dwInsideConeAngle)
|
||||
++dwOutsideConeAngle;
|
||||
|
||||
/* full volume */
|
||||
if (flAngle < dwInsideConeAngle)
|
||||
flAngle = dwInsideConeAngle;
|
||||
|
@ -270,55 +241,57 @@ void DSOUND_Calc3DBuffer(IDirectSoundBufferImpl *dsb)
|
|||
/* this probably isn't the right thing, but it's ok for the time being */
|
||||
lVolume += ((dsb->ds3db_ds3db.lConeOutsideVolume)/((dwOutsideConeAngle) - (dwInsideConeAngle))) * flAngle;
|
||||
}
|
||||
TRACE("conning: Angle = %f deg; InsideConeAngle(/2) = %ld deg; OutsideConeAngle(/2) = %ld deg; ConeOutsideVolume = %ld => adjusting volume to %f\n",
|
||||
TRACE("conning: Angle = %f deg; InsideConeAngle(/2) = %d deg; OutsideConeAngle(/2) = %d deg; ConeOutsideVolume = %d => adjusting volume to %f\n",
|
||||
flAngle, dsb->ds3db_ds3db.dwInsideConeAngle/2, dsb->ds3db_ds3db.dwOutsideConeAngle/2, dsb->ds3db_ds3db.lConeOutsideVolume, lVolume);
|
||||
}
|
||||
dsb->volpan.lVolume = lVolume;
|
||||
|
||||
|
||||
/* panning */
|
||||
if (dsb->dsound->device->ds3dl.vPosition.x == dsb->ds3db_ds3db.vPosition.x &&
|
||||
dsb->dsound->device->ds3dl.vPosition.y == dsb->ds3db_ds3db.vPosition.y &&
|
||||
dsb->dsound->device->ds3dl.vPosition.z == dsb->ds3db_ds3db.vPosition.z) {
|
||||
if (dsb->device->ds3dl.vPosition.x == dsb->ds3db_ds3db.vPosition.x &&
|
||||
dsb->device->ds3dl.vPosition.y == dsb->ds3db_ds3db.vPosition.y &&
|
||||
dsb->device->ds3dl.vPosition.z == dsb->ds3db_ds3db.vPosition.z) {
|
||||
dsb->volpan.lPan = 0;
|
||||
flAngle = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
vDistance = VectorBetweenTwoPoints(&dsb->dsound->device->ds3dl.vPosition, &dsb->ds3db_ds3db.vPosition);
|
||||
vLeft = VectorProduct(&dsb->dsound->device->ds3dl.vOrientFront, &dsb->dsound->device->ds3dl.vOrientTop);
|
||||
vDistance = VectorBetweenTwoPoints(&dsb->device->ds3dl.vPosition, &dsb->ds3db_ds3db.vPosition);
|
||||
vLeft = VectorProduct(&dsb->device->ds3dl.vOrientFront, &dsb->device->ds3dl.vOrientTop);
|
||||
flAngle = AngleBetweenVectorsRad(&vLeft, &vDistance);
|
||||
/* for now, we'll use "linear formula" (which is probably incorrect); if someone has it in book, correct it */
|
||||
dsb->volpan.lPan = 10000*2*flAngle/M_PI - 10000;
|
||||
}
|
||||
TRACE("panning: Angle = %f rad, lPan = %ld\n", flAngle, dsb->volpan.lPan);
|
||||
TRACE("panning: Angle = %f rad, lPan = %d\n", flAngle, dsb->volpan.lPan);
|
||||
|
||||
/* FIXME: Doppler Effect disabled since i have no idea which frequency to change and how to do it */
|
||||
#if 0
|
||||
#if 0
|
||||
/* doppler shift*/
|
||||
if ((VectorMagnitude(&ds3db.vVelocity) == 0) && (VectorMagnitude(&dsb->dsound->device->ds3dl.vVelocity) == 0))
|
||||
if ((VectorMagnitude(&ds3db_ds3db.vVelocity) == 0) && (VectorMagnitude(&dsb->device->ds3dl.vVelocity) == 0))
|
||||
{
|
||||
TRACE("doppler: Buffer and Listener don't have velocities\n");
|
||||
}
|
||||
else
|
||||
else if (ds3db_ds3db.vVelocity != dsb->device->ds3dl.vVelocity)
|
||||
{
|
||||
/* calculate length of ds3db.vVelocity component which causes Doppler Effect
|
||||
/* calculate length of ds3db_ds3db.vVelocity component which causes Doppler Effect
|
||||
NOTE: if buffer moves TOWARDS the listener, it's velocity component is NEGATIVE
|
||||
if buffer moves AWAY from listener, it's velocity component is POSITIVE */
|
||||
flBufferVel = ProjectVector(&dsb->ds3db_ds3db.vVelocity, &vDistance);
|
||||
/* calculate length of ds3dl.vVelocity component which causes Doppler Effect
|
||||
NOTE: if listener moves TOWARDS the buffer, it's velocity component is POSITIVE
|
||||
if listener moves AWAY from buffer, it's velocity component is NEGATIVE */
|
||||
flListenerVel = ProjectVector(&dsb->dsound->device->ds3dl.vVelocity, &vDistance);
|
||||
flListenerVel = ProjectVector(&dsb->device->ds3dl.vVelocity, &vDistance);
|
||||
/* formula taken from Gianicoli D.: Physics, 4th edition: */
|
||||
/* FIXME: replace dsb->freq with appropriate frequency ! */
|
||||
flFreq = dsb->freq * ((DEFAULT_VELOCITY + flListenerVel)/(DEFAULT_VELOCITY + flBufferVel));
|
||||
TRACE("doppler: Buffer velocity (component) = %lf, Listener velocity (component) = %lf => Doppler shift: %ld Hz -> %lf Hz\n", flBufferVel, flListenerVel, \
|
||||
TRACE("doppler: Buffer velocity (component) = %lf, Listener velocity (component) = %lf => Doppler shift: %ld Hz -> %lf Hz\n", flBufferVel, flListenerVel,
|
||||
dsb->freq, flFreq);
|
||||
/* FIXME: replace following line with correct frequency setting ! */
|
||||
dsb->freq = flFreq;
|
||||
DSOUND_RecalcFormat(dsb);
|
||||
DSOUND_MixToTemporary(dsb, 0, dsb->buflen);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* time for remix */
|
||||
DSOUND_RecalcVolPan(&dsb->volpan);
|
||||
}
|
||||
|
@ -328,22 +301,18 @@ static void DSOUND_Mix3DBuffer(IDirectSoundBufferImpl *dsb)
|
|||
TRACE("(%p)\n",dsb);
|
||||
|
||||
DSOUND_Calc3DBuffer(dsb);
|
||||
DSOUND_ForceRemix(dsb);
|
||||
}
|
||||
|
||||
static void WINAPI DSOUND_ChangeListener(IDirectSound3DListenerImpl *ds3dl)
|
||||
static void DSOUND_ChangeListener(IDirectSound3DListenerImpl *ds3dl)
|
||||
{
|
||||
int i;
|
||||
TRACE("(%p)\n",ds3dl);
|
||||
for (i = 0; i < ds3dl->dsound->device->nrofbuffers; i++)
|
||||
for (i = 0; i < ds3dl->device->nrofbuffers; i++)
|
||||
{
|
||||
/* some buffers don't have 3d buffer (Ultima IX seems to
|
||||
crash without the following line) */
|
||||
if (ds3dl->dsound->device->buffers[i]->ds3db == NULL)
|
||||
continue;
|
||||
if (ds3dl->dsound->device->buffers[i]->ds3db_need_recalc)
|
||||
/* check if this buffer is waiting for recalculation */
|
||||
if (ds3dl->device->buffers[i]->ds3db_need_recalc)
|
||||
{
|
||||
DSOUND_Mix3DBuffer(ds3dl->dsound->device->buffers[i]);
|
||||
DSOUND_Mix3DBuffer(ds3dl->device->buffers[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -366,7 +335,7 @@ static ULONG WINAPI IDirectSound3DBufferImpl_AddRef(LPDIRECTSOUND3DBUFFER iface)
|
|||
{
|
||||
IDirectSound3DBufferImpl *This = (IDirectSound3DBufferImpl *)iface;
|
||||
ULONG ref = InterlockedIncrement(&(This->ref));
|
||||
TRACE("(%p) ref was %ld\n", This, ref - 1);
|
||||
TRACE("(%p) ref was %d\n", This, ref - 1);
|
||||
return ref;
|
||||
}
|
||||
|
||||
|
@ -374,7 +343,7 @@ static ULONG WINAPI IDirectSound3DBufferImpl_Release(LPDIRECTSOUND3DBUFFER iface
|
|||
{
|
||||
IDirectSound3DBufferImpl *This = (IDirectSound3DBufferImpl *)iface;
|
||||
ULONG ref = InterlockedDecrement(&(This->ref));
|
||||
TRACE("(%p) ref was %ld\n", This, ref + 1);
|
||||
TRACE("(%p) ref was %d\n", This, ref + 1);
|
||||
|
||||
if (!ref) {
|
||||
This->dsb->ds3db = NULL;
|
||||
|
@ -399,10 +368,10 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_GetAllParameters(
|
|||
}
|
||||
|
||||
if (lpDs3dBuffer->dwSize < sizeof(*lpDs3dBuffer)) {
|
||||
WARN("invalid parameter: lpDs3dBuffer->dwSize = %ld < %d\n",lpDs3dBuffer->dwSize, sizeof(*lpDs3dBuffer));
|
||||
WARN("invalid parameter: lpDs3dBuffer->dwSize = %d\n",lpDs3dBuffer->dwSize);
|
||||
return DSERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
|
||||
TRACE("returning: all parameters\n");
|
||||
*lpDs3dBuffer = This->dsb->ds3db_ds3db;
|
||||
return DS_OK;
|
||||
|
@ -414,7 +383,7 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_GetConeAngles(
|
|||
LPDWORD lpdwOutsideConeAngle)
|
||||
{
|
||||
IDirectSound3DBufferImpl *This = (IDirectSound3DBufferImpl *)iface;
|
||||
TRACE("returning: Inside Cone Angle = %ld degrees; Outside Cone Angle = %ld degrees\n",
|
||||
TRACE("returning: Inside Cone Angle = %d degrees; Outside Cone Angle = %d degrees\n",
|
||||
This->dsb->ds3db_ds3db.dwInsideConeAngle, This->dsb->ds3db_ds3db.dwOutsideConeAngle);
|
||||
*lpdwInsideConeAngle = This->dsb->ds3db_ds3db.dwInsideConeAngle;
|
||||
*lpdwOutsideConeAngle = This->dsb->ds3db_ds3db.dwOutsideConeAngle;
|
||||
|
@ -439,7 +408,7 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_GetConeOutsideVolume(
|
|||
LPLONG lplConeOutsideVolume)
|
||||
{
|
||||
IDirectSound3DBufferImpl *This = (IDirectSound3DBufferImpl *)iface;
|
||||
TRACE("returning: Cone Outside Volume = %ld\n", This->dsb->ds3db_ds3db.lConeOutsideVolume);
|
||||
TRACE("returning: Cone Outside Volume = %d\n", This->dsb->ds3db_ds3db.lConeOutsideVolume);
|
||||
*lplConeOutsideVolume = This->dsb->ds3db_ds3db.lConeOutsideVolume;
|
||||
return DS_OK;
|
||||
}
|
||||
|
@ -469,7 +438,7 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_GetMode(
|
|||
LPDWORD lpdwMode)
|
||||
{
|
||||
IDirectSound3DBufferImpl *This = (IDirectSound3DBufferImpl *)iface;
|
||||
TRACE("returning: Mode = %ld\n", This->dsb->ds3db_ds3db.dwMode);
|
||||
TRACE("returning: Mode = %d\n", This->dsb->ds3db_ds3db.dwMode);
|
||||
*lpdwMode = This->dsb->ds3db_ds3db.dwMode;
|
||||
return DS_OK;
|
||||
}
|
||||
|
@ -507,7 +476,7 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetAllParameters(
|
|||
{
|
||||
IDirectSound3DBufferImpl *This = (IDirectSound3DBufferImpl *)iface;
|
||||
DWORD status = DSERR_INVALIDPARAM;
|
||||
TRACE("(%p,%p,%lx)\n",iface,lpcDs3dBuffer,dwApply);
|
||||
TRACE("(%p,%p,%x)\n",iface,lpcDs3dBuffer,dwApply);
|
||||
|
||||
if (lpcDs3dBuffer == NULL) {
|
||||
WARN("invalid parameter: lpcDs3dBuffer == NULL\n");
|
||||
|
@ -515,12 +484,11 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetAllParameters(
|
|||
}
|
||||
|
||||
if (lpcDs3dBuffer->dwSize != sizeof(DS3DBUFFER)) {
|
||||
WARN("invalid parameter: lpcDs3dBuffer->dwSize = %ld != %d\n",
|
||||
lpcDs3dBuffer->dwSize, sizeof(DS3DBUFFER));
|
||||
WARN("invalid parameter: lpcDs3dBuffer->dwSize = %d\n", lpcDs3dBuffer->dwSize);
|
||||
return status;
|
||||
}
|
||||
|
||||
TRACE("setting: all parameters; dwApply = %ld\n", dwApply);
|
||||
TRACE("setting: all parameters; dwApply = %d\n", dwApply);
|
||||
This->dsb->ds3db_ds3db = *lpcDs3dBuffer;
|
||||
|
||||
if (dwApply == DS3D_IMMEDIATE)
|
||||
|
@ -540,7 +508,7 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetConeAngles(
|
|||
DWORD dwApply)
|
||||
{
|
||||
IDirectSound3DBufferImpl *This = (IDirectSound3DBufferImpl *)iface;
|
||||
TRACE("setting: Inside Cone Angle = %ld; Outside Cone Angle = %ld; dwApply = %ld\n",
|
||||
TRACE("setting: Inside Cone Angle = %d; Outside Cone Angle = %d; dwApply = %d\n",
|
||||
dwInsideConeAngle, dwOutsideConeAngle, dwApply);
|
||||
This->dsb->ds3db_ds3db.dwInsideConeAngle = dwInsideConeAngle;
|
||||
This->dsb->ds3db_ds3db.dwOutsideConeAngle = dwOutsideConeAngle;
|
||||
|
@ -558,7 +526,7 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetConeOrientation(
|
|||
DWORD dwApply)
|
||||
{
|
||||
IDirectSound3DBufferImpl *This = (IDirectSound3DBufferImpl *)iface;
|
||||
TRACE("setting: Cone Orientation vector = (%f,%f,%f); dwApply = %ld\n", x, y, z, dwApply);
|
||||
TRACE("setting: Cone Orientation vector = (%f,%f,%f); dwApply = %d\n", x, y, z, dwApply);
|
||||
This->dsb->ds3db_ds3db.vConeOrientation.x = x;
|
||||
This->dsb->ds3db_ds3db.vConeOrientation.y = y;
|
||||
This->dsb->ds3db_ds3db.vConeOrientation.z = z;
|
||||
|
@ -577,7 +545,7 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetConeOutsideVolume(
|
|||
DWORD dwApply)
|
||||
{
|
||||
IDirectSound3DBufferImpl *This = (IDirectSound3DBufferImpl *)iface;
|
||||
TRACE("setting: ConeOutsideVolume = %ld; dwApply = %ld\n", lConeOutsideVolume, dwApply);
|
||||
TRACE("setting: ConeOutsideVolume = %d; dwApply = %d\n", lConeOutsideVolume, dwApply);
|
||||
This->dsb->ds3db_ds3db.lConeOutsideVolume = lConeOutsideVolume;
|
||||
if (dwApply == DS3D_IMMEDIATE)
|
||||
{
|
||||
|
@ -594,7 +562,7 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetMaxDistance(
|
|||
DWORD dwApply)
|
||||
{
|
||||
IDirectSound3DBufferImpl *This = (IDirectSound3DBufferImpl *)iface;
|
||||
TRACE("setting: MaxDistance = %f; dwApply = %ld\n", fMaxDistance, dwApply);
|
||||
TRACE("setting: MaxDistance = %f; dwApply = %d\n", fMaxDistance, dwApply);
|
||||
This->dsb->ds3db_ds3db.flMaxDistance = fMaxDistance;
|
||||
if (dwApply == DS3D_IMMEDIATE)
|
||||
{
|
||||
|
@ -611,7 +579,7 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetMinDistance(
|
|||
DWORD dwApply)
|
||||
{
|
||||
IDirectSound3DBufferImpl *This = (IDirectSound3DBufferImpl *)iface;
|
||||
TRACE("setting: MinDistance = %f; dwApply = %ld\n", fMinDistance, dwApply);
|
||||
TRACE("setting: MinDistance = %f; dwApply = %d\n", fMinDistance, dwApply);
|
||||
This->dsb->ds3db_ds3db.flMinDistance = fMinDistance;
|
||||
if (dwApply == DS3D_IMMEDIATE)
|
||||
{
|
||||
|
@ -628,7 +596,7 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetMode(
|
|||
DWORD dwApply)
|
||||
{
|
||||
IDirectSound3DBufferImpl *This = (IDirectSound3DBufferImpl *)iface;
|
||||
TRACE("setting: Mode = %ld; dwApply = %ld\n", dwMode, dwApply);
|
||||
TRACE("setting: Mode = %d; dwApply = %d\n", dwMode, dwApply);
|
||||
This->dsb->ds3db_ds3db.dwMode = dwMode;
|
||||
if (dwApply == DS3D_IMMEDIATE)
|
||||
{
|
||||
|
@ -645,7 +613,7 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetPosition(
|
|||
DWORD dwApply)
|
||||
{
|
||||
IDirectSound3DBufferImpl *This = (IDirectSound3DBufferImpl *)iface;
|
||||
TRACE("setting: Position vector = (%f,%f,%f); dwApply = %ld\n", x, y, z, dwApply);
|
||||
TRACE("setting: Position vector = (%f,%f,%f); dwApply = %d\n", x, y, z, dwApply);
|
||||
This->dsb->ds3db_ds3db.vPosition.x = x;
|
||||
This->dsb->ds3db_ds3db.vPosition.y = y;
|
||||
This->dsb->ds3db_ds3db.vPosition.z = z;
|
||||
|
@ -664,7 +632,7 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetVelocity(
|
|||
DWORD dwApply)
|
||||
{
|
||||
IDirectSound3DBufferImpl *This = (IDirectSound3DBufferImpl *)iface;
|
||||
TRACE("setting: Velocity vector = (%f,%f,%f); dwApply = %ld\n", x, y, z, dwApply);
|
||||
TRACE("setting: Velocity vector = (%f,%f,%f); dwApply = %d\n", x, y, z, dwApply);
|
||||
This->dsb->ds3db_ds3db.vVelocity.x = x;
|
||||
This->dsb->ds3db_ds3db.vVelocity.y = y;
|
||||
This->dsb->ds3db_ds3db.vVelocity.z = z;
|
||||
|
@ -704,7 +672,7 @@ static const IDirectSound3DBufferVtbl ds3dbvt =
|
|||
IDirectSound3DBufferImpl_SetVelocity,
|
||||
};
|
||||
|
||||
HRESULT WINAPI IDirectSound3DBufferImpl_Create(
|
||||
HRESULT IDirectSound3DBufferImpl_Create(
|
||||
IDirectSoundBufferImpl *dsb,
|
||||
IDirectSound3DBufferImpl **pds3db)
|
||||
{
|
||||
|
@ -748,7 +716,7 @@ HRESULT WINAPI IDirectSound3DBufferImpl_Create(
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirectSound3DBufferImpl_Destroy(
|
||||
HRESULT IDirectSound3DBufferImpl_Destroy(
|
||||
IDirectSound3DBufferImpl *pds3db)
|
||||
{
|
||||
TRACE("(%p)\n",pds3db);
|
||||
|
@ -785,10 +753,10 @@ static HRESULT WINAPI IDirectSound3DListenerImpl_QueryInterface(
|
|||
}
|
||||
|
||||
if ( IsEqualGUID(riid, &IID_IDirectSoundBuffer) ) {
|
||||
if (!This->dsound->device->primary)
|
||||
PrimaryBufferImpl_Create(This->dsound, &(This->dsound->device->primary), &(This->dsound->device->dsbd));
|
||||
if (This->dsound->device->primary) {
|
||||
*ppobj = This->dsound->device->primary;
|
||||
if (!This->device->primary)
|
||||
PrimaryBufferImpl_Create(This->device, &(This->device->primary), &(This->device->dsbd));
|
||||
if (This->device->primary) {
|
||||
*ppobj = This->device->primary;
|
||||
IDirectSoundBuffer_AddRef((LPDIRECTSOUNDBUFFER)*ppobj);
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -802,7 +770,7 @@ static ULONG WINAPI IDirectSound3DListenerImpl_AddRef(LPDIRECTSOUND3DLISTENER if
|
|||
{
|
||||
IDirectSound3DListenerImpl *This = (IDirectSound3DListenerImpl *)iface;
|
||||
ULONG ref = InterlockedIncrement(&(This->ref));
|
||||
TRACE("(%p) ref was %ld\n", This, ref - 1);
|
||||
TRACE("(%p) ref was %d\n", This, ref - 1);
|
||||
return ref;
|
||||
}
|
||||
|
||||
|
@ -810,10 +778,10 @@ static ULONG WINAPI IDirectSound3DListenerImpl_Release(LPDIRECTSOUND3DLISTENER i
|
|||
{
|
||||
IDirectSound3DListenerImpl *This = (IDirectSound3DListenerImpl *)iface;
|
||||
ULONG ref = InterlockedDecrement(&(This->ref));
|
||||
TRACE("(%p) ref was %ld\n", This, ref + 1);
|
||||
TRACE("(%p) ref was %d\n", This, ref + 1);
|
||||
|
||||
if (!ref) {
|
||||
This->dsound->device->listener = 0;
|
||||
This->device->listener = 0;
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
TRACE("(%p) released\n", This);
|
||||
}
|
||||
|
@ -834,12 +802,12 @@ static HRESULT WINAPI IDirectSound3DListenerImpl_GetAllParameter(
|
|||
}
|
||||
|
||||
if (lpDS3DL->dwSize < sizeof(*lpDS3DL)) {
|
||||
WARN("invalid parameter: lpDS3DL->dwSize = %ld < %d\n",lpDS3DL->dwSize, sizeof(*lpDS3DL));
|
||||
WARN("invalid parameter: lpDS3DL->dwSize = %d\n",lpDS3DL->dwSize);
|
||||
return DSERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
|
||||
TRACE("returning: all parameters\n");
|
||||
*lpDS3DL = This->dsound->device->ds3dl;
|
||||
*lpDS3DL = This->device->ds3dl;
|
||||
return DS_OK;
|
||||
}
|
||||
|
||||
|
@ -848,8 +816,8 @@ static HRESULT WINAPI IDirectSound3DListenerImpl_GetDistanceFactor(
|
|||
LPD3DVALUE lpfDistanceFactor)
|
||||
{
|
||||
IDirectSound3DListenerImpl *This = (IDirectSound3DListenerImpl *)iface;
|
||||
TRACE("returning: Distance Factor = %f\n", This->dsound->device->ds3dl.flDistanceFactor);
|
||||
*lpfDistanceFactor = This->dsound->device->ds3dl.flDistanceFactor;
|
||||
TRACE("returning: Distance Factor = %f\n", This->device->ds3dl.flDistanceFactor);
|
||||
*lpfDistanceFactor = This->device->ds3dl.flDistanceFactor;
|
||||
return DS_OK;
|
||||
}
|
||||
|
||||
|
@ -858,8 +826,8 @@ static HRESULT WINAPI IDirectSound3DListenerImpl_GetDopplerFactor(
|
|||
LPD3DVALUE lpfDopplerFactor)
|
||||
{
|
||||
IDirectSound3DListenerImpl *This = (IDirectSound3DListenerImpl *)iface;
|
||||
TRACE("returning: Doppler Factor = %f\n", This->dsound->device->ds3dl.flDopplerFactor);
|
||||
*lpfDopplerFactor = This->dsound->device->ds3dl.flDopplerFactor;
|
||||
TRACE("returning: Doppler Factor = %f\n", This->device->ds3dl.flDopplerFactor);
|
||||
*lpfDopplerFactor = This->device->ds3dl.flDopplerFactor;
|
||||
return DS_OK;
|
||||
}
|
||||
|
||||
|
@ -869,11 +837,11 @@ static HRESULT WINAPI IDirectSound3DListenerImpl_GetOrientation(
|
|||
LPD3DVECTOR lpvOrientTop)
|
||||
{
|
||||
IDirectSound3DListenerImpl *This = (IDirectSound3DListenerImpl *)iface;
|
||||
TRACE("returning: OrientFront vector = (%f,%f,%f); OrientTop vector = (%f,%f,%f)\n", This->dsound->device->ds3dl.vOrientFront.x, \
|
||||
This->dsound->device->ds3dl.vOrientFront.y, This->dsound->device->ds3dl.vOrientFront.z, This->dsound->device->ds3dl.vOrientTop.x, This->dsound->device->ds3dl.vOrientTop.y, \
|
||||
This->dsound->device->ds3dl.vOrientTop.z);
|
||||
*lpvOrientFront = This->dsound->device->ds3dl.vOrientFront;
|
||||
*lpvOrientTop = This->dsound->device->ds3dl.vOrientTop;
|
||||
TRACE("returning: OrientFront vector = (%f,%f,%f); OrientTop vector = (%f,%f,%f)\n", This->device->ds3dl.vOrientFront.x,
|
||||
This->device->ds3dl.vOrientFront.y, This->device->ds3dl.vOrientFront.z, This->device->ds3dl.vOrientTop.x, This->device->ds3dl.vOrientTop.y,
|
||||
This->device->ds3dl.vOrientTop.z);
|
||||
*lpvOrientFront = This->device->ds3dl.vOrientFront;
|
||||
*lpvOrientTop = This->device->ds3dl.vOrientTop;
|
||||
return DS_OK;
|
||||
}
|
||||
|
||||
|
@ -882,8 +850,8 @@ static HRESULT WINAPI IDirectSound3DListenerImpl_GetPosition(
|
|||
LPD3DVECTOR lpvPosition)
|
||||
{
|
||||
IDirectSound3DListenerImpl *This = (IDirectSound3DListenerImpl *)iface;
|
||||
TRACE("returning: Position vector = (%f,%f,%f)\n", This->dsound->device->ds3dl.vPosition.x, This->dsound->device->ds3dl.vPosition.y, This->dsound->device->ds3dl.vPosition.z);
|
||||
*lpvPosition = This->dsound->device->ds3dl.vPosition;
|
||||
TRACE("returning: Position vector = (%f,%f,%f)\n", This->device->ds3dl.vPosition.x, This->device->ds3dl.vPosition.y, This->device->ds3dl.vPosition.z);
|
||||
*lpvPosition = This->device->ds3dl.vPosition;
|
||||
return DS_OK;
|
||||
}
|
||||
|
||||
|
@ -892,8 +860,8 @@ static HRESULT WINAPI IDirectSound3DListenerImpl_GetRolloffFactor(
|
|||
LPD3DVALUE lpfRolloffFactor)
|
||||
{
|
||||
IDirectSound3DListenerImpl *This = (IDirectSound3DListenerImpl *)iface;
|
||||
TRACE("returning: RolloffFactor = %f\n", This->dsound->device->ds3dl.flRolloffFactor);
|
||||
*lpfRolloffFactor = This->dsound->device->ds3dl.flRolloffFactor;
|
||||
TRACE("returning: RolloffFactor = %f\n", This->device->ds3dl.flRolloffFactor);
|
||||
*lpfRolloffFactor = This->device->ds3dl.flRolloffFactor;
|
||||
return DS_OK;
|
||||
}
|
||||
|
||||
|
@ -902,8 +870,8 @@ static HRESULT WINAPI IDirectSound3DListenerImpl_GetVelocity(
|
|||
LPD3DVECTOR lpvVelocity)
|
||||
{
|
||||
IDirectSound3DListenerImpl *This = (IDirectSound3DListenerImpl *)iface;
|
||||
TRACE("returning: Velocity vector = (%f,%f,%f)\n", This->dsound->device->ds3dl.vVelocity.x, This->dsound->device->ds3dl.vVelocity.y, This->dsound->device->ds3dl.vVelocity.z);
|
||||
*lpvVelocity = This->dsound->device->ds3dl.vVelocity;
|
||||
TRACE("returning: Velocity vector = (%f,%f,%f)\n", This->device->ds3dl.vVelocity.x, This->device->ds3dl.vVelocity.y, This->device->ds3dl.vVelocity.z);
|
||||
*lpvVelocity = This->device->ds3dl.vVelocity;
|
||||
return DS_OK;
|
||||
}
|
||||
|
||||
|
@ -913,14 +881,14 @@ static HRESULT WINAPI IDirectSound3DListenerImpl_SetAllParameters(
|
|||
DWORD dwApply)
|
||||
{
|
||||
IDirectSound3DListenerImpl *This = (IDirectSound3DListenerImpl *)iface;
|
||||
TRACE("setting: all parameters; dwApply = %ld\n", dwApply);
|
||||
This->dsound->device->ds3dl = *lpcDS3DL;
|
||||
TRACE("setting: all parameters; dwApply = %d\n", dwApply);
|
||||
This->device->ds3dl = *lpcDS3DL;
|
||||
if (dwApply == DS3D_IMMEDIATE)
|
||||
{
|
||||
This->dsound->device->ds3dl_need_recalc = FALSE;
|
||||
This->device->ds3dl_need_recalc = FALSE;
|
||||
DSOUND_ChangeListener(This);
|
||||
}
|
||||
This->dsound->device->ds3dl_need_recalc = TRUE;
|
||||
This->device->ds3dl_need_recalc = TRUE;
|
||||
return DS_OK;
|
||||
}
|
||||
|
||||
|
@ -930,14 +898,14 @@ static HRESULT WINAPI IDirectSound3DListenerImpl_SetDistanceFactor(
|
|||
DWORD dwApply)
|
||||
{
|
||||
IDirectSound3DListenerImpl *This = (IDirectSound3DListenerImpl *)iface;
|
||||
TRACE("setting: Distance Factor = %f; dwApply = %ld\n", fDistanceFactor, dwApply);
|
||||
This->dsound->device->ds3dl.flDistanceFactor = fDistanceFactor;
|
||||
TRACE("setting: Distance Factor = %f; dwApply = %d\n", fDistanceFactor, dwApply);
|
||||
This->device->ds3dl.flDistanceFactor = fDistanceFactor;
|
||||
if (dwApply == DS3D_IMMEDIATE)
|
||||
{
|
||||
This->dsound->device->ds3dl_need_recalc = FALSE;
|
||||
This->device->ds3dl_need_recalc = FALSE;
|
||||
DSOUND_ChangeListener(This);
|
||||
}
|
||||
This->dsound->device->ds3dl_need_recalc = TRUE;
|
||||
This->device->ds3dl_need_recalc = TRUE;
|
||||
return DS_OK;
|
||||
}
|
||||
|
||||
|
@ -947,14 +915,14 @@ static HRESULT WINAPI IDirectSound3DListenerImpl_SetDopplerFactor(
|
|||
DWORD dwApply)
|
||||
{
|
||||
IDirectSound3DListenerImpl *This = (IDirectSound3DListenerImpl *)iface;
|
||||
TRACE("setting: Doppler Factor = %f; dwApply = %ld\n", fDopplerFactor, dwApply);
|
||||
This->dsound->device->ds3dl.flDopplerFactor = fDopplerFactor;
|
||||
TRACE("setting: Doppler Factor = %f; dwApply = %d\n", fDopplerFactor, dwApply);
|
||||
This->device->ds3dl.flDopplerFactor = fDopplerFactor;
|
||||
if (dwApply == DS3D_IMMEDIATE)
|
||||
{
|
||||
This->dsound->device->ds3dl_need_recalc = FALSE;
|
||||
This->device->ds3dl_need_recalc = FALSE;
|
||||
DSOUND_ChangeListener(This);
|
||||
}
|
||||
This->dsound->device->ds3dl_need_recalc = TRUE;
|
||||
This->device->ds3dl_need_recalc = TRUE;
|
||||
return DS_OK;
|
||||
}
|
||||
|
||||
|
@ -965,20 +933,20 @@ static HRESULT WINAPI IDirectSound3DListenerImpl_SetOrientation(
|
|||
DWORD dwApply)
|
||||
{
|
||||
IDirectSound3DListenerImpl *This = (IDirectSound3DListenerImpl *)iface;
|
||||
TRACE("setting: Front vector = (%f,%f,%f); Top vector = (%f,%f,%f); dwApply = %ld\n", \
|
||||
TRACE("setting: Front vector = (%f,%f,%f); Top vector = (%f,%f,%f); dwApply = %d\n",
|
||||
xFront, yFront, zFront, xTop, yTop, zTop, dwApply);
|
||||
This->dsound->device->ds3dl.vOrientFront.x = xFront;
|
||||
This->dsound->device->ds3dl.vOrientFront.y = yFront;
|
||||
This->dsound->device->ds3dl.vOrientFront.z = zFront;
|
||||
This->dsound->device->ds3dl.vOrientTop.x = xTop;
|
||||
This->dsound->device->ds3dl.vOrientTop.y = yTop;
|
||||
This->dsound->device->ds3dl.vOrientTop.z = zTop;
|
||||
This->device->ds3dl.vOrientFront.x = xFront;
|
||||
This->device->ds3dl.vOrientFront.y = yFront;
|
||||
This->device->ds3dl.vOrientFront.z = zFront;
|
||||
This->device->ds3dl.vOrientTop.x = xTop;
|
||||
This->device->ds3dl.vOrientTop.y = yTop;
|
||||
This->device->ds3dl.vOrientTop.z = zTop;
|
||||
if (dwApply == DS3D_IMMEDIATE)
|
||||
{
|
||||
This->dsound->device->ds3dl_need_recalc = FALSE;
|
||||
This->device->ds3dl_need_recalc = FALSE;
|
||||
DSOUND_ChangeListener(This);
|
||||
}
|
||||
This->dsound->device->ds3dl_need_recalc = TRUE;
|
||||
This->device->ds3dl_need_recalc = TRUE;
|
||||
return DS_OK;
|
||||
}
|
||||
|
||||
|
@ -988,16 +956,16 @@ static HRESULT WINAPI IDirectSound3DListenerImpl_SetPosition(
|
|||
DWORD dwApply)
|
||||
{
|
||||
IDirectSound3DListenerImpl *This = (IDirectSound3DListenerImpl *)iface;
|
||||
TRACE("setting: Position vector = (%f,%f,%f); dwApply = %ld\n", x, y, z, dwApply);
|
||||
This->dsound->device->ds3dl.vPosition.x = x;
|
||||
This->dsound->device->ds3dl.vPosition.y = y;
|
||||
This->dsound->device->ds3dl.vPosition.z = z;
|
||||
TRACE("setting: Position vector = (%f,%f,%f); dwApply = %d\n", x, y, z, dwApply);
|
||||
This->device->ds3dl.vPosition.x = x;
|
||||
This->device->ds3dl.vPosition.y = y;
|
||||
This->device->ds3dl.vPosition.z = z;
|
||||
if (dwApply == DS3D_IMMEDIATE)
|
||||
{
|
||||
This->dsound->device->ds3dl_need_recalc = FALSE;
|
||||
This->device->ds3dl_need_recalc = FALSE;
|
||||
DSOUND_ChangeListener(This);
|
||||
}
|
||||
This->dsound->device->ds3dl_need_recalc = TRUE;
|
||||
This->device->ds3dl_need_recalc = TRUE;
|
||||
return DS_OK;
|
||||
}
|
||||
|
||||
|
@ -1007,14 +975,14 @@ static HRESULT WINAPI IDirectSound3DListenerImpl_SetRolloffFactor(
|
|||
DWORD dwApply)
|
||||
{
|
||||
IDirectSound3DListenerImpl *This = (IDirectSound3DListenerImpl *)iface;
|
||||
TRACE("setting: Rolloff Factor = %f; dwApply = %ld\n", fRolloffFactor, dwApply);
|
||||
This->dsound->device->ds3dl.flRolloffFactor = fRolloffFactor;
|
||||
TRACE("setting: Rolloff Factor = %f; dwApply = %d\n", fRolloffFactor, dwApply);
|
||||
This->device->ds3dl.flRolloffFactor = fRolloffFactor;
|
||||
if (dwApply == DS3D_IMMEDIATE)
|
||||
{
|
||||
This->dsound->device->ds3dl_need_recalc = FALSE;
|
||||
This->device->ds3dl_need_recalc = FALSE;
|
||||
DSOUND_ChangeListener(This);
|
||||
}
|
||||
This->dsound->device->ds3dl_need_recalc = TRUE;
|
||||
This->device->ds3dl_need_recalc = TRUE;
|
||||
return DS_OK;
|
||||
}
|
||||
|
||||
|
@ -1024,16 +992,16 @@ static HRESULT WINAPI IDirectSound3DListenerImpl_SetVelocity(
|
|||
DWORD dwApply)
|
||||
{
|
||||
IDirectSound3DListenerImpl *This = (IDirectSound3DListenerImpl *)iface;
|
||||
TRACE("setting: Velocity vector = (%f,%f,%f); dwApply = %ld\n", x, y, z, dwApply);
|
||||
This->dsound->device->ds3dl.vVelocity.x = x;
|
||||
This->dsound->device->ds3dl.vVelocity.y = y;
|
||||
This->dsound->device->ds3dl.vVelocity.z = z;
|
||||
TRACE("setting: Velocity vector = (%f,%f,%f); dwApply = %d\n", x, y, z, dwApply);
|
||||
This->device->ds3dl.vVelocity.x = x;
|
||||
This->device->ds3dl.vVelocity.y = y;
|
||||
This->device->ds3dl.vVelocity.z = z;
|
||||
if (dwApply == DS3D_IMMEDIATE)
|
||||
{
|
||||
This->dsound->device->ds3dl_need_recalc = FALSE;
|
||||
This->device->ds3dl_need_recalc = FALSE;
|
||||
DSOUND_ChangeListener(This);
|
||||
}
|
||||
This->dsound->device->ds3dl_need_recalc = TRUE;
|
||||
This->device->ds3dl_need_recalc = TRUE;
|
||||
return DS_OK;
|
||||
}
|
||||
|
||||
|
@ -1070,45 +1038,45 @@ static const IDirectSound3DListenerVtbl ds3dlvt =
|
|||
IDirectSound3DListenerImpl_CommitDeferredSettings,
|
||||
};
|
||||
|
||||
HRESULT WINAPI IDirectSound3DListenerImpl_Create(
|
||||
PrimaryBufferImpl *This,
|
||||
IDirectSound3DListenerImpl **pdsl)
|
||||
HRESULT IDirectSound3DListenerImpl_Create(
|
||||
DirectSoundDevice * device,
|
||||
IDirectSound3DListenerImpl ** ppdsl)
|
||||
{
|
||||
IDirectSound3DListenerImpl *dsl;
|
||||
TRACE("(%p,%p)\n",This,pdsl);
|
||||
IDirectSound3DListenerImpl *pdsl;
|
||||
TRACE("(%p,%p)\n",device,ppdsl);
|
||||
|
||||
dsl = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(*dsl));
|
||||
pdsl = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(*pdsl));
|
||||
|
||||
if (dsl == NULL) {
|
||||
if (pdsl == NULL) {
|
||||
WARN("out of memory\n");
|
||||
*pdsl = 0;
|
||||
*ppdsl = 0;
|
||||
return DSERR_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
dsl->ref = 0;
|
||||
dsl->lpVtbl = &ds3dlvt;
|
||||
pdsl->ref = 0;
|
||||
pdsl->lpVtbl = &ds3dlvt;
|
||||
|
||||
dsl->dsound = This->dsound;
|
||||
pdsl->device = device;
|
||||
|
||||
dsl->dsound->device->ds3dl.dwSize = sizeof(DS3DLISTENER);
|
||||
dsl->dsound->device->ds3dl.vPosition.x = 0.0;
|
||||
dsl->dsound->device->ds3dl.vPosition.y = 0.0;
|
||||
dsl->dsound->device->ds3dl.vPosition.z = 0.0;
|
||||
dsl->dsound->device->ds3dl.vVelocity.x = 0.0;
|
||||
dsl->dsound->device->ds3dl.vVelocity.y = 0.0;
|
||||
dsl->dsound->device->ds3dl.vVelocity.z = 0.0;
|
||||
dsl->dsound->device->ds3dl.vOrientFront.x = 0.0;
|
||||
dsl->dsound->device->ds3dl.vOrientFront.y = 0.0;
|
||||
dsl->dsound->device->ds3dl.vOrientFront.z = 1.0;
|
||||
dsl->dsound->device->ds3dl.vOrientTop.x = 0.0;
|
||||
dsl->dsound->device->ds3dl.vOrientTop.y = 1.0;
|
||||
dsl->dsound->device->ds3dl.vOrientTop.z = 0.0;
|
||||
dsl->dsound->device->ds3dl.flDistanceFactor = DS3D_DEFAULTDISTANCEFACTOR;
|
||||
dsl->dsound->device->ds3dl.flRolloffFactor = DS3D_DEFAULTROLLOFFFACTOR;
|
||||
dsl->dsound->device->ds3dl.flDopplerFactor = DS3D_DEFAULTDOPPLERFACTOR;
|
||||
pdsl->device->ds3dl.dwSize = sizeof(DS3DLISTENER);
|
||||
pdsl->device->ds3dl.vPosition.x = 0.0;
|
||||
pdsl->device->ds3dl.vPosition.y = 0.0;
|
||||
pdsl->device->ds3dl.vPosition.z = 0.0;
|
||||
pdsl->device->ds3dl.vVelocity.x = 0.0;
|
||||
pdsl->device->ds3dl.vVelocity.y = 0.0;
|
||||
pdsl->device->ds3dl.vVelocity.z = 0.0;
|
||||
pdsl->device->ds3dl.vOrientFront.x = 0.0;
|
||||
pdsl->device->ds3dl.vOrientFront.y = 0.0;
|
||||
pdsl->device->ds3dl.vOrientFront.z = 1.0;
|
||||
pdsl->device->ds3dl.vOrientTop.x = 0.0;
|
||||
pdsl->device->ds3dl.vOrientTop.y = 1.0;
|
||||
pdsl->device->ds3dl.vOrientTop.z = 0.0;
|
||||
pdsl->device->ds3dl.flDistanceFactor = DS3D_DEFAULTDISTANCEFACTOR;
|
||||
pdsl->device->ds3dl.flRolloffFactor = DS3D_DEFAULTROLLOFFFACTOR;
|
||||
pdsl->device->ds3dl.flDopplerFactor = DS3D_DEFAULTDOPPLERFACTOR;
|
||||
|
||||
dsl->dsound->device->ds3dl_need_recalc = TRUE;
|
||||
pdsl->device->ds3dl_need_recalc = TRUE;
|
||||
|
||||
*pdsl = dsl;
|
||||
*ppdsl = pdsl;
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -13,15 +13,15 @@
|
|||
*
|
||||
* You should have received a copy of the GNU Lesser 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
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define WINE_OLESELFREGISTER
|
||||
#define WINE_FILEDESCRIPTION_STR "Wine DirectSound"
|
||||
#define WINE_FILENAME_STR "dsound.dll"
|
||||
#define WINE_FILEVERSION 5,3,0,900
|
||||
#define WINE_FILEVERSION_STR "5.3.0.900"
|
||||
#define WINE_PRODUCTVERSION 5,3,0,900
|
||||
#define WINE_PRODUCTVERSION_STR "5.3"
|
||||
#define WINE_FILEVERSION 5,3,1,904
|
||||
#define WINE_FILEVERSION_STR "5.3.1.904"
|
||||
#define WINE_PRODUCTVERSION 5,3,1,904
|
||||
#define WINE_PRODUCTVERSION_STR "5.3.1.904"
|
||||
|
||||
#include "wine/wine_common_ver.rc"
|
||||
|
|
|
@ -52,6 +52,7 @@ typedef struct IDsCaptureDriverBuffer *PIDSCDRIVERBUFFER;
|
|||
#define DSDDESC_USESYSTEMMEMORY 0x00000004
|
||||
#define DSDDESC_DONTNEEDPRIMARYLOCK 0x00000008
|
||||
#define DSDDESC_DONTNEEDSECONDARYLOCK 0x00000010
|
||||
#define DSDDESC_DONTNEEDWRITELEAD 0x00000020
|
||||
|
||||
#define DSDHEAP_NOHEAP 0
|
||||
#define DSDHEAP_CREATEHEAP 1
|
||||
|
|
|
@ -553,7 +553,7 @@ DECLARE_INTERFACE_(IDirectSoundBuffer,IUnknown)
|
|||
STDMETHOD(GetFrequency)(THIS_ LPDWORD lpdwFrequency) PURE;
|
||||
STDMETHOD(GetStatus)(THIS_ LPDWORD lpdwStatus) PURE;
|
||||
STDMETHOD(Initialize)(THIS_ LPDIRECTSOUND lpDirectSound, LPCDSBUFFERDESC lpcDSBufferDesc) PURE;
|
||||
STDMETHOD(Lock)(THIS_ DWORD dwWriteCursor, DWORD dwWriteBytes, LPVOID lplpvAudioPtr1, LPDWORD lpdwAudioBytes1, LPVOID lplpvAudioPtr2, LPDWORD lpdwAudioBytes2, DWORD dwFlags) PURE;
|
||||
STDMETHOD(Lock)(THIS_ DWORD dwWriteCursor, DWORD dwWriteBytes, LPVOID *lplpvAudioPtr1, LPDWORD lpdwAudioBytes1, LPVOID *lplpvAudioPtr2, LPDWORD lpdwAudioBytes2, DWORD dwFlags) PURE;
|
||||
STDMETHOD(Play)(THIS_ DWORD dwReserved1, DWORD dwReserved2, DWORD dwFlags) PURE;
|
||||
STDMETHOD(SetCurrentPosition)(THIS_ DWORD dwNewPosition) PURE;
|
||||
STDMETHOD(SetFormat)(THIS_ LPCWAVEFORMATEX lpcfxFormat) PURE;
|
||||
|
@ -636,7 +636,7 @@ DECLARE_INTERFACE_(IDirectSoundBuffer8,IUnknown)
|
|||
STDMETHOD(GetFrequency)(THIS_ LPDWORD lpdwFrequency) PURE;
|
||||
STDMETHOD(GetStatus)(THIS_ LPDWORD lpdwStatus) PURE;
|
||||
STDMETHOD(Initialize)(THIS_ LPDIRECTSOUND lpDirectSound, LPCDSBUFFERDESC lpcDSBufferDesc) PURE;
|
||||
STDMETHOD(Lock)(THIS_ DWORD dwWriteCursor, DWORD dwWriteBytes, LPVOID lplpvAudioPtr1, LPDWORD lpdwAudioBytes1, LPVOID lplpvAudioPtr2, LPDWORD lpdwAudioBytes2, DWORD dwFlags) PURE;
|
||||
STDMETHOD(Lock)(THIS_ DWORD dwWriteCursor, DWORD dwWriteBytes, LPVOID *lplpvAudioPtr1, LPDWORD lpdwAudioBytes1, LPVOID *lplpvAudioPtr2, LPDWORD lpdwAudioBytes2, DWORD dwFlags) PURE;
|
||||
STDMETHOD(Play)(THIS_ DWORD dwReserved1, DWORD dwReserved2, DWORD dwFlags) PURE;
|
||||
STDMETHOD(SetCurrentPosition)(THIS_ DWORD dwNewPosition) PURE;
|
||||
STDMETHOD(SetFormat)(THIS_ LPCWAVEFORMATEX lpcfxFormat) PURE;
|
||||
|
|
|
@ -27,6 +27,12 @@
|
|||
#define DRV_FAILURE 0x0000
|
||||
#define DRV_EXITAPPLICATION 0x000C
|
||||
|
||||
#define MAXWAVEDRIVERS 10
|
||||
#define MAXMIDIDRIVERS 10
|
||||
#define MAXAUXDRIVERS 10
|
||||
#define MAXMCIDRIVERS 32
|
||||
#define MAXMIXERDRIVERS 10
|
||||
|
||||
#define MCI_OPEN_DRIVER 0x0801
|
||||
#define MCI_CLOSE_DRIVER 0x0802
|
||||
#define MCI_SOUND 0x0812
|
||||
|
|
|
@ -15,18 +15,15 @@
|
|||
#include <basetyps.h>
|
||||
#include <guiddef.h>
|
||||
|
||||
/* Hack letting wine dsound be happy, it should not be in this file */
|
||||
|
||||
DEFINE_GUID(IID_IDsDriver, 0x8C4233C0l, 0xB4CC, 0x11CE, 0x92, 0x94, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00);
|
||||
DEFINE_GUID(IID_IDsDriverNotify, 0x00363EF44, 0x3B57, 0x11D3, 0xAC, 0x79, 0x00, 0x10, 0x5A, 0x01, 0x7f, 0xe1);
|
||||
DEFINE_GUID(IID_IDsDriverPropertySet, 0x0F6F2E8E0, 0xD842, 0x11D0, 0x8F, 0x75, 0x00, 0xC0, 0x4F, 0xC2, 0x8A, 0xCA);
|
||||
DEFINE_GUID(IID_IDsDriverBuffer, 0x8C4233C1l, 0xB4CC, 0x11CE, 0x92, 0x94, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00);
|
||||
/* FIXME - find a better place for these, needed for dsound */
|
||||
DEFINE_GUID(CLSID_DirectSoundPrivate, 0x11ab3ec0, 0x25ec, 0x11d1, 0xa4, 0xd8, 0x0, 0xc0, 0x4f, 0xc2, 0x8a, 0xca);
|
||||
DEFINE_GUID(DSPROPSETID_DirectSoundDevice, 0x84624f82, 0x25ec, 0x11d1, 0xa4, 0xd8, 0x0, 0xc0, 0x4f, 0xc2, 0x8a, 0xca);
|
||||
|
||||
/* Hack Getting ddraw to compile with kernel interface u can not mix dxguid and striims */
|
||||
DEFINE_GUID(IID_IDirectDrawKernel, 0x8D56C120, 0x6A08, 0x11D0, 0x9B, 0x06, 0x00, 0xA0, 0xC9, 0x03, 0xA3, 0xB8);
|
||||
DEFINE_GUID(IID_IDirectDrawSurfaceKernel, 0x60755DA0, 0x6A40, 0x11D0, 0x9B, 0x06, 0x00, 0xA0, 0xC9, 0x03, 0xA3, 0xB8);
|
||||
|
||||
/* This GUIDs does not extists in ms dxsdk 2004 dec in dxguid, I have tested */
|
||||
/* These GUIDs do not exist in ms dxsdk 2004 dec in dxguid, tested by Magnus Olsen */
|
||||
DEFINE_GUID(CLSID_DirectMusicMelodyFormulationTrack,0xb0684266,0xb57f,0x11d2,0x97,0xf9,0x0,0xc0,0x4f,0xa3,0x6e,0x58);
|
||||
DEFINE_GUID(CLSID_DirectMusicSong,0xaed5f0a5,0xd972,0x483d,0xa3,0x84,0x64,0x9d,0xfe,0xb9,0xc1,0x81);
|
||||
DEFINE_GUID(GUID_Clear_All_MelodyFragments,0x8509fee6,0xb617,0x11d2,0x97,0xfa,0x0,0xc0,0x4f,0xa3,0x6e,0x58);
|
||||
|
@ -50,8 +47,9 @@ DEFINE_GUID(IID_ID3DXTechnique,0xa00f378d,0xaf79,0x4917,0x90,0x7e,0x4d,0x63,0x5e
|
|||
DEFINE_GUID(IID_IDirectDraw3, 0x618F8AD4,0x8b7A,0x11D0,0x8F,0xCC,0x00,0xC0,0x4F,0xd9,0x18,0x9D);
|
||||
DEFINE_GUID(IID_IDirectMusicSong,0xa862b2ec,0x3676,0x4982,0x85,0xa,0x78,0x42,0x77,0x5e,0x1d,0x86);
|
||||
DEFINE_GUID(IID_IKsFastClock,0xc9902485,0xc180,0x11d2,0x84,0x73,0xd4,0x23,0x94,0x45,0x9e,0x5e);
|
||||
DEFINE_GUID(KSDATAFORMAT_SUBTYPE_PCM, 0x00000001, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
|
||||
|
||||
/* Match ms dxsdk 2004 dec this guids exists in dxguid, tested by Magnus Olsen */
|
||||
/* Match ms dxsdk 2004 dec these guids exist in dxguid, tested by Magnus Olsen */
|
||||
DEFINE_GUID(CLSID_DirectMusicAudioPathConfig, 0xEE0B9CA0, 0xA81E, 0x11D3, 0x9B, 0xD1, 0x00, 0x80, 0xC7, 0x15, 0x0A, 0x74);
|
||||
DEFINE_GUID(CLSID_CDirect3DRM, 0x4516EC41, 0x8F20, 0x11D0, 0x9B, 0x6D, 0x00, 0x00, 0xC0, 0x78, 0x1B, 0xC3);
|
||||
DEFINE_GUID(CLSID_CDirect3DRMAnimation, 0x4FA35698, 0x623F, 0x11CF, 0xAC, 0x4A, 0x00, 0x00, 0xC0, 0x38, 0x25, 0xA1);
|
||||
|
|
Loading…
Reference in a new issue