This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local api = "wasapi" | |
local deviceList = {} | |
local function cycle_adevice(s, e, d) | |
while s ~= e + d do -- until the loop would cycle back to the number we started on | |
if string.find(mp.get_property("audio-device"), deviceList[s].name, 1, true) then | |
while true do | |
if s + d == 0 then --the device list starts at 1; 0 means we iterated to far | |
s = #deviceList + 1 --so lets restart at the last device | |
elseif s + d == #deviceList + 1 then --we iterated past the last device | |
s = 0 --then start from the beginning |