Permalink
Browse files

Allow use of device #1978

  • Loading branch information...
1 parent 8f50ba2 commit 7ec713b2e75bab9bfc02406d8d06045c8c4e6bc3 @bear101 bear101 committed Feb 15, 2017
@@ -15,9 +15,9 @@ protected void setUp() throws Exception {
PROEDITION = true;
- // IPADDR = "127.0.0.1";
- // TCPPORT = 12000;
- // UDPPORT = 12000;
+ IPADDR = "127.0.0.1";
+ TCPPORT = 12456;
+ UDPPORT = 12456;
UserAccount useraccount = new UserAccount();
useraccount.szUsername = ADMIN_USERNAME;
@@ -831,43 +831,43 @@ public TeamTalkSrv newServerInstance(String systemid) {
return server;
}
+ static class RunServer implements ServerInterleave {
+ TeamTalkSrv server;
+
+ public RunServer(TeamTalkSrv server) {
+ this.server = server;
+ }
+
+ public void interleave() {
+ while(server.runEventLoop(100));
+ }
+ }
+
protected static void connect(TeamTalkSrv server, TeamTalkBase ttclient)
{
connect(server, ttclient, SYSTEMID);
}
- protected static void connect(final TeamTalkSrv server, TeamTalkBase ttclient, String systemID)
+ protected static void connect(TeamTalkSrv server, TeamTalkBase ttclient, String systemID)
{
- connect(ttclient, SYSTEMID, new ServerInterleave() {
- public void interleave() {
- while(server.runEventLoop(0));
- }
- });
+ connect(ttclient, SYSTEMID, new RunServer(server));
}
protected static void login(TeamTalkSrv server, TeamTalkBase ttclient,
String nick, String username, String passwd) {
login(server, ttclient, nick, username, passwd, "");
}
- protected static void login(final TeamTalkSrv server, TeamTalkBase ttclient,
+ protected static void login(TeamTalkSrv server, TeamTalkBase ttclient,
String nick, String username, String passwd,
String clientname)
{
- login(ttclient, nick, username, passwd, clientname, new ServerInterleave() {
- public void interleave() {
- while(server.runEventLoop(100));
- }
- });
+ login(ttclient, nick, username, passwd, clientname, new RunServer(server));
}
- protected static void joinRoot(final TeamTalkSrv server, TeamTalkBase ttclient)
+ protected static void joinRoot(TeamTalkSrv server, TeamTalkBase ttclient)
{
- joinRoot(ttclient, new ServerInterleave() {
- public void interleave() {
- while(server.runEventLoop(0));
- }
- });
+ joinRoot(ttclient, new RunServer(server));
}
}
@@ -1224,8 +1224,14 @@ public void test_21_RecordPlayback() throws IOException {
connect(ttclient);
IntPtr indev = new IntPtr(), outdev = new IntPtr();
- assertTrue("get default sound devices", ttclient.getDefaultSoundDevices(indev, outdev));
-
+ if(INPUTDEVICEID>=0)
+ indev.value = INPUTDEVICEID;
+ else
+ assertTrue("get default sound devices", ttclient.getDefaultSoundDevices(indev, outdev));
+
+ if(OUTPUTDEVICEID>=0)
+ outdev.value = OUTPUTDEVICEID;
+
assertTrue("init input dev (we skip output device for now)", ttclient.initSoundInputDevice(indev.value));
login(ttclient, NICKNAME, USERNAME, PASSWORD);
@@ -1469,7 +1475,12 @@ public void test_25_SoundLoopback() {
ttclient = newClientInstance();
IntPtr in = new IntPtr(), out = new IntPtr();
- assertTrue("Get default sound devices", TeamTalkBase.getDefaultSoundDevices(in, out));
+ if(INPUTDEVICEID<0 || OUTPUTDEVICEID<0)
+ assertTrue("Get default sound devices", TeamTalkBase.getDefaultSoundDevices(in, out));
+ else {
+ in.value = INPUTDEVICEID;
+ out.value = OUTPUTDEVICEID;
+ }
SoundDevice nodev = null;
Vector<SoundDevice> devs = new Vector<SoundDevice>();
@@ -17,6 +17,9 @@
public static String SYSTEMID = "teamtalk";
+ public static int INPUTDEVICEID = -1, OUTPUTDEVICEID = -1;
+
+
public static final String CRYPTO_CERT_FILE = "ttservercert.pem", CRYPTO_KEY_FILE = "ttserverkey.pem";
public static final String UPLOADFILE = "filename.txt";
public static final String DOWNLOADFILE = "filename.txt";
@@ -30,6 +33,8 @@
protected void setUp() throws Exception {
super.setUp();
+
+ // this.INPUTDEVICEID = this.OUTPUTDEVICEID = SoundDeviceConstants.TT_SOUNDDEVICE_ID_TEAMTALK_VIRTUAL;
}
protected void tearDown() throws Exception {
@@ -55,17 +60,22 @@ protected void initSound(TeamTalkBase ttclient) {
}
protected void initSound(TeamTalkBase ttclient, boolean duplex) {
- IntPtr howmany = new IntPtr(0);
-
+
Vector<SoundDevice> devs = new Vector<SoundDevice>();
assertTrue("get sound devs", ttclient.getSoundDevices(devs));
System.out.println("---- Sound Devices ----");
for(int i=0;i<devs.size();i++)
printSoundDevice(devs.get(i));
IntPtr indev = new IntPtr(), outdev = new IntPtr();
- assertTrue("get default devs", ttclient.getDefaultSoundDevices(indev, outdev));
-
+ if(INPUTDEVICEID < 0 && OUTPUTDEVICEID < 0)
+ assertTrue("get default devs", ttclient.getDefaultSoundDevices(indev, outdev));
+
+ if(INPUTDEVICEID >= 0)
+ indev.value = INPUTDEVICEID;
+ if(OUTPUTDEVICEID >= 0)
+ outdev.value = OUTPUTDEVICEID;
+
if(duplex) {
assertTrue("init duplex devs", ttclient.initSoundDuplexDevices(indev.value, outdev.value));
}

0 comments on commit 7ec713b

Please sign in to comment.