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 @@
...
@@ -28,6 +28,34 @@
#include "initguid.h"
#include "initguid.h"
#include "dsound.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
/* The time slice determines how often we will service the buffer and the
* buffer will be four time slices long
* buffer will be four time slices long
*/
*/
...
@@ -371,6 +399,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
...
@@ -371,6 +399,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
DSBUFFERDESC
bufdesc
;
DSBUFFERDESC
bufdesc
;
WAVEFORMATEX
wfx
;
WAVEFORMATEX
wfx
;
DSCAPS
dscaps
;
DSCAPS
dscaps
;
int
f
;
trace
(
"Testing %s - %s : %s
\n
"
,
lpcstrDescription
,
lpcstrModule
,
wine_dbgstr_guid
(
lpGuid
));
trace
(
"Testing %s - %s : %s
\n
"
,
lpcstrDescription
,
lpcstrModule
,
wine_dbgstr_guid
(
lpGuid
));
rc
=
DirectSoundCreate
(
lpGuid
,
&
dso
,
NULL
);
rc
=
DirectSoundCreate
(
lpGuid
,
&
dso
,
NULL
);
...
@@ -418,7 +447,8 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
...
@@ -418,7 +447,8 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
goto
EXIT
;
goto
EXIT
;
/* Testing secondary buffers */
/* 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
.
dwSize
=
sizeof
(
bufdesc
);
bufdesc
.
dwFlags
=
DSBCAPS_CTRLDEFAULT
|
DSBCAPS_GETCURRENTPOSITION2
;
bufdesc
.
dwFlags
=
DSBCAPS_CTRLDEFAULT
|
DSBCAPS_GETCURRENTPOSITION2
;
bufdesc
.
dwBufferBytes
=
wfx
.
nAvgBytesPerSec
*
BUFFER_LEN
/
1000
;
bufdesc
.
dwBufferBytes
=
wfx
.
nAvgBytesPerSec
*
BUFFER_LEN
/
1000
;
...
@@ -432,20 +462,6 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
...
@@ -432,20 +462,6 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
test_buffer
(
dso
,
dsbo
,
0
,
winetest_interactive
);
test_buffer
(
dso
,
dsbo
,
0
,
winetest_interactive
);
IDirectSoundBuffer_Release
(
dsbo
);
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:
EXIT:
...
@@ -628,6 +644,7 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
...
@@ -628,6 +644,7 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
DSCBUFFERDESC
bufdesc
;
DSCBUFFERDESC
bufdesc
;
WAVEFORMATEX
wfx
;
WAVEFORMATEX
wfx
;
DSCCAPS
dsccaps
;
DSCCAPS
dsccaps
;
int
f
;
/* Private dsound.dll: Error: Invalid interface buffer */
/* Private dsound.dll: Error: Invalid interface buffer */
trace
(
"Testing %s - %s : %s
\n
"
,
lpcstrDescription
,
lpcstrModule
,
wine_dbgstr_guid
(
lpGuid
));
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,
...
@@ -638,7 +655,7 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
rc
=
DirectSoundCaptureCreate
(
lpGuid
,
&
dsco
,
NULL
);
rc
=
DirectSoundCaptureCreate
(
lpGuid
,
&
dsco
,
NULL
);
ok
((
rc
==
DS_OK
)
||
(
rc
==
DSERR_NODRIVER
),
"DirectSoundCaptureCreate failed: 0x%lx
\n
"
,
rc
);
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
;
goto
EXIT
;
/* Private dsound.dll: Error: Invalid caps buffer */
/* Private dsound.dll: Error: Invalid caps buffer */
...
@@ -716,7 +733,8 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
...
@@ -716,7 +733,8 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
IDirectSoundCaptureBuffer_Release
(
dscbo
);
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
));
ZeroMemory
(
&
bufdesc
,
sizeof
(
bufdesc
));
bufdesc
.
dwSize
=
sizeof
(
bufdesc
);
bufdesc
.
dwSize
=
sizeof
(
bufdesc
);
bufdesc
.
dwFlags
=
0
;
bufdesc
.
dwFlags
=
0
;
...
@@ -731,40 +749,11 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
...
@@ -731,40 +749,11 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
test_capture_buffer
(
dsco
,
dscbo
);
test_capture_buffer
(
dsco
,
dscbo
);
IDirectSoundCaptureBuffer_Release
(
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
);
/* Try an invalid format to test error handling */
ZeroMemory
(
&
bufdesc
,
sizeof
(
bufdesc
));
#if 0
bufdesc
.
dwSize
=
sizeof
(
bufdesc
);
init_format(&wfx,2000000,16,2);
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
);
ZeroMemory(&bufdesc, sizeof(bufdesc));
ZeroMemory(&bufdesc, sizeof(bufdesc));
bufdesc.dwSize=sizeof(bufdesc);
bufdesc.dwSize=sizeof(bufdesc);
bufdesc.dwFlags=DSCBCAPS_WAVEMAPPED;
bufdesc.dwFlags=DSCBCAPS_WAVEMAPPED;
...
@@ -774,27 +763,8 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
...
@@ -774,27 +763,8 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
trace(" Testing the capture buffer at %ldx%dx%d\n",
trace(" Testing the capture buffer at %ldx%dx%d\n",
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels);
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels);
rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL);
rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL);
ok
(
rc
==
DS_OK
,
"CreateCaptureBuffer failed to create a capture buffer 0x%lx
\n
"
,
rc
);
ok(rc!=DS_OK,"CreateCaptureBuffer should have failed at 2 MHz 0x%lx\n",rc);
if
(
rc
==
DS_OK
)
{
#endif
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
);
}
EXIT:
EXIT:
if
(
dsco
!=
NULL
)
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