Microphone changes

This commit is contained in:
Manevolent
2018-08-05 02:21:33 -04:00
parent 582daddf67
commit fffd19cf9b
2 changed files with 26 additions and 9 deletions
@@ -198,7 +198,7 @@ public class LocalTeamspeakClientSocket
waitForState(ClientConnectionState.CONNECTED, timeout);
microphoneThread = new HighPrecisionRecurrentTask(
1000,
20,
0.020F,
new MicrophoneTask()
);
@@ -328,11 +328,10 @@ public class LocalTeamspeakClientSocket
private class MicrophoneTask implements Runnable {
@Override
public void run() {
PacketBody0Voice voice = new PacketBody0Voice(getRole().getOut());
Microphone microphone;
if (!isConnected()) return;
Microphone microphone;
// Attempt to get the current microphone instance, saving it in a variable to prevent
// any race conditions by accessing the parent class' this.microphone.
if ((microphone = LocalTeamspeakClientSocket.this.microphone) == null)
@@ -342,6 +341,8 @@ public class LocalTeamspeakClientSocket
// TODO
// Set a state and send a muted event
} else if (microphone.isReady()) {
PacketBody0Voice voice = new PacketBody0Voice(getRole().getOut());
voice.setCodecType(microphone.getCodec());
voice.setCodecData(microphone.provide());