Voice tweaks

This commit is contained in:
Sardelka
2022-08-15 16:13:53 +08:00
parent 0943a7992f
commit aa6c45b20d
4 changed files with 16 additions and 18 deletions
+5 -5
View File
@@ -196,16 +196,16 @@ namespace RageCoop.Client
}
if (Networking.IsOnServer)
{
if (Sync.Voice.WasInitialized())
if (Voice.WasInitialized())
{
if (Game.IsControlPressed(GTA.Control.PushToTalk))
{
Sync.Voice.StartRecording();
Voice.StartRecording();
return;
}
else if (Sync.Voice.IsRecording())
else if (Voice.IsRecording())
{
Sync.Voice.StopRecording();
Voice.StopRecording();
return;
}
}
@@ -280,7 +280,7 @@ namespace RageCoop.Client
public static void CleanUp()
{
MainChat.Clear();
Sync.Voice.ClearAll();
Voice.ClearAll();
EntityPool.Cleanup();
PlayerList.Cleanup();
LocalPlayerID=default;
+3 -3
View File
@@ -49,12 +49,12 @@ namespace RageCoop.Client.Menus
{
if (_disableVoice.Checked)
{
if (Networking.IsOnServer && !Sync.Voice.WasInitialized())
if (Networking.IsOnServer && !Voice.WasInitialized())
{
Sync.Voice.Init();
Voice.Init();
}
} else {
Sync.Voice.ClearAll();
Voice.ClearAll();
}
Main.Settings.Voice = _disableVoice.Checked;
+7 -9
View File
@@ -77,9 +77,9 @@ namespace RageCoop.Client
{
CoopMenu.ConnectedMenuSetting();
Main.MainChat.Init();
if (Main.Settings.Voice && !Sync.Voice.WasInitialized())
if (Main.Settings.Voice && !Voice.WasInitialized())
{
Sync.Voice.Init();
Voice.Init();
}
GTA.UI.Notification.Show("~g~Connected!");
});
@@ -270,14 +270,12 @@ namespace RageCoop.Client
Packets.Voice packet = new Packets.Voice();
packet.Deserialize(data);
Main.QueueAction(() =>
{
SyncedPed player = EntityPool.GetPedByID(packet.ID);
player.IsSpeaking = true;
player.LastSpeakingTime = Main.Ticked;
Sync.Voice.AddVoiceData(packet.Buffer, packet.Recorded);
});
SyncedPed player = EntityPool.GetPedByID(packet.ID);
player.IsSpeaking = true;
player.LastSpeakingTime = Main.Ticked;
Voice.AddVoiceData(packet.Buffer, packet.Recorded);
}
}
break;
+1 -1
View File
@@ -2,7 +2,7 @@
using NAudio.Wave;
namespace RageCoop.Client.Sync
namespace RageCoop.Client
{
internal static class Voice
{