인공지능을 이용하여 만들어서 순식간에 만들었어요...
하지만 역시 쉽게 하는 대신에 소스 해독력이 떨어지네요....
하지만 현실은 인공지능의 도움 없이는 거의 불가능 하다 생각하니......
소스를 공개 합니다...
처음 하시는 분들은 디자이너 에러 때문에 고생좀 할겁니다..
디자인을 잘 유의 해야 합니다..lbl은 필요가 없어서 지웠는데 소스가
약간 지저분 하네요.....^^
단독 실행파일 exe로 실행이 않되기 때문에 bin디렉토리를 압축했어요...
압축풀고 실행화일 실행하시면 됩니다....
using System;
using System.Windows.Forms;
using NAudio.Wave;
namespace WindowsFormsApp15
{
public partial class Form1 : Form
{
AudioFileReader audioFile;
WaveOutEvent outputDevice;
string mp3File = "";
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void btnOpen_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = "MP3 Files (*.mp3)|*.mp3";
if (dlg.ShowDialog() == DialogResult.OK)
{
mp3File = dlg.FileName;
MessageBox.Show(
"선택된 파일:\r\n" + mp3File,
"파일 선택"
);
}
}
private void btnPlay_Click(object sender, EventArgs e)
{
if (mp3File == "")
{
MessageBox.Show("먼저 MP3 파일을 선택하세요.");
return;
}
try
{
if (outputDevice != null)
{
outputDevice.Stop();
outputDevice.Dispose();
}
if (audioFile != null)
{
audioFile.Dispose();
}
outputDevice = new WaveOutEvent();
audioFile = new AudioFileReader(mp3File);
outputDevice.Init(audioFile);
outputDevice.Play();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void btnStop_Click(object sender, EventArgs e)
{
try
{
if (outputDevice != null)
{
outputDevice.Stop();
outputDevice.Dispose();
outputDevice = null;
}
if (audioFile != null)
{
audioFile.Dispose();
audioFile = null;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void lblFile_Click(object sender, EventArgs e)
{
}
}
}