Imports WMPLib 'Media Player in virtual form Public Class PlayerControl Dim Player As WindowsMediaPlayer = New WindowsMediaPlayer Public Sub LoadSong(ByVal songname As String) Dim urls() As String = {songname} ' create the playlist For Each u In urls Player.URL = u Player.controls.play() Next End Sub Public Sub Pause() Player.controls.pause() End Sub Public Sub Play() Player.controls.play() End Sub Public Sub NextSong() Player.controls.next() End Sub Public Sub PreviousSong() Player.controls.previous() End Sub Public Sub StopPlaying() Player.controls.stop() End Sub Public Function GetSongName() Return Player.currentMedia.name.ToString() End Function Public Function GetCurrentPos() Return Player.controls.currentPosition.ToString End Function Public Function GetTotalDuration() On Error Resume Next Return Player.currentMedia.duration End Function Public Sub VolUp() Player.settings.volume = Player.settings.volume + 12.5 End Sub Public Sub VolDown() Player.settings.volume = Player.settings.volume - 12.5 End Sub Public Sub initiateVol() Player.settings.volume = My.Settings.Vol End Sub Public Function GetVol() Return Player.settings.volume.ToString() End Function Public Sub initiateLoopSetting() If My.Settings.LoopMode = "End Stop" Then ElseIf My.Settings.LoopMode = "Single Loop" Then Main.PictureBox10_Click(Nothing, Nothing) ElseIf My.Settings.LoopMode = "Playlist Loop" Then Main.PictureBox9_Click(Nothing, Nothing) End If End Sub Public Sub SetVol(ByVal num As Integer) Player.settings.volume = num End Sub Public Sub SoundFadeIn() For x As Integer = 0 To My.Settings.Vol Step 1 SetVol(x) Threading.Thread.Sleep(18) Next End Sub Public Sub SoundFadeOut() For x As Integer = GetVol() To 0 Step -1 SetVol(x) Threading.Thread.Sleep(20) Next End Sub Public Sub SetPos(ByVal Setto As Double) Player.controls.currentPosition = Setto End Sub End Class