202508130945

img.ini 移動至本地
VideoPlayerForm檔案音量控制與靜音
This commit is contained in:
jasonchenwork 2025-08-13 13:07:16 +08:00
parent 732572bda2
commit d12759b1c2
3 changed files with 1185 additions and 12 deletions

View File

@ -177,7 +177,7 @@ namespace DualScreenDemo
private Timer autoRefreshTimer; private Timer autoRefreshTimer;
private Timer timerCountdown; private Timer timerCountdown;
string Rtime; string Rtime;
bool test = false;
//private Label pageNumberLabel; // 添加頁碼標籤 //private Label pageNumberLabel; // 添加頁碼標籤
public PrimaryForm() public PrimaryForm()
{ {
@ -1092,6 +1092,7 @@ namespace DualScreenDemo
(sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("音量 ↑", "a2 b3 a4"); }); (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("音量 ↑", "a2 b3 a4"); });
musicDownButton = new Button { Text = "" }; musicDownButton = new Button { Text = "" };
musicDownButton.Name = "musicDownButton"; musicDownButton.Name = "musicDownButton";
ConfigureButton(musicDownButton, 128, 823, 93, 62, ConfigureButton(musicDownButton, 128, 823, 93, 62,
@ -1100,6 +1101,23 @@ namespace DualScreenDemo
new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["MusicLowActive"])), new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["MusicLowActive"])),
(sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("音量 ↓", "a2 b4 a4"); }); (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("音量 ↓", "a2 b4 a4"); });
if (test)
{
musicUpButton.Click += (sender, e) =>
{
videoPlayerForm.SetVolume(videoPlayerForm.GetVolume() + 5);
int vol = videoPlayerForm.GetVolume() - 100;
OverlayForm.MainForm.ShowTopRightLabel(vol.ToString(), null);
};
musicDownButton.Click += (sender, e) =>
{
videoPlayerForm.SetVolume(videoPlayerForm.GetVolume() - 5);
int vol = videoPlayerForm.GetVolume() - 100;
OverlayForm.MainForm.ShowTopRightLabel(vol.ToString(), null);
};
}
micUpButton = new Button { Text = "" }; micUpButton = new Button { Text = "" };
micUpButton.Name = "micUpButton"; micUpButton.Name = "micUpButton";
@ -1308,7 +1326,7 @@ namespace DualScreenDemo
private void InitializeButton(ref Button button, ref Bitmap normalBackground, ref Bitmap activeBackground, string buttonName, int x, int y, int width, int height, string imagePath, string imagePathb, EventHandler clickEventHandler) private void InitializeButton(ref Button button, ref Bitmap normalBackground, ref Bitmap activeBackground, string buttonName, int x, int y, int width, int height, string imagePath, string imagePathb, EventHandler clickEventHandler)
{ {
var data = LoadConfigData(); var data = LoadBtnConfigData();
button = new Button { Text = "", Name = buttonName }; button = new Button { Text = "", Name = buttonName };
ResizeAndPositionButton(button, x, y, width, height); ResizeAndPositionButton(button, x, y, width, height);
@ -1374,10 +1392,18 @@ namespace DualScreenDemo
if (isOnOrderedSongsPage) if (isOnOrderedSongsPage)
{ {
vodButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, data["SongOrderPanel"]["DelBtn"])); vodButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, data["SongOrderPanel"]["DelBtn"]));
vodButton.MouseEnter += (sender, e) => vodButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, data["SongOrderPanel"]["DelBtn"])); ; vodButton.MouseEnter += (sender, e) => vodButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, data["SongOrderPanel"]["DelBtn"]));
vodButton.MouseLeave += (sender, e) => vodButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, data["SongOrderPanel"]["DelBtn"])); ; vodButton.MouseLeave += (sender, e) => vodButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, data["SongOrderPanel"]["DelBtn"]));
vodButton.MouseDown += (sender, e) => vodButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, data["SongOrderPanel"]["DelBtn"])); ; vodButton.MouseDown += (sender, e) => vodButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, data["SongOrderPanel"]["DelBtn"]));
vodButton.MouseUp += (sender, e) => vodButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, data["SongOrderPanel"]["DelBtn"])); ; vodButton.MouseUp += (sender, e) => vodButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, data["SongOrderPanel"]["DelBtn"]));
}
else
{
vodButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, data["SongOrderPanel"]["Request"]));
vodButton.MouseEnter += (sender, e) => vodButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, data["SongOrderPanel"]["Request"]));
vodButton.MouseLeave += (sender, e) => vodButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, data["SongOrderPanel"]["Request"]));
vodButton.MouseDown += (sender, e) => vodButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, data["SongOrderPanel"]["Request"]));
vodButton.MouseUp += (sender, e) => vodButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, data["SongOrderPanel"]["Request"]));
} }
} }
@ -2168,7 +2194,7 @@ namespace DualScreenDemo
// 添加載入按鈕圖片的方法 // 添加載入按鈕圖片的方法
private Image LoadButtonImage(string imageName) private Image LoadButtonImage(string imageName)
{ {
var data = LoadConfigData(); var data = LoadBtnConfigData();
try try
{ {
@ -2326,7 +2352,7 @@ namespace DualScreenDemo
private IniData LoadBtnConfigData() private IniData LoadBtnConfigData()
{ {
var parser = new FileIniDataParser(); var parser = new FileIniDataParser();
string iniFilePath = Path.Combine(serverPath, "img.ini"); string iniFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "img.ini");
// 使用 UTF-8 讀取 INI 檔案並解析內容 // 使用 UTF-8 讀取 INI 檔案並解析內容

View File

@ -321,11 +321,12 @@ namespace DualScreenDemo
string pathToPlay = song.getFile(); string pathToPlay = song.getFile();
// 渲染媒體文件 // 渲染媒體文件
secondary.LoadMedia(pathToPlay,song.isPublicSong ? 0 : 1); secondary.LoadMedia(pathToPlay,song.isPublicSong ? 0 : 1);
secondary.Mute(isMuted);
secondary.PlayAsync(); secondary.PlayAsync();
// 音量處理 // 音量處理
SetVolume(isMuted ? 0 : previousVolume); //SetVolume(isMuted ? 0 : previousVolume);
SetVolume(100+song.getBasic().getDbChange());
if (isSyncToPrimaryMonitor) SyncToPrimaryMonitor(); if (isSyncToPrimaryMonitor) SyncToPrimaryMonitor();
return Task.CompletedTask; return Task.CompletedTask;
} }

1146
img.ini Normal file

File diff suppressed because it is too large Load Diff