Hello guys, when i was making BrickEmulator i made this for teh Lulz.
Example
MusicPlayer ClassCode:MusicPlayer Player = new MusicPlayer("http://download790.mediafire.com/4rhxfimwc8ng/dc3crb5jma6m83k/Nyan+Cat+%5Boriginal%5D.mp3",true);
Code:class MusicPlayer { private readonly string Path; private string Command = string.Empty; private Boolean Loop = false; private Boolean Started = false; [DllImport("winmm.dll")] private static extern long mciSendString(string strCommand, StringBuilder strReturn, int iReturnLength, IntPtr hwndCallback); public MusicPlayer(string Path, Boolean Loop) { this.Path = Path; this.Loop = Loop; Command = "open \"" + Path + "\" type mpegvideo alias MediaFile"; mciSendString(Command, null, 0, IntPtr.Zero); } public void Start() { if (!Started) { Command = "play MediaFile"; if (Loop) { Command += " REPEAT"; } mciSendString(Command, null, 0, IntPtr.Zero); Started = true; } } public void Stop() { if (Started) { Command = "close MediaFile"; mciSendString(Command, null, 0, IntPtr.Zero); Started = false; } } }



Reply With Quote


