2004-06-18 01:03:11 +02:00
|
|
|
/*
|
|
|
|
* Unit tests for dsound functions
|
|
|
|
*
|
|
|
|
* Copyright (c) 2004 Francois Gouget
|
|
|
|
*
|
|
|
|
* 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
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2004-06-18 01:03:11 +02:00
|
|
|
*/
|
|
|
|
|
2004-10-22 21:51:54 +02:00
|
|
|
static const unsigned int formats[][4]={
|
|
|
|
{ 8000, 8, 1, 0 },
|
|
|
|
{ 8000, 8, 2, 0 },
|
|
|
|
{ 8000, 16, 1, 0 },
|
|
|
|
{ 8000, 16, 2, 0 },
|
2007-11-05 23:23:28 +01:00
|
|
|
{ 8000, 24, 1, 0 },
|
|
|
|
{ 8000, 24, 2, 0 },
|
|
|
|
{ 8000, 32, 1, 0 },
|
|
|
|
{ 8000, 32, 2, 0 },
|
2004-10-22 21:51:54 +02:00
|
|
|
{11025, 8, 1, WAVE_FORMAT_1M08 },
|
|
|
|
{11025, 8, 2, WAVE_FORMAT_1S08 },
|
|
|
|
{11025, 16, 1, WAVE_FORMAT_1M16 },
|
|
|
|
{11025, 16, 2, WAVE_FORMAT_1S16 },
|
2007-11-05 23:23:28 +01:00
|
|
|
{11025, 24, 1, 0 },
|
|
|
|
{11025, 24, 2, 0 },
|
|
|
|
{11025, 32, 1, 0 },
|
|
|
|
{11025, 32, 2, 0 },
|
2004-10-22 21:51:54 +02:00
|
|
|
{22050, 8, 1, WAVE_FORMAT_2M08 },
|
|
|
|
{22050, 8, 2, WAVE_FORMAT_2S08 },
|
|
|
|
{22050, 16, 1, WAVE_FORMAT_2M16 },
|
|
|
|
{22050, 16, 2, WAVE_FORMAT_2S16 },
|
2007-11-05 23:23:28 +01:00
|
|
|
{22050, 24, 1, 0 },
|
|
|
|
{22050, 24, 2, 0 },
|
|
|
|
{22050, 32, 1, 0 },
|
|
|
|
{22050, 32, 2, 0 },
|
2004-10-22 21:51:54 +02:00
|
|
|
{44100, 8, 1, WAVE_FORMAT_4M08 },
|
|
|
|
{44100, 8, 2, WAVE_FORMAT_4S08 },
|
|
|
|
{44100, 16, 1, WAVE_FORMAT_4M16 },
|
|
|
|
{44100, 16, 2, WAVE_FORMAT_4S16 },
|
2007-11-05 23:23:28 +01:00
|
|
|
{44100, 24, 1, 0 },
|
|
|
|
{44100, 24, 2, 0 },
|
|
|
|
{44100, 32, 1, 0 },
|
|
|
|
{44100, 32, 2, 0 },
|
2004-10-22 21:51:54 +02:00
|
|
|
{48000, 8, 1, WAVE_FORMAT_48M08 },
|
|
|
|
{48000, 8, 2, WAVE_FORMAT_48S08 },
|
|
|
|
{48000, 16, 1, WAVE_FORMAT_48M16 },
|
|
|
|
{48000, 16, 2, WAVE_FORMAT_48S16 },
|
2007-11-05 23:23:28 +01:00
|
|
|
{48000, 24, 1, 0 },
|
|
|
|
{48000, 24, 2, 0 },
|
|
|
|
{48000, 32, 1, 0 },
|
|
|
|
{48000, 32, 2, 0 },
|
2004-10-22 21:51:54 +02:00
|
|
|
{96000, 8, 1, WAVE_FORMAT_96M08 },
|
|
|
|
{96000, 8, 2, WAVE_FORMAT_96S08 },
|
|
|
|
{96000, 16, 1, WAVE_FORMAT_96M16 },
|
2007-11-05 23:23:28 +01:00
|
|
|
{96000, 16, 2, WAVE_FORMAT_96S16 },
|
|
|
|
{96000, 24, 1, 0 },
|
|
|
|
{96000, 24, 2, 0 },
|
|
|
|
{96000, 32, 1, 0 },
|
|
|
|
{96000, 32, 2, 0 }
|
2004-06-18 01:03:11 +02:00
|
|
|
};
|
|
|
|
#define NB_FORMATS (sizeof(formats)/sizeof(*formats))
|
|
|
|
|
|
|
|
/* The time slice determines how often we will service the buffer */
|
2004-07-17 01:42:32 +02:00
|
|
|
#define TIME_SLICE 31
|
|
|
|
#define BUFFER_LEN 400
|
2004-06-18 01:03:11 +02:00
|
|
|
|
|
|
|
extern char* wave_generate_la(WAVEFORMATEX*,double,DWORD*);
|
2004-12-13 22:19:01 +01:00
|
|
|
extern HWND get_hwnd(void);
|
2004-06-18 01:03:11 +02:00
|
|
|
extern void init_format(WAVEFORMATEX*,int,int,int,int);
|
2006-01-06 12:16:41 +01:00
|
|
|
extern void test_buffer(LPDIRECTSOUND,LPDIRECTSOUNDBUFFER*,
|
2004-06-18 01:03:11 +02:00
|
|
|
BOOL,BOOL,LONG,BOOL,LONG,BOOL,double,BOOL,
|
2005-02-25 20:17:11 +01:00
|
|
|
LPDIRECTSOUND3DLISTENER,BOOL,BOOL,BOOL,DWORD);
|
2006-01-06 12:16:41 +01:00
|
|
|
extern void test_buffer8(LPDIRECTSOUND8,LPDIRECTSOUNDBUFFER*,
|
2004-07-30 20:42:51 +02:00
|
|
|
BOOL,BOOL,LONG,BOOL,LONG,BOOL,double,BOOL,
|
|
|
|
LPDIRECTSOUND3DLISTENER,BOOL,BOOL);
|
2004-08-25 04:09:00 +02:00
|
|
|
extern const char * getDSBCAPS(DWORD xmask);
|
2005-02-16 17:09:02 +01:00
|
|
|
extern int align(int length, int align);
|
2005-11-18 13:04:36 +01:00
|
|
|
extern const char * format_string(const WAVEFORMATEX* wfx);
|