Microphone changes

This commit is contained in:
Manevolent
2018-08-05 01:24:10 -04:00
parent 836a952a6d
commit 68dcaa35c3
2 changed files with 23 additions and 21 deletions
@@ -330,16 +330,19 @@ public class LocalTeamspeakClientSocket
public void run() { public void run() {
PacketBody0Voice voice = new PacketBody0Voice(getRole().getOut()); PacketBody0Voice voice = new PacketBody0Voice(getRole().getOut());
Microphone microphone; Microphone microphone;
while (isConnected()) {
if (!isConnected()) return;
// Attempt to get the current microphone instance, saving it in a variable to prevent // Attempt to get the current microphone instance, saving it in a variable to prevent
// any race conditions by accessing the parent class' this.microphone. // any race conditions by accessing the parent class' this.microphone.
if ((microphone = LocalTeamspeakClientSocket.this.microphone) == null) if ((microphone = LocalTeamspeakClientSocket.this.microphone) == null)
continue; return;
if (microphone.isMuted()) { if (microphone.isMuted()) {
// TODO // TODO
// Set a state and send a muted event // Set a state and send a muted event
} else if (microphone.isReady()) { } else if (microphone.isReady()) {
voice.setClientId(getClientId()); // not necessary probably
voice.setCodecType(microphone.getCodec()); voice.setCodecType(microphone.getCodec());
voice.setCodecData(microphone.provide()); voice.setCodecData(microphone.provide());
@@ -349,8 +352,7 @@ public class LocalTeamspeakClientSocket
// All we are really concerned about here is a disconnection event, in which case the loop // All we are really concerned about here is a disconnection event, in which case the loop
// will exit. // will exit.
} catch (TimeoutException e) { } catch (TimeoutException e) {
// Not really possible, as we might expect, voice doesn't have ACKs. // Not really possible; as we might expect, voice doesn't have ACKs.
}
} }
} }
} }
@@ -38,7 +38,7 @@ public class ServerConnectionTest {
10000L 10000L
); );
client.sendServerMessage("\u26D4"); client.sendServerMessage("\u26D4 You are not listening to this channel.");
assertEquals(client.getState(), ClientConnectionState.CONNECTED); assertEquals(client.getState(), ClientConnectionState.CONNECTED);