From add00ef7ed97f723b413702340a79e3d40edf372 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi?= <50182658+M1000fr@users.noreply.github.com> Date: Mon, 1 Jan 2024 01:41:27 +0100 Subject: [PATCH] Init --- voicemeeter.ps1 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 voicemeeter.ps1 diff --git a/voicemeeter.ps1 b/voicemeeter.ps1 new file mode 100644 index 0000000..b81accf --- /dev/null +++ b/voicemeeter.ps1 @@ -0,0 +1,27 @@ +# Obtient le processus audiodg +$audiodgProcess = Get-Process -Name audiodg -ErrorAction SilentlyContinue + +# Obtient le processus voicemeeter, il n'est pas exactement "voicemeeter" mais il doit contenir "voicemeeter" +$voicemeeterProcess = Get-Process | Where-Object {$_.ProcessName -like "*voicemeeter*"} + +# Vérifie si le processus audiodg est en cours d'exécution +if ($audiodgProcess -eq $null -or $voicemeeterProcess -eq $null) { + Write-Host "Le processus audiodg ou voicemeeter n'est pas en cours d'execution." -ForegroundColor Red +} else { + # Obtient le nombre total de cœurs du processeur + $numberOfCores = (Get-WmiObject Win32_ComputerSystem).NumberOfLogicalProcessors + + # Calcule l'affinité pour le dernier cœur du processeur + $lastCoreAffinity = [math]::Pow(2, $numberOfCores - 1) + + # Convertit l'affinité en type [IntPtr] + $lastCoreAffinity = [IntPtr]::new($lastCoreAffinity) + + # Définit l'affinité et la priorité du processus audiodg et voicemeeter + $audiodgProcess.ProcessorAffinity = $lastCoreAffinity + $audiodgProcess.PriorityClass = "High" + $voicemeeterProcess.ProcessorAffinity = $lastCoreAffinity + $voicemeeterProcess.PriorityClass = "High" + + Write-Host "Laffinite et la priorite du processus audiodg et voicemeeter ont ete modifiees." -ForegroundColor Green +} \ No newline at end of file