u/jeffy303
May 2026, Hasan Piker calmly reads off a list of Twitch employees to be escorted out of Twitch HQ
Vibe-coded automatic audio device switching for Windows 11 if anyone needs
Idk if it works better on linux (probably) but on Win11, when switching audio devices mpv would not recognize it, which is bit annoying to me since I switched to using wireless earbuds which don't last all day. And ChatGPT was surprisingly able to help. After a bit I discovered when you switch audio device, mpv disappears completely, this script stops it and switches the devices pretty seamlessly
Create a new script file in scripts folder:
local mp = require "mp"
local timer = nil
local first_device_event = true
local last_device_signature = nil
local suppress_until = 0
-- Tweak these if needed.
local DEBOUNCE_SECONDS = 2.0
local SUPPRESS_AFTER_FILE_START = 2.5
local function now()
return mp.get_time()
end
local function safe_commandv(...)
local ok, err = mp.commandv(...)
return ok
end
local function device_signature(list)
if type(list) ~= "table" then
return ""
end
local parts = {}
for _, dev in ipairs(list) do
parts[#parts + 1] = tostring(dev.name or "")
parts[#parts + 1] = tostring(dev.description or "")
end
return table.concat(parts, "|")
end
local function cancel_timer()
if timer then
timer:kill()
timer = nil
end
end
local function suppress_recovery_temporarily()
suppress_until = now() + SUPPRESS_AFTER_FILE_START
cancel_timer()
end
local function recover_audio(show_osd)
local old_aid = mp.get_property("aid", "auto")
mp.set_property("audio-device", "auto")
-- More directly reloads the audio output.
safe_commandv("ao-reload")
-- Extra force: tear down and recreate the selected audio track.
mp.set_property("aid", "no")
mp.add_timeout(0.8, function()
if old_aid == "no" or old_aid == "" then
old_aid = "auto"
end
mp.set_property("audio-device", "auto")
mp.set_property("aid", old_aid)
safe_commandv("ao-reload")
safe_commandv("audio-reload")
if show_osd ~= false then
mp.osd_message("Audio output refreshed", 2)
end
end)
end
mp.add_key_binding("F8", "recover-audio-output", function()
recover_audio(true)
end)
-- Prevent auto-refresh while opening/changing files.
mp.register_event("start-file", suppress_recovery_temporarily)
mp.register_event("file-loaded", suppress_recovery_temporarily)
-- Keep fallback enabled so mpv can recover after Bluetooth/WASAPI device loss.
mp.set_property("options/audio-fallback-to-null", "yes")
mp.observe_property("audio-device-list", "native", function(_, list)
local sig = device_signature(list)
-- mpv sends an initial observer notification; ignore it.
if first_device_event then
first_device_event = false
last_device_signature = sig
return
end
-- Ignore notifications where the actual device list did not change.
if sig == last_device_signature then
return
end
last_device_signature = sig
-- Ignore device-list churn caused by opening a new file.
if now() < suppress_until then
return
end
cancel_timer()
-- Bluetooth endpoints appear/disappear in bursts, so wait before recovering.
timer = mp.add_timeout(DEBOUNCE_SECONDS, function()
timer = nil
if now() < suppress_until then
return
end
recover_audio(true)
end)
end)
And in mpf.conf this:
audio-device=auto
audio-exclusive=no
audio-fallback-to-null=yes
The code got twice as long when I asked it to stop it from refreshing audio device when opening new file, but who cares. Would be cool if something like this was in the app by default. Browsers and new games don't seem to have an issue with it, it's primarily older games that usually need restarting.
I ran EU5 in 1.2 (historical rulers) until 1600, here is how things look
A few highlights from when I was checking throughout the game:
- England got cripled early into the game, when France won
10050 years war they also took couple of locations right next to London, and Holland for some reason took Kent. Since France had the beachhead, England quickly lost London in subsequent wars. Idk why devs don't make AI much less willing to give those locations, or set a requirement that for big nations, you have to occupy locations near their capital if you want them. This was my number 1 cheese in 1.0 and seems to still work - Naples quickly overran the Pope (who became OPM in Avignon) which allowed them to push north, now they are stuck in endless wars against HRE and Hungary for the rest of Italy
- HRE is holding up very well, still 145 members (it was over 200 at 1500), Austria has held the Emperorship most of the time. Italian princes left. Emperor is bit weak against Hungary/Naples/France
- Reformation is progressing more or less historically, christian population is 1/3 protestant, if England was strong, they would have a decent shot in 30 years war
- Castille still can't be bothered to finish the Reconquista. They are much less aggressive towards Portugal, but since Portugal is allied with Aragon, means throughout the centuries Castile took locations from them here and there.
- It looks messy with all the vassals but Muscovy is doing better than I have ever seen them before. They are steadily expanding and colonizing, still need to take Novgorod, though.
- Wu formed very quickly after the fall of Yuan, cool to see. The awful part is that Yuan still exists.. They still hold Beijing megapolis location, the province around it, and about dozen vassals. Their economy is a joke, but Wu can't be bothered to take Beijing. Yuan is extracting wealth from it's vassals even though it's a completely isolated joke
- Byzantium was holding up pretty well until mid 1400s when they got double-teamed by Bulgaria and Ottomans. Who subsequently stopped bothering to expand. Since no empire is able to just die, Byzantium is still around; they have a few locations in Thessaloniki.
- Apart from a few locations, European powers haven't made any real colonization efforts in Africa
- Americas colonization started slowly but then rapidly picked up pace. Castille owns its historical colonies minus Mexico and the Caribbean. France took Brazil and Naples is focusing on US mainland
- Everyone seems to have been hammered by Black Death. Lot of countries to almost 1/3 of their population, that's more than I remember. France still has only 7.2mil pops despite being pretty sizable, Castille 5.3mil.
Just Cinema, no notes. The fact that the black dude is from Atlanta and the Whitey McWhiteface is from San Francisco is just a cherry on top.