Opened 7 years ago
Closed 14 months ago
#3 closed defect (fixed)
CD player should be capable of playing via digital transfer from attached devices
Reported by: | Lewis Rosenthal | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 0.3.0 first from Netlabs |
Component: | Classes | Version: | 0.2.9 |
Keywords: | Cc: |
Description
IBM's CD player (CDPM.EXE) is able to be set to enable digital transfer for devices which have this feature (as most new devices do).
Change History (7)
comment:1 by , 4 years ago
Milestone: | 0.30 first from Netlabs → 0.3.0 first from Netlabs |
---|
comment:2 by , 4 years ago
It should be possible to use the MCI of MMOS2 to access the digital transfer feature MMOS2 provides. (Switch on via STPM.EXE). I am looking for source code with an example how to use these API calls.
comment:3 by , 15 months ago
Here is code to switch on "Digital Transfer" and play cd Audio CD track:
/* To compile and link: icc -Q -W3 -G5 -Gd+ -Gm+ -Ti cdaudio.cpp mmpm2.lib; dllrname cdaudio.exe CPPOM30=OS2OM30 */ #define INCL_BASE #define INCL_PM #include <os2.h> #define INCL_OS2MM #include <os2me.h> #include <stdio.h> #include <memory.h> #define MAX_NUM_TRACKS 50 /* can handle an Audio CD with a maximum of 50 sound tracks */ int main(int argc,char *argv[]) { USHORT rc = 0; MCI_OPEN_PARMS openParms={0}; MCI_GENERIC_PARMS genParms={0}; MCI_TOC_PARMS tocParms={0}; MCI_TOC_REC tocInfo[MAX_NUM_TRACKS]; MCI_CONNECTOR_PARMS conParms={0}; MCI_PLAY_PARMS playParms={0}; UCHAR errorMsg[256]={0}; memset(&openParms,0,sizeof(openParms)); openParms.pszDeviceType = (PSZ)MAKEULONG(MCI_DEVTYPE_CD_AUDIO,0); /* 0 = open default CD-Audio device */ rc = LOUSHORT(mciSendCommand(0,MCI_OPEN,MCI_OPEN_TYPE_ID | MCI_WAIT,&openParms,0)); if (NO_ERROR == rc) { /* the next command will enable the "Digital Transfer" connection */ /* instead of playing the audio via the headphone/analog audio connection to a sound card */ memset(&conParms,0,sizeof(conParms)); conParms.ulConnectorType = MCI_CD_STREAM_CONNECTOR; /* it is the CD stream connector that establishes this connection */ rc = LOUSHORT(mciSendCommand(openParms.usDeviceID,MCI_CONNECTOR,MCI_ENABLE_CONNECTOR | MCI_CONNECTOR_TYPE | MCI_WAIT,&conParms,0)); /* read the toc of the Audio CD */ /* we need this to select the specific start/end point of a track so that we can seek to it / select a track to play */ memset(&tocParms,0,sizeof(tocParms)); tocParms.pBuf = (PTOCREC)tocInfo; tocParms.ulBufSize = sizeof(tocInfo); rc = LOUSHORT(mciSendCommand(openParms.usDeviceID,MCI_GETTOC,MCI_WAIT,&tocParms,0)); if (NO_ERROR == rc) { memset(&playParms,0,sizeof(playParms)); /* tocInfo[0].TrackNum contains the 1-based track number but we cannot select this as a starting/end point */ playParms.ulFrom = tocInfo[0].ulStartAddr; playParms.ulTo = tocInfo[0].ulEndAddr; /* now, start playing the track 1 of the Audio CD */ rc = LOUSHORT(mciSendCommand(openParms.usDeviceID,MCI_PLAY,MCI_FROM | MCI_TO | MCI_WAIT,&playParms,0)); if (NO_ERROR != rc) { rc = mciGetErrorString(rc,(PSZ)errorMsg,sizeof(errorMsg)); printf("%s\n",errorMsg); } /* endif */ /* when it is done, better stop the playing */ memset(&genParms,0,sizeof(genParms)); rc = LOUSHORT(mciSendCommand(openParms.usDeviceID,MCI_STOP,MCI_WAIT,&genParms,0)); } /* endif */ memset(&genParms,0,sizeof(genParms)); rc = LOUSHORT(mciSendCommand(openParms.usDeviceID,MCI_CLOSE,MCI_WAIT,&genParms,0)); } /* endif */ return 0; }
comment:4 by , 14 months ago
I think the relevant place to implement enablement of "digital transfer" is in:
after this code (http://trac.netlabs.org/cwmmclasses/browser/trunk/mediafolder/c/cdfldr/cdfolderoverriddenwpmethods.cpp#L493):
488 sprintf(chrCommand,"open \"%s\" alias wave%d SHAREABLE wait", chrDevice, iWavePriv); 489 rc = mciSendString(chrCommand, retMsg, sizeof(retMsg), playControlDialogFromFrameHWND(hwndFrame), 0); 490 491 if((rc & 0x0000ffff)!=MCIERR_SUCCESS) 492 return 0;
just add (using string command instead of direct MCI commands):
/* enable the "digital transfer" connector */ sprintf(chrCommand,"CONNECTOR wave%d ENABLE TYPE CD stream WAIT", iWavePriv); rc = mciSendString(chrCommand, retMsg, sizeof(retMsg), playControlDialogFromFrameHWND(hwndFrame), 0); if((rc & 0x0000ffff)!=MCIERR_SUCCESS) return 0;
That should enable "digital transfer" if the CD-ROM device supports that (you could query the capability for this via the "CAPABILITY wave%d CAN STREAM WAIT" command string but I think nowadays every CD-ROM device will support this mode).
comment:7 by , 14 months ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Milestone renamed