SDL_CDPlayTracks(3)

🌸 NAME 🌸

SDL_CDPlayTracks β€” bestie, this one plays the CD track(s) you tell it to πŸ’Ώβœ¨

This one lives in the SDL API Reference, section 3 of the manuals, and it's giving "let's put on some music" energy, fr fr.


✨ SYNOPSIS ✨

#include "SDL.h"

int SDL_CDPlayTracks(SDL_CD *cdrom, int start_track, int start_frame,
int ntracks, int nframes));

πŸ’– DESCRIPTION πŸ’–

Okay so SDL_CDPlayTracks plays the given CD starting at track start_track, for ntracks tracks. Slay. 🎢

start_frame is the frame offset, from the beginning of the start_track, at which to start. And nframes is the frame offset, from the beginning of the last track (start_track+ntracks), at which to end playing. Basically: where you start, and where you stop. Periodt. πŸ’…

And listen β€” you should only call SDL_CDPlayTracks after calling SDL_CDStatus to get track information about the CD. Do that first, no cap. Order matters bestie πŸ™ˆ

Note: Data tracks are ignored. Like, literally not even looked at. Bye πŸ’€

πŸŽ€ RETURN VALUE πŸŽ€

It returns 0, or -1 if there was an error. That's it, that's the whole vibe check. 🫢


πŸ¦‹ EXAMPLES πŸ¦‹

Here's the group chat receipts, copied exactly:

/* 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);

Look at that β€” whole CD, first track, or just the first 15 seconds of track 2. The range, the versatility, the main character energy πŸ‘‘βœ¨


πŸ”₯ SEE ALSO πŸ”₯

  • SDL_CDPlay
  • SDL_CDStatus
  • SDL_CD

Okay that's the whole page, bestie! This lil' cutie is from the SDL source, dated Tue 11 Sep 2001, 22:58, and it's filed under SDL_CDPlayTracks(3) in the SDL API Reference. Go play some tracks, you absolute icon πŸŽ€πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from