Improved cycle-audio OSD info
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
position instead of remembering the window center position.
|
position instead of remembering the window center position.
|
||||||
- High DPI multi monitor fix.
|
- High DPI multi monitor fix.
|
||||||
- `start-size` option has new options, see in config editor and manual.
|
- `start-size` option has new options, see in config editor and manual.
|
||||||
|
- Improved `cycle-audio` OSD info.
|
||||||
|
|
||||||
|
|
||||||
5.4.8.8 Beta (2021-05-09)
|
5.4.8.8 Beta (2021-05-09)
|
||||||
|
|||||||
@@ -298,18 +298,26 @@ namespace mpvnet
|
|||||||
|
|
||||||
public static void CycleAudio()
|
public static void CycleAudio()
|
||||||
{
|
{
|
||||||
MediaTrack[] tracks = core.MediaTracks.Where(track => track.Type == "a").ToArray();
|
MediaTrack[] audioTracks = core.MediaTracks.Where(track => track.Type == "a").ToArray();
|
||||||
|
int len = audioTracks.Length;
|
||||||
|
|
||||||
if (tracks.Length < 2)
|
if (len < 1)
|
||||||
|
{
|
||||||
|
core.commandv("show-text", "No audio tracks");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int aid = core.get_property_int("aid");
|
int aid = core.get_property_int("aid");
|
||||||
|
|
||||||
if (++aid > tracks.Length)
|
if (len > 1)
|
||||||
aid = 1;
|
{
|
||||||
|
if (++aid > len)
|
||||||
|
aid = 1;
|
||||||
|
|
||||||
core.commandv("set", "aid", aid.ToString());
|
core.commandv("set", "aid", aid.ToString());
|
||||||
core.commandv("show-text", aid + ": " + tracks[aid - 1].Text.Substring(3), "5000");
|
}
|
||||||
|
|
||||||
|
core.commandv("show-text", aid + "/" + len + ": " + audioTracks[aid - 1].Text.Substring(3), "5000");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ShowCommands()
|
public static void ShowCommands()
|
||||||
|
|||||||
Reference in New Issue
Block a user