Skip to content
Permalink
Browse files

Allow unit-test to ignore sound input or output

  • Loading branch information
bear101 committed Feb 8, 2020
1 parent 2111752 commit e60805927b27c45e425ee643790c85eecb7d7a17
@@ -305,12 +305,11 @@ TEST_CASE( "MuxedAudioBlockUserEvent" )
REQUIRE(Login(txclient, ACE_TEXT("TxClient"), ACE_TEXT("guest"), ACE_TEXT("guest")));
REQUIRE(JoinRoot(txclient));

REQUIRE(InitSound(rxclient));
REQUIRE(InitSound(rxclient, DEFAULT, SOUNDDEVICEID_IGNORE, SOUNDDEVICEID_DEFAULT));
REQUIRE(Connect(rxclient, ACE_TEXT("127.0.0.1"), 10333, 10333));
REQUIRE(Login(rxclient, ACE_TEXT("RxClient"), ACE_TEXT("guest"), ACE_TEXT("guest")));
REQUIRE(JoinRoot(rxclient));


TTMessage msg;

REQUIRE(TT_EnableAudioBlockEvent(rxclient, TT_MUXED_USERID, STREAMTYPE_VOICE, TRUE));
@@ -27,33 +27,43 @@

#include <myace/MyACE.h>

bool InitSound(TTInstance* ttClient, SoundMode mode /*= DEFAULT*/, INT32 indev/* = -1*/, INT32 outdev/* = -1*/)
bool InitSound(TTInstance* ttClient, SoundMode mode /*= DEFAULT*/, INT32 indev, INT32 outdev)
{
int selindev = indev, seloutdev = outdev;
if (indev == -1 || outdev == -1)
if (indev == SOUNDDEVICEID_DEFAULT || outdev == SOUNDDEVICEID_DEFAULT)
{
if (!TT_GetDefaultSoundDevices(&indev, &outdev))
return false;
}

if (selindev == -1)
if (selindev == SOUNDDEVICEID_DEFAULT)
selindev = indev;
if (seloutdev == -1)
if (seloutdev == SOUNDDEVICEID_DEFAULT)
seloutdev = outdev;

switch (mode)
{
case DUPLEX :
if (selindev == SOUNDDEVICEID_IGNORE || seloutdev == SOUNDDEVICEID_IGNORE)
return false;

return TT_InitSoundDuplexDevices(ttClient, selindev, seloutdev);
case SHARED_INPUT :
if (selindev == SOUNDDEVICEID_IGNORE)
return false;

selindev |= TT_SOUNDDEVICE_SHARED_FLAG;
break;
case DEFAULT :
break;
}

TTBOOL success = TT_InitSoundInputDevice(ttClient, selindev);
success &= TT_InitSoundOutputDevice(ttClient, seloutdev);
TTBOOL success = true;
if (selindev != SOUNDDEVICEID_IGNORE)
success &= TT_InitSoundInputDevice(ttClient, selindev);
if (seloutdev != SOUNDDEVICEID_IGNORE)
success &= TT_InitSoundOutputDevice(ttClient, seloutdev);

return success;
}

@@ -30,14 +30,17 @@

#define DEFWAIT 5000

#define SOUNDDEVICEID_DEFAULT -1
#define SOUNDDEVICEID_IGNORE -2

enum SoundMode
{
DEFAULT,
DUPLEX,
SHARED_INPUT
};

bool InitSound(TTInstance* ttClient, SoundMode mode = DEFAULT, INT32 indev = -1, INT32 outdev = -1);
bool InitSound(TTInstance* ttClient, SoundMode mode = DEFAULT, INT32 indev = SOUNDDEVICEID_DEFAULT, INT32 outdev = SOUNDDEVICEID_DEFAULT);
bool Connect(TTInstance* ttClient, const TTCHAR hostname[TT_STRLEN], INT32 tcpport, INT32 udpport);
bool Login(TTInstance* ttClient, const TTCHAR nickname[TT_STRLEN], const TTCHAR username[TT_STRLEN], const TTCHAR passwd[TT_STRLEN]);
bool JoinRoot(TTInstance* ttClient);

0 comments on commit e608059

Please sign in to comment.
You can’t perform that action at this time.