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