Article View: comp.sys.next.programmer
Article #110(failing to) read Audio Data from CDROM
From: joemann
Date: Mon, 02 Nov 1992 17:22
Date: Mon, 02 Nov 1992 17:22
51 lines
2555 bytes
2555 bytes
After installing 3.0 on all our machines the CD-ROM drive wasn't used too much
anymore. And to prevent it from being misused by installing NT on PCs (argh!) I
thought it could be a good idea to play back audio CDs. But unfortunately we
don't have an amplifier and speakers here, so I tried to read the data directly
off the CD and play it using the DSP. I wrote the following program which
constantly failed working when I inserted audio CDs. However, it works fine
with data CDs although the "music" isn't too enjoyable...
struct timeval tv;
struct esense_reply esense;
int fd,err,length=10,firstBlock=1024;
SNDSoundStruct *snd;
char *buf;
fd=open("/dev/rsd1h",O_RDONLY,0);
SNDAlloc(&snd,length*2048,SND_FORMAT_LINEAR_16,SND_RATE_HIGH,2,0);
buf=(char *)snd+snd->dataLocation;
bzero(buf,length*2048);
err=do_read2(fd,firstBlock,length,buf,&tv,&esense);
SNDStartPlaying(snd,1,2,NO,SND_NULL_FUN,SND_NULL_FUN);
do_read2 is a modification of the do_read function in
/NextDeveloper/Examples/UNIX/SCSI_CD/scsi_commands.c. I replaced the following
lines to really read the data into a buffer:
sr.sr_addr = buf;
sr.sr_dma_max = 256;
sr.sr_ioto = 5;
sr.sr_dma_dir = SR_DMA_RD;
The following messages showed up in the Console window:
sd1 (6,0): ERROR op:0x8 sd_state:4 scsi status:0x0
sd1 (6,0): sense key:0x5 additional sense code:0x64
SCSI Block in error = 1024 (no valid label)
Is this due to the fact that (a) the disk doesn't have a label (I thought those
"live" partitions were introduced for such cases) or (b) "something" in the
CD-ROM drive ensures that no digital copies of audio CDs can be made?
Erik Doernenburg
___________________________________________________________________
AMG Industrie Consulting GmbH (NeXT mail) erik@amg.de
Universitaet Dortmund knight06@pandora.informatik.uni-dortmund.de
--
Johannes 5 Joemann
Wissenschaftsladen Dortmund, Lindemannstr.84, D(W)-4600 Dortmund 1
Tel. 0231-104002 (ggf. Anrufbeantworter)
WILADO@DOO.ZER, joemann@anarch.do.open.de
Technical Details
Message-ID:
<1992Nov2.172257.14250@anarch.do.open.de>Path:
arc1-ca.pugleaf.net!sparky!uunet!snorkelwacker.mit.edu!ira.uka.de!Germany.EU.net!horga!anarch!joemannShow Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!snorkelwacker.mit.edu!ira.uka.de!Germany.EU.net!horga!anarch!joemann From: <joemann@anarch.do.open.de> (Johannes 5 Joemann) Subject: (failing to) read Audio Data from CDROM Message-ID: <1992Nov2.172257.14250@anarch.do.open.de> Sender: joemann@anarch.do.open.de (Johannes 5 Joemann) Reply-To: erik@amg.de Organization: LogikFabrik/WiLa Dortmund Date: Mon, 2 Nov 1992 17:22:57 GMT Lines: 51