1c2c66affSColin Finck /*
2c2c66affSColin Finck  * Unit tests for dsound functions
3c2c66affSColin Finck  *
4c2c66affSColin Finck  * Copyright (c) 2004 Francois Gouget
5c2c66affSColin Finck  *
6c2c66affSColin Finck  * This library is free software; you can redistribute it and/or
7c2c66affSColin Finck  * modify it under the terms of the GNU Lesser General Public
8c2c66affSColin Finck  * License as published by the Free Software Foundation; either
9c2c66affSColin Finck  * version 2.1 of the License, or (at your option) any later version.
10c2c66affSColin Finck  *
11c2c66affSColin Finck  * This library is distributed in the hope that it will be useful,
12c2c66affSColin Finck  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13c2c66affSColin Finck  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14c2c66affSColin Finck  * Lesser General Public License for more details.
15c2c66affSColin Finck  *
16c2c66affSColin Finck  * You should have received a copy of the GNU Lesser General Public
17c2c66affSColin Finck  * License along with this library; if not, write to the Free Software
18c2c66affSColin Finck  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19c2c66affSColin Finck  */
20c2c66affSColin Finck 
21*ffd96172SAmine Khaldi #ifndef _DSOUND_TEST_H_
22*ffd96172SAmine Khaldi #define _DSOUND_TEST_H_
23*ffd96172SAmine Khaldi 
24*ffd96172SAmine Khaldi #include <math.h>
25*ffd96172SAmine Khaldi 
26*ffd96172SAmine Khaldi #define WIN32_NO_STATUS
27*ffd96172SAmine Khaldi #define _INC_WINDOWS
28*ffd96172SAmine Khaldi #define COM_NO_WINDOWS_H
29*ffd96172SAmine Khaldi #define COBJMACROS
30*ffd96172SAmine Khaldi 
31*ffd96172SAmine Khaldi #include <wine/test.h>
32*ffd96172SAmine Khaldi 
33c2c66affSColin Finck #include <wingdi.h>
34c2c66affSColin Finck #include <mmreg.h>
35c2c66affSColin Finck #include <mmsystem.h>
36*ffd96172SAmine Khaldi #include <dsound.h>
37*ffd96172SAmine Khaldi #include <dsconf.h>
38*ffd96172SAmine Khaldi #include <ks.h>
39*ffd96172SAmine Khaldi #include <ksmedia.h>
40c2c66affSColin Finck 
41c2c66affSColin Finck static const unsigned int formats[][4]={
42c2c66affSColin Finck     { 8000,  8, 1, 0 },
43c2c66affSColin Finck     { 8000,  8, 2, 0 },
44c2c66affSColin Finck     { 8000, 16, 1, 0 },
45c2c66affSColin Finck     { 8000, 16, 2, 0 },
46c2c66affSColin Finck     { 8000, 24, 1, 0 },
47c2c66affSColin Finck     { 8000, 24, 2, 0 },
48c2c66affSColin Finck     { 8000, 32, 1, 0 },
49c2c66affSColin Finck     { 8000, 32, 2, 0 },
50c2c66affSColin Finck     {11025,  8, 1, WAVE_FORMAT_1M08 },
51c2c66affSColin Finck     {11025,  8, 2, WAVE_FORMAT_1S08 },
52c2c66affSColin Finck     {11025, 16, 1, WAVE_FORMAT_1M16 },
53c2c66affSColin Finck     {11025, 16, 2, WAVE_FORMAT_1S16 },
54c2c66affSColin Finck     {11025, 24, 1, 0 },
55c2c66affSColin Finck     {11025, 24, 2, 0 },
56c2c66affSColin Finck     {11025, 32, 1, 0 },
57c2c66affSColin Finck     {11025, 32, 2, 0 },
58c2c66affSColin Finck     {22050,  8, 1, WAVE_FORMAT_2M08 },
59c2c66affSColin Finck     {22050,  8, 2, WAVE_FORMAT_2S08 },
60c2c66affSColin Finck     {22050, 16, 1, WAVE_FORMAT_2M16 },
61c2c66affSColin Finck     {22050, 16, 2, WAVE_FORMAT_2S16 },
62c2c66affSColin Finck     {22050, 24, 1, 0 },
63c2c66affSColin Finck     {22050, 24, 2, 0 },
64c2c66affSColin Finck     {22050, 32, 1, 0 },
65c2c66affSColin Finck     {22050, 32, 2, 0 },
66c2c66affSColin Finck     {44100,  8, 1, WAVE_FORMAT_4M08 },
67c2c66affSColin Finck     {44100,  8, 2, WAVE_FORMAT_4S08 },
68c2c66affSColin Finck     {44100, 16, 1, WAVE_FORMAT_4M16 },
69c2c66affSColin Finck     {44100, 16, 2, WAVE_FORMAT_4S16 },
70c2c66affSColin Finck     {44100, 24, 1, 0 },
71c2c66affSColin Finck     {44100, 24, 2, 0 },
72c2c66affSColin Finck     {44100, 32, 1, 0 },
73c2c66affSColin Finck     {44100, 32, 2, 0 },
74c2c66affSColin Finck     {48000,  8, 1, WAVE_FORMAT_48M08 },
75c2c66affSColin Finck     {48000,  8, 2, WAVE_FORMAT_48S08 },
76c2c66affSColin Finck     {48000, 16, 1, WAVE_FORMAT_48M16 },
77c2c66affSColin Finck     {48000, 16, 2, WAVE_FORMAT_48S16 },
78c2c66affSColin Finck     {48000, 24, 1, 0 },
79c2c66affSColin Finck     {48000, 24, 2, 0 },
80c2c66affSColin Finck     {48000, 32, 1, 0 },
81c2c66affSColin Finck     {48000, 32, 2, 0 },
82c2c66affSColin Finck     {96000,  8, 1, WAVE_FORMAT_96M08 },
83c2c66affSColin Finck     {96000,  8, 2, WAVE_FORMAT_96S08 },
84c2c66affSColin Finck     {96000, 16, 1, WAVE_FORMAT_96M16 },
85c2c66affSColin Finck     {96000, 16, 2, WAVE_FORMAT_96S16 },
86c2c66affSColin Finck     {96000, 24, 1, 0 },
87c2c66affSColin Finck     {96000, 24, 2, 0 },
88c2c66affSColin Finck     {96000, 32, 1, 0 },
89c2c66affSColin Finck     {96000, 32, 2, 0 }
90c2c66affSColin Finck };
91c2c66affSColin Finck #define NB_FORMATS (sizeof(formats)/sizeof(*formats))
92c2c66affSColin Finck 
93c2c66affSColin Finck static const unsigned int format_tags[] = {WAVE_FORMAT_PCM, WAVE_FORMAT_IEEE_FLOAT};
94c2c66affSColin Finck #define NB_TAGS (sizeof(format_tags)/sizeof(*format_tags))
95c2c66affSColin Finck 
96c2c66affSColin Finck /* The time slice determines how often we will service the buffer */
97c2c66affSColin Finck #define TIME_SLICE     31
98c2c66affSColin Finck #define BUFFER_LEN    400
99c2c66affSColin Finck 
100c2c66affSColin Finck extern char* wave_generate_la(WAVEFORMATEX*,double,DWORD*,BOOL);
101c2c66affSColin Finck extern HWND get_hwnd(void);
102c2c66affSColin Finck extern void init_format(WAVEFORMATEX*,int,int,int,int);
103c2c66affSColin Finck extern void test_buffer(LPDIRECTSOUND,LPDIRECTSOUNDBUFFER*,
104c2c66affSColin Finck                         BOOL,BOOL,LONG,BOOL,LONG,BOOL,double,BOOL,
105c2c66affSColin Finck                         LPDIRECTSOUND3DLISTENER,BOOL,BOOL,BOOL,DWORD);
106c2c66affSColin Finck extern void test_buffer8(LPDIRECTSOUND8,LPDIRECTSOUNDBUFFER*,
107c2c66affSColin Finck                          BOOL,BOOL,LONG,BOOL,LONG,BOOL,double,BOOL,
108c2c66affSColin Finck                          LPDIRECTSOUND3DLISTENER,BOOL,BOOL);
109c2c66affSColin Finck extern const char * getDSBCAPS(DWORD xmask);
110c2c66affSColin Finck extern int align(int length, int align);
111c2c66affSColin Finck extern const char * format_string(const WAVEFORMATEX* wfx);
112*ffd96172SAmine Khaldi 
113*ffd96172SAmine Khaldi #endif /* !_DSOUND_TEST_H_ */
114