Hello,
This sample project showcases the CDAudio plugin.
Skills Used: CD, CDA, CDAudio, Timer.
Professional Software Development Tools
Hello,
This sample project showcases the CDAudio plugin.
Skills Used: CD, CDA, CDAudio, Timer.
Last edited by Desmond; 09-27-2005 at 09:10 AM.
I've been playing around with this, and although it works great...on my system, I have 2 CDROM drives and it has a hard time determining which drive a CD is in.
Is there a way to enumerate the drives and actually choose the one (automatically) that has a CD inserted? I tried to break out of the for loop, but it still won't recognize that a CD is/is not inserted. Nothing urgent, just messin' around.
Hello rhosk,
Try this:
I don't have an audio CD here to test with, so the above has only been tested with the base-case (ie. no CD). Give 'er a shot and let me know!Code:-- Get all system drives tDrives = Drive.Enumerate(); -- Initialize loaded variable bLoaded = false; -- Loop through drive table for nIndex, sDrive in tDrives do -- Get the type of the current drive nType = Drive.GetType(sDrive); -- Check if the current drive is a CD drive if nType == DRIVE_CDROM then -- Attempt to load a CD from the current drive CDAudio.LoadCD(sDrive); -- Get the last reported error err = Application.GetLastError(); -- Check if the error is related to the load failing if (err == CDAudio.ERR_NOT_CD_DRIVE) or (err == CDAudio.ERR_NO_CD_IN_DRIVE) then -- The specified drive either has no cd, or is not a cd drive, do whatever here elseif (err == CDAudio.OK) then -- The cd was loaded successfully bLoaded = true; else -- The CD was not loaded successfully end end end if bLoaded then -- There is a CD that has been loaded by the CDAudio plugin, do whatever here else -- NO CD IS LOADED, ALERT THE USER Dialog.Message("ERROR", "No CD was found."); end
That worked perfect, thanks![]()
Excellent. Happy to help!
Thanks to Desmond for the sample. But I always get that error attached. Why?
And where do I have to put the CD check script?
Cheers
Schmidl
Make sure you have the plugin "CDAudio" checked![]()
thank you
(I should think before I write
)
Schmidl
But there is still the last question: Where do I have to put the drive-check-code from Desmond postet on 10-05-2005? Page on show, before the script of the play button...
Schmidl
I guess it depends on when the Audio will start to play. You could place that code in the On Show event and then if an Audio CD is not detected you can disable the Play Audio button. Or you can have it on the Play button and if no Audio CD is found then serve back an error to the user.
Tigg
TJ-Tigger
"A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
"Draco dormiens nunquam titillandus."
Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine
Can the CD Audio sample be reposted?