Jump to content

CD control problem


Champak
 Share

Recommended Posts

I've searched msdn and here, and can't clearly see how to control the CD/DVD using wmp object. Yes I know about the CD/DVD object in wmp, but I can't figure how to implement it (4 hours :) ). I've tried reading the file list to an array and then load the "file" to play the CD; that works for the first file, but I can't skip around after that because I can't get the current file that is playing (it gives me some weird name when I use $oPlayer.currentmedia.sourceURL). So help with an example please. I have put together a media controller that can control files on the computer, but nothing in the CD/DVD drive.

Link to comment
Share on other sites

That's exactly what I have. But that works as far as playing the first song. How do I skip to the next/previous song? How do I detect what song is already playing?

Func _CreateCDDVDList()

    $CDDVDSearch=_IsCDDVD($CDDVDDrive)

    If $CDDVDSearch = 1 then
        ConsoleWrite("CD detected" & @CRLF)
        $aSource = _FileListToArray ( $CDDVDDrive & ":\", "*.cda", 1 )
        _ArrayDelete($aSource,0)

        $sSource = ""
        For $i = 0 To UBound($aSource) - 1
            $sSource = $sSource & "|" & $aSource[$i]
        Next
            $sSource = StringReplace($sSource,".cda","")
    Else
        ConsoleWrite("DVD detected")
        ;DVD FUNCTION 
    EndIf

EndFunc

Then I have the play/next/previous functions somewhere else.

Also trying to figure out how to highlight the current song in the combo box...although I guess once I figure out how to detect current playing song/file, that shouldn't be a problem.

Edited by Champak
Link to comment
Share on other sites

Solved my problem. If anyone else comes up with this issue with a CD player, here is what I came up with....however I highly suspect there is a better/more standard way.

1/ Read CD drive into array

2/ Make that array 2D

3/ Put place marker in col 2

4/ Now whenever you go to next/previous song, it reads the current place, and then marks the next place in the array.

Create array

Func _CreateCDDVDList()

    $CDDVDSearch=_IsCDDVD($CDDVDDrive)

    If $CDDVDSearch = 1 then
        ConsoleWrite("CD detected" & @CRLF)
        $aSource = _FileListToArray ( $CDDVDDrive & ":\", "*.cda", 1 )
        _ArrayDelete($aSource,0)
        Dim $Combo [UBound($aSource)][2]
        For $y = 0 to UBound($aSource) - 1
             $Combo[$y][0] = $aSource[$y]
        Next
        $aSource = $Combo
        $aSource[0][1] = "Current"
        $sSource = ""
        For $i = 0 To UBound($aSource) - 1
            $sSource = $sSource & "|" & $aSource[$i][0]
        Next
        $sSource = StringReplace($sSource,".cda","")
    Else
        ConsoleWrite("DVD detected")
        ;DVD FUNCTION 
    EndIf

EndFuncoÝ÷ Ù*'É"¦§«­¢+Ø$$ÀÌØí¥-äÜô}ÉÉåMÉ É ÀÌØíM½ÕÉ°ÅÕ½Ðí
ÕÉɹÐÅÕ½Ðì°À°À°´Ä°´Ä°À°±Í¤($$ÀÌØíM½ÕÉlÀÌØí¥-äÝlÁuulÅtôÅÕ½ÐìÅÕ½Ðììļ%±ÑÑ¡Á±Ý¡ÉÅÕ½Ðí
ÕÉɹÐÅÕ½Ðì¥Ì($$ÀÌØíM½ÕÉlÀÌØí¥-äÝlÁt¬ÅulÅtôÅÕ½Ðí
ÕÉɹÐÅÕ½Ðììȼ¹½ÜÝÉ¥ÑÅÕ½Ðí
ÕÉɹÐÅÕ½ÐìÝ¡ÉÑ¡¹ÜÍÁ½Ð¥Ì($%]51½¥± ÀÌØí½A±åÈ°ÀÌØíM½ÕÉlÀÌØí¥-äÝlÁt¬ÅulÁt¤ì̼1½¹ÜÑɬ

Now I have to figure out how to get the duration/length of the song (CD)....Anyone?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...