🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.multimedia
Article #91

Re: Playing Audio CD

#91
From: Remy Lebeau (TeamB)
Date: Wed, 02 Nov 2005 20:08
62 lines
3039 bytes
"Stefano Bonifazi" <stefboombastic@libero.it> wrote in message
news:4368a145@newsgroups.borland.com...

>  mcisysinfo.wDeviceType=MCI_DEVTYPE_CD_AUDIO;
>  MCIERROR
>
errcode=mciSendCommand(NULL,MCI_SYSINFO,MCI_SYSINFO_QUANTITY,(DWORD)&mcisysi
nfo);

Try specifying MCI_DEVTYPE_CD_AUDIO instead of NULL as the IDDevice
parameter of mciSendCommand():

    MCI_SYSINFO_PARMS params = {0};
    char Buffer[256] = {0};
    params.lpstrReturn = Buffer;
    params.dwRetSize = 256;
    params.wDeviceType = MCI_DEVTYPE_CD_AUDIO;

    MCIERROR errcode = mciSendCommand(MCI_DEVTYPE_CD_AUDIO, MCI_SYSINFO,
MCI_SYSINFO_QUANTITY, (DWORD)&params);

If that doesn't work, then you will just have to enumerate the drive letters
manually by using the GetLogicalDriveStrings() and GetDriveType() functions:

    char DriveLetters[108] = {0};
    if( GetLogicalDriveStrings(sizeof(DriveLetters), DriveLetters) )
    {
        char *Drive = DriveLetters;
        while( *Drive != '\0' )
        {
            if( GetDeviceType(Drive) == DRIVE_CDROM )
                // use Drive as needed...
            Drive += 4;
        }
    }

When opening a device, you can open a specific drive letter without knowing
its index in the MCI table by specifying the drive letter in the
lpstrElementName member of the MCI_OPEN_PARMS structure:

    MCI_OPEN_PARMS params = {0};
    params.lpstrDeviceType = (LPSTR) MAKELONG(MCI_DEVTYPE_CD_AUDIO, 0);
    params.lpstrElementName = "X:";

    errcode = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID |
MCI_OPEN_ELEMENT, (DWORD)&params);

You can then send commands to the device ID that is returned.

Alternatively, you can use mciSendString() instead of mciSendCommand(),
using the "open" string:

    char Buffer[256];
    errcode = mciSendString("open X: type cdaudio alias MyCD", Buffer, 256,
NULL);

You can then send commands to the opened device using the "MyCD" alias (you
can name the alias whatever you want).


Gambit
Technical Details
Message-ID: <43691cc2$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed.freenet.de!bolzen.all.de!news.mediascape.de!newsfeed.cw.net!news-FFM2.ecrc.de!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <4367e9aa@newsgroups.borland.com> <4367fa1f@newsgroups.borland.com> <4368a145@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10d0fc,b7a843302d134117
X-Google-Attributes: gid10d0fc,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.multimedia
References: <4367e9aa@newsgroups.borland.com> <4367fa1f@newsgroups.borland.com> <4368a145@newsgroups.borland.com>
Subject: Re: Playing Audio CD
Date: Wed, 2 Nov 2005 12:08:14 -0800
Lines: 64
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <43691cc2$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1130962114 68.69.17.41 (2 Nov 2005 12:08:34 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed.freenet.de!bolzen.all.de!news.mediascape.de!newsfeed.cw.net!news-FFM2.ecrc.de!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail