I made a program able to play mp3 files like this:
class Mp3Player : IDisposable
{
public bool Repeat { get; set; }
public Mp3Player(string fileName)
{
const string FORMAT = @"open ""{0}"" type mpegvideo alias MediaFile";
string command = String.Format(FORMAT, fileName);
mciSendString(command, null, 0, IntPtr.Zero);
}
public void Play()
{
string command = "play MediaFile";
if (Repeat) command += " REPAT";
mciSendString(command, null, 0, IntPtr.Zero);
}
public void Stop()
{
string command = "stop MediaFile";
mciSendString(command, null, 0, IntPtr.Zero);
}
[DllImport("winmm.dll")]
private static extern long mciSendString(string strCommand, StringBuilder strReturn, int iReturnLength, IntPtr hwndCallback);
public void Dispose()
{
string command = "close MediaFile";
mciSendString(command, null, 0, IntPtr.Zero);
}
}
And I want to add volume bar to my media file something like this:
And if I go to the right to make the sound louder and if I go to the left otherwise.