Commit c28d6192 authored by Frédéric Delanoy's avatar Frédéric Delanoy Committed by Alexandre Julliard

dsound/tests: Use BOOL type where appropriate.

parent 17875091
......@@ -279,7 +279,7 @@ typedef struct {
DWORD last_pos;
} capture_state_t;
static int capture_buffer_service(capture_state_t* state)
static BOOL capture_buffer_service(capture_state_t* state)
{
HRESULT rc;
LPVOID ptr1,ptr2;
......@@ -290,22 +290,22 @@ static int capture_buffer_service(capture_state_t* state)
&read_pos);
ok(rc==DS_OK,"IDirectSoundCaptureBuffer_GetCurrentPosition() failed: %08x\n", rc);
if (rc!=DS_OK)
return 0;
return FALSE;
rc=IDirectSoundCaptureBuffer_Lock(state->dscbo,state->offset,state->size,
&ptr1,&len1,&ptr2,&len2,0);
ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Lock() failed: %08x\n", rc);
if (rc!=DS_OK)
return 0;
return FALSE;
rc=IDirectSoundCaptureBuffer_Unlock(state->dscbo,ptr1,len1,ptr2,len2);
ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Unlock() failed: %08x\n", rc);
if (rc!=DS_OK)
return 0;
return FALSE;
state->offset = (state->offset + state->size) % state->buffer_size;
return 1;
return TRUE;
}
static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco,
......
......@@ -252,7 +252,7 @@ static int buffer_silence(play_state_t* state, DWORD size)
return size;
}
static int buffer_service(play_state_t* state)
static BOOL buffer_service(play_state_t* state)
{
DWORD last_play_pos,play_pos,buf_free;
HRESULT rc;
......@@ -291,7 +291,7 @@ static int buffer_service(play_state_t* state)
trace("offset=%d free=%d written=%d / %d\n",
state->offset,buf_free,state->written,state->wave_len);
if (buf_free==0)
return 1;
return TRUE;
if (state->written<state->wave_len)
{
......@@ -311,14 +311,14 @@ static int buffer_service(play_state_t* state)
if (buffer_silence(state,buf_free)==-1)
goto STOP;
}
return 1;
return TRUE;
STOP:
if (winetest_debug > 1)
trace("stopping playback\n");
rc=IDirectSoundBuffer_Stop(state->dsbo);
ok(rc==DS_OK,"IDirectSoundBuffer_Stop() failed: %08x\n", rc);
return 0;
return FALSE;
}
void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo,
......@@ -1272,13 +1272,13 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
rc = test_for_driver(lpGuid);
if (rc == DSERR_NODRIVER) {
trace(" No Driver\n");
return 1;
return TRUE;
} else if (rc == DSERR_ALLOCATED) {
trace(" Already In Use\n");
return 1;
return TRUE;
} else if (rc == E_FAIL) {
trace(" No Device\n");
return 1;
return TRUE;
}
trace(" Testing the primary buffer\n");
......@@ -1306,7 +1306,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
test_secondary(lpGuid,winetest_interactive,1,1,1,0,0,1);
test_secondary(lpGuid,winetest_interactive,1,1,1,0,1,1);
return 1;
return TRUE;
}
static void ds3d_tests(void)
......
......@@ -104,7 +104,7 @@ static int buffer_silence8(play_state_t* state, DWORD size)
return size;
}
static int buffer_service8(play_state_t* state)
static BOOL buffer_service8(play_state_t* state)
{
DWORD last_play_pos,play_pos,buf_free;
HRESULT rc;
......@@ -143,7 +143,7 @@ static int buffer_service8(play_state_t* state)
trace("offset=%d free=%d written=%d / %d\n",
state->offset,buf_free,state->written,state->wave_len);
if (buf_free==0)
return 1;
return TRUE;
if (state->written<state->wave_len)
{
......@@ -163,14 +163,14 @@ static int buffer_service8(play_state_t* state)
if (buffer_silence8(state,buf_free)==-1)
goto STOP;
}
return 1;
return TRUE;
STOP:
if (winetest_debug > 1)
trace("stopping playback\n");
rc=IDirectSoundBuffer_Stop(state->dsbo);
ok(rc==DS_OK,"IDirectSoundBuffer_Stop() failed: %08x\n", rc);
return 0;
return FALSE;
}
void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
......@@ -541,10 +541,10 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
}
}
static HRESULT test_secondary8(LPGUID lpGuid, int play,
int has_3d, int has_3dbuffer,
int has_listener, int has_duplicate,
int move_listener, int move_sound)
static HRESULT test_secondary8(LPGUID lpGuid, BOOL play,
BOOL has_3d, BOOL has_3dbuffer,
BOOL has_listener, BOOL has_duplicate,
BOOL move_listener, BOOL move_sound)
{
HRESULT rc;
LPDIRECTSOUND8 dso=NULL;
......@@ -766,7 +766,7 @@ static HRESULT test_secondary8(LPGUID lpGuid, int play,
if (rc==DS_OK && secondary!=NULL) {
double duration;
duration=(move_listener || move_sound?4.0:1.0);
test_buffer8(dso,&secondary,0,FALSE,0,FALSE,0,
test_buffer8(dso,&secondary,FALSE,FALSE,0,FALSE,0,
winetest_interactive,duration,has_3dbuffer,
listener,move_listener,move_sound);
ref=IDirectSoundBuffer_Release(secondary);
......@@ -875,25 +875,25 @@ static HRESULT test_primary8(LPGUID lpGuid)
if (rc == DSERR_CONTROLUNAVAIL)
trace(" No Primary\n");
else if (rc==DS_OK && primary!=NULL) {
test_buffer8(dso,&primary,1,TRUE,0,TRUE,0,winetest_interactive &&
!(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,NULL,0,0);
test_buffer8(dso,&primary,TRUE,TRUE,0,TRUE,0,
winetest_interactive && !(dscaps.dwFlags & DSCAPS_EMULDRIVER),
1.0,FALSE,NULL,FALSE,FALSE);
if (winetest_interactive) {
LONG volume,pan;
volume = DSBVOLUME_MAX;
for (i = 0; i < 6; i++) {
test_buffer8(dso,&primary,1,TRUE,volume,TRUE,0,
winetest_interactive &&
!(dscaps.dwFlags & DSCAPS_EMULDRIVER),
1.0,0,NULL,0,0);
test_buffer8(dso,&primary,TRUE,TRUE,volume,TRUE,0,
winetest_interactive && !(dscaps.dwFlags & DSCAPS_EMULDRIVER),
1.0,FALSE,NULL,FALSE,FALSE);
volume -= ((DSBVOLUME_MAX-DSBVOLUME_MIN) / 40);
}
pan = DSBPAN_LEFT;
for (i = 0; i < 7; i++) {
test_buffer8(dso,&primary,1,TRUE,0,TRUE,pan,
winetest_interactive &&
!(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,0,0,0);
test_buffer8(dso,&primary,TRUE,TRUE,0,TRUE,pan,
winetest_interactive && !(dscaps.dwFlags & DSCAPS_EMULDRIVER),
1.0,FALSE,NULL,FALSE,FALSE);
pan += ((DSBPAN_RIGHT-DSBPAN_LEFT) / 6);
}
}
......@@ -965,9 +965,9 @@ static HRESULT test_primary_3d8(LPGUID lpGuid)
ok(rc==DS_OK && primary!=NULL,"IDirectSound8_CreateSoundBuffer() "
"failed to create a 3D primary buffer: %08x\n",rc);
if (rc==DS_OK && primary!=NULL) {
test_buffer8(dso,&primary,1,FALSE,0,FALSE,0,
winetest_interactive &&
!(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,0,0,0);
test_buffer8(dso,&primary,TRUE,FALSE,0,FALSE,0,
winetest_interactive && !(dscaps.dwFlags & DSCAPS_EMULDRIVER),
1.0,FALSE,NULL,FALSE,FALSE);
ref=IDirectSoundBuffer_Release(primary);
ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
"should have 0\n",ref);
......@@ -1056,10 +1056,9 @@ static HRESULT test_primary_3d_with_listener8(LPGUID lpGuid)
"should have 1\n",ref);
/* Testing the buffer */
test_buffer8(dso,&primary,1,FALSE,0,FALSE,0,
winetest_interactive &&
!(dscaps.dwFlags & DSCAPS_EMULDRIVER),
1.0,0,listener,0,0);
test_buffer8(dso,&primary,TRUE,FALSE,0,FALSE,0,
winetest_interactive && !(dscaps.dwFlags & DSCAPS_EMULDRIVER),
1.0,FALSE,listener,FALSE,FALSE);
}
/* Testing the reference counting */
......@@ -1095,13 +1094,13 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
rc = test_for_driver8(lpGuid);
if (rc == DSERR_NODRIVER) {
trace(" No Driver\n");
return 1;
return TRUE;
} else if (rc == DSERR_ALLOCATED) {
trace(" Already In Use\n");
return 1;
return TRUE;
} else if (rc == E_FAIL) {
trace(" No Device\n");
return 1;
return TRUE;
}
trace(" Testing the primary buffer\n");
......@@ -1114,22 +1113,22 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
test_primary_3d_with_listener8(lpGuid);
/* Testing secondary buffers */
test_secondary8(lpGuid,winetest_interactive,0,0,0,0,0,0);
test_secondary8(lpGuid,winetest_interactive,0,0,0,1,0,0);
test_secondary8(lpGuid,winetest_interactive,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE);
test_secondary8(lpGuid,winetest_interactive,FALSE,FALSE,FALSE,TRUE, FALSE,FALSE);
/* Testing 3D secondary buffers */
test_secondary8(lpGuid,winetest_interactive,1,0,0,0,0,0);
test_secondary8(lpGuid,winetest_interactive,1,1,0,0,0,0);
test_secondary8(lpGuid,winetest_interactive,1,1,0,1,0,0);
test_secondary8(lpGuid,winetest_interactive,1,0,1,0,0,0);
test_secondary8(lpGuid,winetest_interactive,1,0,1,1,0,0);
test_secondary8(lpGuid,winetest_interactive,1,1,1,0,0,0);
test_secondary8(lpGuid,winetest_interactive,1,1,1,1,0,0);
test_secondary8(lpGuid,winetest_interactive,1,1,1,0,1,0);
test_secondary8(lpGuid,winetest_interactive,1,1,1,0,0,1);
test_secondary8(lpGuid,winetest_interactive,1,1,1,0,1,1);
return 1;
test_secondary8(lpGuid,winetest_interactive,TRUE, FALSE,FALSE,FALSE,FALSE,FALSE);
test_secondary8(lpGuid,winetest_interactive,TRUE, TRUE, FALSE,FALSE,FALSE,FALSE);
test_secondary8(lpGuid,winetest_interactive,TRUE, TRUE, FALSE,TRUE, FALSE,FALSE);
test_secondary8(lpGuid,winetest_interactive,TRUE, FALSE,TRUE, FALSE,FALSE,FALSE);
test_secondary8(lpGuid,winetest_interactive,TRUE, FALSE,TRUE, TRUE, FALSE,FALSE);
test_secondary8(lpGuid,winetest_interactive,TRUE, TRUE, TRUE, FALSE,FALSE,FALSE);
test_secondary8(lpGuid,winetest_interactive,TRUE, TRUE, TRUE, TRUE, FALSE,FALSE);
test_secondary8(lpGuid,winetest_interactive,TRUE, TRUE, TRUE, FALSE,TRUE, FALSE);
test_secondary8(lpGuid,winetest_interactive,TRUE, TRUE, TRUE, FALSE,FALSE,TRUE );
test_secondary8(lpGuid,winetest_interactive,TRUE, TRUE, TRUE, FALSE,TRUE, TRUE );
return TRUE;
}
static void ds3d8_tests(void)
......
......@@ -1498,7 +1498,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
if (!number++)
{
ok (!lpcstrModule[0], "lpcstrModule(%s) != NULL\n", lpcstrModule);
return 1;
return TRUE;
}
rc = test_dsound(lpGuid);
......@@ -1518,7 +1518,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
test_invalid_fmts(lpGuid);
}
return 1;
return TRUE;
}
static void dsound_tests(void)
......
......@@ -510,8 +510,9 @@ static HRESULT test_primary8(LPGUID lpGuid)
trace("All subsequent tones should be identical to this one.\n");
trace("Listen for stutter, changes in pitch, volume, etc.\n");
}
test_buffer8(dso,&primary,1,FALSE,0,FALSE,0,winetest_interactive &&
!(dscaps.dwFlags & DSCAPS_EMULDRIVER),5.0,0,0,0,0);
test_buffer8(dso,&primary,TRUE,FALSE,0,FALSE,0,
winetest_interactive && !(dscaps.dwFlags & DSCAPS_EMULDRIVER),
5.0,FALSE,NULL,FALSE,FALSE);
ref=IDirectSoundBuffer_Release(primary);
ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
......@@ -648,8 +649,8 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
"buffer %08x\n",rc);
if (rc==DS_OK && secondary!=NULL) {
test_buffer8(dso,&secondary,0,FALSE,0,FALSE,0,
winetest_interactive,1.0,0,NULL,0,0);
test_buffer8(dso,&secondary,FALSE,FALSE,0,FALSE,0,
winetest_interactive,1.0,FALSE,NULL,FALSE,FALSE);
ref=IDirectSoundBuffer_Release(secondary);
ok(ref==0,"IDirectSoundBuffer_Release() has %d references, "
......@@ -882,8 +883,8 @@ static HRESULT test_secondary8(LPGUID lpGuid)
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels,format_tags[tag],
wfx1.nSamplesPerSec,wfx1.wBitsPerSample,wfx1.nChannels);
}
test_buffer8(dso,&secondary,0,FALSE,0,FALSE,0,
winetest_interactive,1.0,0,NULL,0,0);
test_buffer8(dso,&secondary,FALSE,FALSE,0,FALSE,0,
winetest_interactive,1.0,FALSE,NULL,FALSE,FALSE);
ref=IDirectSoundBuffer_Release(secondary);
ok(ref==0,"IDirectSoundBuffer_Release() has %d references, "
......@@ -929,7 +930,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
test_secondary8(lpGuid);
}
return 1;
return TRUE;
}
static void dsound8_tests(void)
......
......@@ -706,7 +706,7 @@ EXIT:
ok(ref==0,"IDirectSound_Release() has %d references, should have 0\n",
ref);
}
return 1;
return TRUE;
}
static void propset_buffer_tests(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment