---
name: "SDL_CD"
section: "3"
platform: "linux"
package: "libsdl1.2-dev"
version: "1.2.15+dfsg2-8"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_CD"
---

# SDL\_CD(3)

CDROM Drive Information

## NAME

SDL\_CD - CDROM Drive Information

## STRUCTURE DEFINITION

```
typedef struct{
  int id;
  CDstatus status;
  int numtracks;
  int cur_track;
  int cur_frame;
  SDL_CDtrack track[SDL_MAX_TRACKS+1];
} SDL_CD;
```

## STRUCTURE DATA

- **id**

  Private drive identifier

- **status**

  Drive *status*

- **numtracks**

  Number of tracks on the CD

- **cur\_track**

  Current track

- **cur\_frame**

  Current frame offset within the track

- **track**\[SDL\_MAX\_TRACKS+1\]

  Array of track descriptions. (see **SDL\_CDtrack**)

## DESCRIPTION

An **SDL\_CD** structure is returned by **SDL\_CDOpen**. It represents an opened CDROM device and stores information on the layout of the tracks on the disc.

A frame is the base data unit of a CD. **CD\_FPS** frames is equal to 1 second of music. SDL provides two macros for converting between time and frames: **FRAMES\_TO\_MSF(f, M,S,F)** and **MSF\_TO\_FRAMES**.

## EXAMPLES

```
int min, sec, frame;
int frame_offset;
FRAMES_TO_MSF(cdrom->cur_frame, &min, &sec, &frame);
printf("Current Position: %d minutes, %d seconds, %d frames
", min, sec, frame);
frame_offset=MSF_TO_FRAMES(min, sec, frame);
```

## SEE ALSO

**SDL\_CDOpen**, **SDL\_CDtrack**
