129 lines
3.8 KiB
C#
129 lines
3.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Runtime.InteropServices;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Project.Dialog
|
|
{
|
|
public partial class fVolume : Form
|
|
{
|
|
//AudioSwitcher.AudioApi.CoreAudio.CoreAudioController ac;
|
|
//AudioSwitcher.AudioApi.CoreAudio.CoreAudioDevice dev;
|
|
System.Media.SoundPlayer snd;
|
|
|
|
private const int APPCOMMAND_VOLUME_MUTE = 0x80000;
|
|
private const int APPCOMMAND_VOLUME_UP = 0xA0000;
|
|
private const int APPCOMMAND_VOLUME_DOWN = 0x90000;
|
|
private const int WM_APPCOMMAND = 0x319;
|
|
|
|
[DllImport("user32.dll")]
|
|
public static extern IntPtr SendMessageW(IntPtr hWnd, int Msg,
|
|
IntPtr wParam, IntPtr lParam);
|
|
|
|
private void Mute()
|
|
{
|
|
SendMessageW(this.Handle, WM_APPCOMMAND, this.Handle,
|
|
(IntPtr)APPCOMMAND_VOLUME_MUTE);
|
|
}
|
|
|
|
private void VolDown()
|
|
{
|
|
SendMessageW(this.Handle, WM_APPCOMMAND, this.Handle,
|
|
(IntPtr)APPCOMMAND_VOLUME_DOWN);
|
|
}
|
|
|
|
private void VolUp()
|
|
{
|
|
SendMessageW(this.Handle, WM_APPCOMMAND, this.Handle,
|
|
(IntPtr)APPCOMMAND_VOLUME_UP);
|
|
}
|
|
|
|
public fVolume()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void trackBar1_Scroll(object sender, EventArgs e)
|
|
{
|
|
//if(dev != null)
|
|
//{
|
|
// dev.Volume = this.trackBar1.Value;
|
|
// System.Media.SystemSounds.Beep.Play();
|
|
//}
|
|
}
|
|
|
|
private void fVolume_Load(object sender, EventArgs e)
|
|
{
|
|
snd = new System.Media.SoundPlayer();
|
|
//var dev = new AudioSwitcher.AudioApi.CoreAudio.CoreAudioController().GetPlaybackDevices();
|
|
//if (dev == null)
|
|
//{
|
|
// trackBar1.Enabled = false;
|
|
// UTIL.MsgE("사운드 장치가 없습니다", true);
|
|
//}
|
|
//else
|
|
//{
|
|
// this.trackBar1.Value = (int)dev.Volume;
|
|
// System.Media.SystemSounds.Beep.Play();
|
|
//}
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
//up
|
|
VolUp();
|
|
System.Media.SystemSounds.Beep.Play();
|
|
}
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
{
|
|
VolDown();
|
|
System.Media.SystemSounds.Beep.Play();
|
|
}
|
|
|
|
private void button3_Click(object sender, EventArgs e)
|
|
{
|
|
Mute();
|
|
}
|
|
|
|
private void button5_Click(object sender, EventArgs e)
|
|
{
|
|
var newvol = PUB.setting.musicvol + 10;
|
|
if (newvol > 100) newvol = 100;
|
|
if (newvol < 0) newvol = 0;
|
|
PUB.SetVolume(newvol);
|
|
}
|
|
|
|
private void button4_Click(object sender, EventArgs e)
|
|
{
|
|
var newvol = PUB.setting.musicvol - 10;
|
|
if (newvol > 100) newvol = 100;
|
|
if (newvol < 0) newvol = 0;
|
|
PUB.SetVolume(newvol);
|
|
}
|
|
|
|
private void button7_Click(object sender, EventArgs e)
|
|
{
|
|
PUB.mplayer.Stop();
|
|
}
|
|
|
|
private void button6_Click(object sender, EventArgs e)
|
|
{
|
|
PUB.mplayer.Play();
|
|
}
|
|
|
|
private void button8_Click(object sender, EventArgs e)
|
|
{
|
|
var s = "고수석님, 그 에러는 못고쳐요. 포기 하면 편해요";
|
|
var s1 = $"현재시간은 {DateTime.Now.Hour}시 입니다";
|
|
PUB.Speak(this.textBox1.Text);
|
|
}
|
|
}
|
|
}
|