Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
5a1439cf
Commit
5a1439cf
authored
Mar 07, 2003
by
Robert Reif
Committed by
Alexandre Julliard
Mar 07, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a bug where a capture device was used after it failed to open
due to a missing driver. Added tests to try all possible combinations of sample rate, sample size and mono/stereo.
parent
26b9bcab
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
70 deletions
+40
-70
dsound.c
dlls/dsound/tests/dsound.c
+40
-70
No files found.
dlls/dsound/tests/dsound.c
View file @
5a1439cf
...
...
@@ -28,6 +28,34 @@
#include "initguid.h"
#include "dsound.h"
static
const
unsigned
int
formats
[][
3
]
=
{
{
8000
,
8
,
1
},
{
8000
,
8
,
2
},
{
8000
,
16
,
1
},
{
8000
,
16
,
2
},
{
11025
,
8
,
1
},
{
11025
,
8
,
2
},
{
11025
,
16
,
1
},
{
11025
,
16
,
2
},
{
22050
,
8
,
1
},
{
22050
,
8
,
2
},
{
22050
,
16
,
1
},
{
22050
,
16
,
2
},
{
44100
,
8
,
1
},
{
44100
,
8
,
2
},
{
44100
,
16
,
1
},
{
44100
,
16
,
2
},
{
48000
,
8
,
1
},
{
48000
,
8
,
2
},
{
48000
,
16
,
1
},
{
48000
,
16
,
2
},
{
96000
,
8
,
1
},
{
96000
,
8
,
2
},
{
96000
,
16
,
1
},
{
96000
,
16
,
2
}
};
#define NB_FORMATS (sizeof(formats)/sizeof(*formats))
/* The time slice determines how often we will service the buffer and the
* buffer will be four time slices long
*/
...
...
@@ -371,6 +399,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
DSBUFFERDESC
bufdesc
;
WAVEFORMATEX
wfx
;
DSCAPS
dscaps
;
int
f
;
trace
(
"Testing %s - %s : %s
\n
"
,
lpcstrDescription
,
lpcstrModule
,
wine_dbgstr_guid
(
lpGuid
));
rc
=
DirectSoundCreate
(
lpGuid
,
&
dso
,
NULL
);
...
...
@@ -418,7 +447,8 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
goto
EXIT
;
/* Testing secondary buffers */
init_format
(
&
wfx
,
11025
,
8
,
1
);
for
(
f
=
0
;
f
<
NB_FORMATS
;
f
++
)
{
init_format
(
&
wfx
,
formats
[
f
][
0
],
formats
[
f
][
1
],
formats
[
f
][
2
]);
bufdesc
.
dwSize
=
sizeof
(
bufdesc
);
bufdesc
.
dwFlags
=
DSBCAPS_CTRLDEFAULT
|
DSBCAPS_GETCURRENTPOSITION2
;
bufdesc
.
dwBufferBytes
=
wfx
.
nAvgBytesPerSec
*
BUFFER_LEN
/
1000
;
...
...
@@ -432,20 +462,6 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
test_buffer
(
dso
,
dsbo
,
0
,
winetest_interactive
);
IDirectSoundBuffer_Release
(
dsbo
);
}
init_format
(
&
wfx
,
48000
,
16
,
2
);
bufdesc
.
dwSize
=
sizeof
(
bufdesc
);
bufdesc
.
dwFlags
=
DSBCAPS_CTRLDEFAULT
|
DSBCAPS_GETCURRENTPOSITION2
;
bufdesc
.
dwBufferBytes
=
wfx
.
nAvgBytesPerSec
*
BUFFER_LEN
/
1000
;
bufdesc
.
dwReserved
=
0
;
bufdesc
.
lpwfxFormat
=&
wfx
;
trace
(
" Testing a secondary buffer at %ldx%dx%d
\n
"
,
wfx
.
nSamplesPerSec
,
wfx
.
wBitsPerSample
,
wfx
.
nChannels
);
rc
=
IDirectSound_CreateSoundBuffer
(
dso
,
&
bufdesc
,
&
dsbo
,
NULL
);
ok
(
rc
==
DS_OK
,
"CreateSoundBuffer failed to create a secondary buffer 0x%lx
\n
"
,
rc
);
if
(
rc
==
DS_OK
)
{
test_buffer
(
dso
,
dsbo
,
0
,
winetest_interactive
);
IDirectSoundBuffer_Release
(
dsbo
);
}
EXIT:
...
...
@@ -628,6 +644,7 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
DSCBUFFERDESC
bufdesc
;
WAVEFORMATEX
wfx
;
DSCCAPS
dsccaps
;
int
f
;
/* Private dsound.dll: Error: Invalid interface buffer */
trace
(
"Testing %s - %s : %s
\n
"
,
lpcstrDescription
,
lpcstrModule
,
wine_dbgstr_guid
(
lpGuid
));
...
...
@@ -638,7 +655,7 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
rc
=
DirectSoundCaptureCreate
(
lpGuid
,
&
dsco
,
NULL
);
ok
((
rc
==
DS_OK
)
||
(
rc
==
DSERR_NODRIVER
),
"DirectSoundCaptureCreate failed: 0x%lx
\n
"
,
rc
);
if
(
(
rc
!=
DS_OK
)
&&
(
rc
!=
DSERR_NODRIVER
)
)
if
(
rc
!=
DS_OK
)
goto
EXIT
;
/* Private dsound.dll: Error: Invalid caps buffer */
...
...
@@ -716,7 +733,8 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
IDirectSoundCaptureBuffer_Release
(
dscbo
);
}
init_format
(
&
wfx
,
11025
,
8
,
1
);
for
(
f
=
0
;
f
<
NB_FORMATS
;
f
++
)
{
init_format
(
&
wfx
,
formats
[
f
][
0
],
formats
[
f
][
1
],
formats
[
f
][
2
]);
ZeroMemory
(
&
bufdesc
,
sizeof
(
bufdesc
));
bufdesc
.
dwSize
=
sizeof
(
bufdesc
);
bufdesc
.
dwFlags
=
0
;
...
...
@@ -731,40 +749,11 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
test_capture_buffer
(
dsco
,
dscbo
);
IDirectSoundCaptureBuffer_Release
(
dscbo
);
}
init_format
(
&
wfx
,
11025
,
8
,
1
);
ZeroMemory
(
&
bufdesc
,
sizeof
(
bufdesc
));
bufdesc
.
dwSize
=
sizeof
(
bufdesc
);
bufdesc
.
dwFlags
=
DSCBCAPS_WAVEMAPPED
;
bufdesc
.
dwBufferBytes
=
wfx
.
nAvgBytesPerSec
;
bufdesc
.
dwReserved
=
0
;
bufdesc
.
lpwfxFormat
=&
wfx
;
trace
(
" Testing the capture buffer at %ldx%dx%d
\n
"
,
wfx
.
nSamplesPerSec
,
wfx
.
wBitsPerSample
,
wfx
.
nChannels
);
rc
=
IDirectSoundCapture_CreateCaptureBuffer
(
dsco
,
&
bufdesc
,
&
dscbo
,
NULL
);
ok
(
rc
==
DS_OK
,
"CreateCaptureBuffer failed to create a capture buffer 0x%lx
\n
"
,
rc
);
if
(
rc
==
DS_OK
)
{
test_capture_buffer
(
dsco
,
dscbo
);
IDirectSoundCaptureBuffer_Release
(
dscbo
);
}
init_format
(
&
wfx
,
11025
,
16
,
2
);
ZeroMemory
(
&
bufdesc
,
sizeof
(
bufdesc
));
bufdesc
.
dwSize
=
sizeof
(
bufdesc
);
bufdesc
.
dwFlags
=
0
;
bufdesc
.
dwBufferBytes
=
wfx
.
nAvgBytesPerSec
;
bufdesc
.
dwReserved
=
0
;
bufdesc
.
lpwfxFormat
=&
wfx
;
trace
(
" Testing the capture buffer at %ldx%dx%d
\n
"
,
wfx
.
nSamplesPerSec
,
wfx
.
wBitsPerSample
,
wfx
.
nChannels
);
rc
=
IDirectSoundCapture_CreateCaptureBuffer
(
dsco
,
&
bufdesc
,
&
dscbo
,
NULL
);
ok
(
rc
==
DS_OK
,
"CreateCaptureBuffer failed to create a capture buffer 0x%lx
\n
"
,
rc
);
if
(
rc
==
DS_OK
)
{
test_capture_buffer
(
dsco
,
dscbo
);
IDirectSoundCaptureBuffer_Release
(
dscbo
);
}
init_format
(
&
wfx
,
11025
,
16
,
2
);
/* Try an invalid format to test error handling */
#if 0
init_format(&wfx,2000000,16,2);
ZeroMemory(&bufdesc, sizeof(bufdesc));
bufdesc.dwSize=sizeof(bufdesc);
bufdesc.dwFlags=DSCBCAPS_WAVEMAPPED;
...
...
@@ -774,27 +763,8 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
trace(" Testing the capture buffer at %ldx%dx%d\n",
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels);
rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL);
ok
(
rc
==
DS_OK
,
"CreateCaptureBuffer failed to create a capture buffer 0x%lx
\n
"
,
rc
);
if
(
rc
==
DS_OK
)
{
test_capture_buffer
(
dsco
,
dscbo
);
IDirectSoundCaptureBuffer_Release
(
dscbo
);
}
init_format
(
&
wfx
,
44100
,
16
,
1
);
ZeroMemory
(
&
bufdesc
,
sizeof
(
bufdesc
));
bufdesc
.
dwSize
=
sizeof
(
bufdesc
);
bufdesc
.
dwFlags
=
DSCBCAPS_WAVEMAPPED
;
bufdesc
.
dwBufferBytes
=
wfx
.
nAvgBytesPerSec
;
bufdesc
.
dwReserved
=
0
;
bufdesc
.
lpwfxFormat
=&
wfx
;
trace
(
" Testing the capture buffer at %ldx%dx%d
\n
"
,
wfx
.
nSamplesPerSec
,
wfx
.
wBitsPerSample
,
wfx
.
nChannels
);
rc
=
IDirectSoundCapture_CreateCaptureBuffer
(
dsco
,
&
bufdesc
,
&
dscbo
,
NULL
);
ok
(
rc
==
DS_OK
,
"CreateCaptureBuffer failed to create a capture buffer 0x%lx
\n
"
,
rc
);
if
(
rc
==
DS_OK
)
{
test_capture_buffer
(
dsco
,
dscbo
);
IDirectSoundCaptureBuffer_Release
(
dscbo
);
}
ok(rc!=DS_OK,"CreateCaptureBuffer should have failed at 2 MHz 0x%lx\n",rc);
#endif
EXIT:
if
(
dsco
!=
NULL
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment