SDL_CDPlayTracks function does it work?

SDL
Version :
#define SDL_MAJOR_VERSION 1
#define SDL_MINOR_VERSION 2
#define SDL_PATCHLEVEL 14

OS
Linux Arch
Kernel : 2.6.37-ARCH
Gnome : 2.32.1

Hello,

I’m newbie, i want create un little multimedia player with SDL lib
I can play ogg,mp3,wav :slight_smile: but i can’t use CDAudio

I use this program for exemple:

Code:

#include <stdlib.h>
#include <stdio.h>
#include “SDL.h”

SDL_CD *CDAudio = NULL;
int error = -2;

int main(int argc, char** argv)
{
if (SDL_Init(SDL_INIT_EVERYTHING) < 0) {
printf(“Erreur SDL INIT : %s\n”, SDL_GetError());
exit(EXIT_FAILURE);
}
else {
printf(“INIT SDL OK \n”);
if ( SDL_CDNumDrives() > 0 )
{
CDAudio = SDL_CDOpen(0);
if (CDAudio == NULL )
{
printf(“Can not open device %s\n”, SDL_GetError());
return EXIT_FAILURE;
}
else
{
printf(“Device OK \n”);
SDL_CDStatus(CDAudio);
if ( CD_INDRIVE(SDL_CDStatus(CDAudio)) )
{
if (CDAudio->track[1].type != SDL_AUDIO_TRACK) printf(“Not Audio track!”);
else
{
printf(“CDAUDIO in player \n”);
printf(“nb tracks : %d\n” , CDAudio->numtracks);
if ( SDL_CDStatus(CDAudio) == CD_TRAYEMPTY ) printf(“CDAUDIO tr \n”);
if ( SDL_CDStatus(CDAudio) == CD_ERROR ) printf(“CDAUDIO er \n”);
if ( SDL_CDStatus(CDAudio) == CD_PAUSED ) printf(“CDAUDIO pa \n”);
if ( SDL_CDStatus(CDAudio) == CD_STOPPED ) printf(“CDAUDIO STOPPED \n”);
// play track 1 and 2
error = SDL_CDPlayTracks(CDAudio, 1, 0, 3, 0);
printf(“is status Playing … ? %s\n”, SDL_GetError());
printf(“cde result : %d\n”, error);
if ( SDL_CDStatus(CDAudio) == CD_TRAYEMPTY ) printf(“CDAUDIO tr \n”);
if ( SDL_CDStatus(CDAudio) == CD_ERROR ) printf(“CDAUDIO er \n”);
if ( SDL_CDStatus(CDAudio) == CD_PAUSED ) printf(“CDAUDIO pa \n”);
if ( SDL_CDStatus(CDAudio) == CD_STOPPED ) printf(“CDAUDIO STOPPED \n”);
while ( SDL_CDStatus(CDAudio) == CD_PLAYING )
{
SDL_Delay(1000);
printf(“Read Track : %d\n” ,CDAudio->cur_track);
}
}
}
else
{
printf(“No CD - Empty \n”);
if ( SDL_CDStatus(CDAudio) == CD_TRAYEMPTY ) printf(“CDAUDIO tr \n”);
if ( SDL_CDStatus(CDAudio) == CD_ERROR ) printf(“CDAUDIO er \n”);
if ( SDL_CDStatus(CDAudio) == CD_PAUSED ) printf(“CDAUDIO pa \n”);
if ( SDL_CDStatus(CDAudio) == CD_STOPPED ) printf(“CDAUDIO STOPPED \n”);
}
}
}
}
return EXIT_SUCCESS;
}

it work fine detect device and cd … but don’t read

INIT SDL OK
Device OK
CDAUDIO in player
nb tracks : 14
CDAUDIO STOPPED
is status Playing … ?
cde result : 0
CDAUDIO STOPPED

SDL_CDPlayTracks function does it work ? where I make a mistake ?

Sorry for my bad english and thanks for your answers.

hello,

Under Xubuntu
I compiled the program and it works

Under Archlinux
This does not work

Maybe a problem with libsdl or the kernel.

I am not knowledgeable enough to tell where the problem comes.