andreas wrote:
Hello.
I’m not familiar with the SDL_CD-functions but please do tell which;
- version of SDL you are using
1.2.13
- what OS and version you are running
linux with kernel 2.6.24.4 with desktop kde-3.5.9
- are the cd-drives ide/sata/scsi
both ide: /dev/hda and /dev/hdc
Have you tried this on another platform/computer to see if the same error appears?
It’ s the only machine with 2 cd drives I own :-(.
But I tested it on my laptop with nearly identical installation, only difrference:
I use a laptop kernel and the cdrom is /dev/sr0 i.e. a sata device.
Results: SDL_CDNumDrives reports 1 drive, which is correct :-), but SDL_CDStatus reports: CD_STOPPED, while the CD is playing.
Could the KDE artsd daemon be the problem?
Ideally also a small snippet of code which demonstrates the calls and which people can quickly compile and try on their systems.
here it comes (I borrowed the whole thing from an internet SDL tutorial):
#include <SDL.h>
#include <stdlib.h>
#include <stdio.h>
int main(void) {
printf(“Initializing SDL.\n”);
if (SDL_Init(SDL_INIT_AUDIO|SDL_INIT_CDROM) < 0 ) {
printf(“Error: Could not initialize SDL: %s.\n”, SDL_GetError());
exit(-1);
}
atexit(SDL_Quit);
printf(“SDL initialized.\n”);
printf(“CD drive(s): available: %d\n”, SDL_CDNumDrives());
int i;
for ( i=0; i<SDL_CDNumDrives(); ++i ) {
printf(“Drive %d: “%s”\n”, i, SDL_CDName(i));
}
SDL_CD *cdrom;
CDstatus status;
char *status_str;
cdrom = SDL_CDOpen(0);
if ( cdrom == NULL ) {
fprintf(stderr, “Couldn’t open default CD drive: %s\n”, SDL_GetError());
exit(2);
}
status = SDL_CDStatus(cdrom);
switch (status) {
case CD_TRAYEMPTY:
status_str = “No CD.”;
break;
case CD_STOPPED:
status_str = “CD Stopped.”;
break;
case CD_PLAYING:
status_str = “CD Playing.”;
break;
case CD_PAUSED:
status_str = “CD Paused.”;
break;
case CD_ERROR:
status_str = “CD Error.”;
break;
}
printf(“Drive status: %s\n”, status_str);
if ( status >= CD_PLAYING ) {
int m, s, f;
FRAMES_TO_MSF(cdrom->cur_frame, &m, &s, &f);
printf(“Currently playing track %d, %d:%2.2d\n”,
cdrom->track[cdrom->cur_track].id, m, s);
}
return(0);
}
Thanks a lot for your help!
Gerd> Gerd Schering wrote:
Hi,
I’m new to SDL and I am not shure this is the wright list - but I didn’t
find any other.
My Problem:
SDL_CDNumDrives reports the wrong number of drives: just 1 instead of 2
SDL_CDStatus reports: CD_STOPPED, while the CD is playing.
I am shure, that it is the wright drive (the one with the CD in) because
when I take off the CD, CD_TRAYEMPTY is reported.
Any hints?
Gerd
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org