Move our own state out of TeamspeakConnection: OwnClient, Recording
OwnClient owns the microphone and speakers and our flags (mute, deafen, away, commander, talk request, phonetic nickname, input hardware) and publishes them; Recording owns the recorder. ServerSession reads the flags from OwnClient instead of keeping its own copy, and they are now cleared when a connect starts rather than once it is done. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package eu.lixko.ts3j.client.ui;
|
||||
|
||||
import com.formdev.flatlaf.util.UIScale;
|
||||
import eu.lixko.ts3j.client.audio.VoiceOutput;
|
||||
import eu.lixko.ts3j.client.audio.AudioBackend;
|
||||
import eu.lixko.ts3j.client.audio.desktop.DesktopAudioBackend;
|
||||
import eu.lixko.ts3j.client.config.AppDirs;
|
||||
@@ -1033,8 +1034,8 @@ public final class MainFrame extends JFrame implements ServerTabPane.Listener {
|
||||
// Device and voice-gating changes apply to the capturing connection and the
|
||||
// playback of the visible one; the rest pick the new settings up on connect.
|
||||
SettingsDialog dlg = new SettingsDialog(this, settings, audio,
|
||||
sessions.microphoneOwner() == null ? null : sessions.microphoneOwner().connection().getMicrophone(),
|
||||
selected == null ? null : selected.connection().getPlayback(),
|
||||
sessions.microphoneOwner() == null ? null : sessions.microphoneOwner().connection().ownClient().microphone(),
|
||||
selected == null ? null : selected.connection().ownClient().playback(),
|
||||
sounds, hotkeys,
|
||||
new MyTeamSpeakPanel(myTeamSpeak, new TeamSpeakImporter(identities, bookmarks, settings, contacts),
|
||||
menuBar::rebuildBookmarks, this::myTeamSpeakChanged),
|
||||
@@ -1076,10 +1077,11 @@ public final class MainFrame extends JFrame implements ServerTabPane.Listener {
|
||||
private void applyOutputSettingsToAllTabs() {
|
||||
soundPlayer.setOutputDevice(settings.outputDevice);
|
||||
for (ServerTab tab : tabs) {
|
||||
if (tab.connection().getPlayback() == null) continue;
|
||||
tab.connection().getPlayback().setMasterVolume(settings.effectiveOutputVolume());
|
||||
tab.connection().getPlayback().setOutputDevice(settings.outputDevice);
|
||||
tab.connection().getPlayback().setReceiveBuffer(settings.receiveBuffer);
|
||||
VoiceOutput playback = tab.connection().ownClient().playback();
|
||||
if (playback == null) continue;
|
||||
playback.setMasterVolume(settings.effectiveOutputVolume());
|
||||
playback.setOutputDevice(settings.outputDevice);
|
||||
playback.setReceiveBuffer(settings.receiveBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package eu.lixko.ts3j.client.ui;
|
||||
|
||||
import eu.lixko.ts3j.client.audio.VoiceOutput;
|
||||
import eu.lixko.ts3j.client.contacts.ContactType;
|
||||
import eu.lixko.ts3j.client.net.ChannelNode;
|
||||
import eu.lixko.ts3j.client.net.Spacers;
|
||||
@@ -182,9 +183,8 @@ final class ServerTabTreeActions implements ServerTreePanel.Actions {
|
||||
|
||||
@Override
|
||||
public void toggleClientMute(ClientEntry client) {
|
||||
if (conn.getPlayback() == null) return;
|
||||
boolean now = !conn.getPlayback().isClientMuted(client.id);
|
||||
conn.getPlayback().setClientMuted(client.id, now);
|
||||
VoiceOutput playback = conn.ownClient().playback();
|
||||
if (playback != null) playback.setClientMuted(client.id, !playback.isClientMuted(client.id));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -358,7 +358,8 @@ final class ServerTabTreeActions implements ServerTreePanel.Actions {
|
||||
|
||||
@Override
|
||||
public boolean isClientLocallyMuted(int clientId) {
|
||||
return conn.getPlayback() != null && conn.getPlayback().isClientMuted(clientId);
|
||||
VoiceOutput playback = conn.ownClient().playback();
|
||||
return playback != null && playback.isClientMuted(clientId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user