Champak Posted February 16, 2008 Share Posted February 16, 2008 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 More sharing options...
James Posted February 16, 2008 Share Posted February 16, 2008 You need to read the drive letter of the CD drive then from that put all the files into an array, checking if they are audio if they are then list otherwise "kick" them out. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Champak Posted February 16, 2008 Author Share Posted February 16, 2008 (edited) 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 February 16, 2008 by Champak Link to comment Share on other sites More sharing options...
Champak Posted February 18, 2008 Author Share Posted February 18, 2008 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 More sharing options...
JustinReno Posted February 18, 2008 Share Posted February 18, 2008 _SoundLength? Link to comment Share on other sites More sharing options...
Champak Posted February 18, 2008 Author Share Posted February 18, 2008 That wont work with a cda file (File on a CD). Link to comment Share on other sites More sharing options...
Champak Posted February 19, 2008 Author Share Posted February 19, 2008 Solved the duration problem, I didn't realize that I didn't copy over the get duration function I had on mp3 files...blatant oversight I guess: GUICtrlSetData($WMP_Duration,$oPlayer.currentmedia.durationstring) Now the last two bits I need are to seek/fastforward and fastrewind as well as pause on the CD...Anyone? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now