Hey everyone, is there any way to tell if an audio track on a CD contains CDG subchannel info? Currently, I am using a the following code to read the subchannel info:

dk_cd_read_t    cd_read;

unsigned char *buffer = (unsigned char*)malloc(capacity);
memset(&cd_read, 0, sizeof(cd_read));

cd_read.offset          = offset;
cd_read.sectorArea      = 0xf8 + kCDSectorAreaSubChannel;
cd_read.sectorType      = kCDSectorTypeUnknown;
cd_read.buffer          = buffer;
cd_read.bufferLength    = capacity;
        
[self openDevice];
if ( ioctl(self.fileDescriptor, DKIOCCDREAD, &cd_read) == -1 )
{
        NSLog(@"Failed to read subchannel");
        NSLog(@"Error: %d",errno);
        free( buffer );
        [self closeDevice];
        return NO;
}
[self closeDevice];

It works great. Now I am wanting to create a loop to read only 1024 sectors at a time so that the UI can update in response to the time left. I don't want the loop to begin if there's no subchannel info as the ioctl call will fail an arbitrary number of times. Also, I'd like to test all the tracks on CD insertion to indicate if subchannel info is available. Is there another way to do this?
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to