Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 11 of 11

Thread: SAMPLE: CDAudio

  1. #1
    Join Date
    Jul 2003
    Posts
    712

    SAMPLE: CDAudio

    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.

  2. #2
    Join Date
    Aug 2003
    Location
    Maine, USA
    Posts
    1,695
    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.

  3. #3
    Join Date
    Jul 2003
    Posts
    712
    Hello rhosk,

    Try this:

    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
    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!

  4. #4
    Join Date
    Aug 2003
    Location
    Maine, USA
    Posts
    1,695
    That worked perfect, thanks

  5. #5
    Join Date
    Jul 2003
    Posts
    712
    Excellent. Happy to help!

  6. #6
    Join Date
    Apr 2004
    Location
    Bavaria (Germany)
    Posts
    91
    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

  7. #7
    Join Date
    Aug 2003
    Location
    Maine, USA
    Posts
    1,695
    Make sure you have the plugin "CDAudio" checked

  8. #8
    Join Date
    Apr 2004
    Location
    Bavaria (Germany)
    Posts
    91

    Oops

    thank you (I should think before I write )

    Schmidl

  9. #9
    Join Date
    Apr 2004
    Location
    Bavaria (Germany)
    Posts
    91
    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

  10. #10
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    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

  11. #11
    Join Date
    Nov 2003
    Posts
    35

    Can the CD Audio sample be reposted?

    Can the CD Audio sample be reposted?

Similar Threads

  1. New Sample Project Available
    By Darryl in forum Setup Factory 7.0
    Replies: 1
    Last Post: 09-27-2004, 04:00 PM
  2. Sample project TABLE2HTML
    By Corey in forum AutoPlay Media Studio 5.0
    Replies: 1
    Last Post: 04-26-2004, 07:37 PM
  3. Newbie Question re: Media Player "Sample Video"
    By videoman in forum AutoPlay Media Studio 4.0
    Replies: 20
    Last Post: 02-17-2003, 02:37 PM
  4. Are the Templates for the 5 Sample Applications available for download?
    By francisq in forum AutoPlay Media Studio 4.0
    Replies: 2
    Last Post: 12-17-2002, 10:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts