---
name: "SDL_CDPlayTracks"
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_CDPlayTracks"
---

# SDL\_CDPlayTracks(3)

Play the given CD track(s)

## NAME

SDL\_CDPlayTracks - Play the given CD track(s)

## SYNOPSIS

**#include "SDL.h"**

**int SDL\_CDPlayTracks**(**SDL\_CD \*cdrom, int start\_track, int start\_frame, int ntracks, int nframes)**);

## DESCRIPTION

**SDL\_CDPlayTracks** plays the given CD starting at track **start\_track**, for **ntracks** tracks.

**start\_frame** is the frame offset, from the beginning of the **start\_track**, at which to start. **nframes** is the frame offset, from the beginning of the last track (**start\_track**+**ntracks**), at which to end playing.

**SDL\_CDPlayTracks** should only be called after calling **SDL\_CDStatus** to get track information about the CD.

**Note:**

**Data tracks are ignored.**

## RETURN VALUE

**Returns 0**, or **-1** if there was an error.

## EXAMPLES

```
/* assuming cdrom is a previously opened device */
/* Play the entire CD */
if(CD_INDRIVE(SDL_CDStatus(cdrom)))
  SDL_CDPlayTracks(cdrom, 0, 0, 0, 0);
/* Play the first track */
if(CD_INDRIVE(SDL_CDStatus(cdrom)))
  SDL_CDPlayTracks(cdrom, 0, 0, 1, 0);
/* Play first 15 seconds of the 2nd track */
if(CD_INDRIVE(SDL_CDStatus(cdrom)))
  SDL_CDPlayTracks(cdrom, 1, 0, 0, CD_FPS*15);
```

## SEE ALSO

**SDL\_CDPlay**, **SDL\_CDStatus**, **SDL\_CD**
