static void CDAudio_Eject() { if(!cd_id || !enabled) return; if(SDL_CDEject(cd_id)) Com_DPrintf("Unable to eject CD-ROM tray.\n"); }
int main(int argc, char **argv) { SDL_Init(SDL_INIT_CDROM); atexit(SDL_Quit); int ndrives = SDL_CDNumDrives(); if (ndrives == 0) { printf("Alas, no CD drives.\n"); } int drive_no; for (drive_no = 0; drive_no < ndrives; drive_no++) { SDL_CD *drive = SDL_CDOpen(drive_no); if (drive == NULL) { printf("Couldn't get drive %d.\n", drive_no); continue; } if (SDL_CDEject(drive)) { printf("Couldn't eject drive %d.\n", drive_no); } else { printf("Ping! (%d of %d)\n", drive_no + 1, ndrives); } SDL_CDClose(drive); } printf("Ejected everything.\n"); return 0; }
bool SDL::ejectCDTray() { SDL_CD* cdrom; if (SDL_CDNumDrives() <= 0) { Log::warning("SDL_CDNumDrives: No CD-ROM drives available"); return false; } // The system's default CD-ROM is always drive 0 cdrom = SDL_CDOpen(0); if (!cdrom) { Log::warning("SDL_CDOpen: Couldn't open default CD-ROM: " + std::string(SDL_GetError())); return false; } if (SDL_CDEject(cdrom) == -1) { SDL_CDClose(cdrom); return false; } else { SDL_CDClose(cdrom); return true; } }
static void CDAudio_Eject(void) { if (!cd_handle || !enabled) return; if (SDL_CDEject(cd_handle) < 0) Con_Printf ("Unable to eject CD-ROM: %s\n", SDL_GetError ()); }
void RBAEjectDisk() { if (!s_cd) return; SDL_CDEject(s_cd); // play nothing until it tries to load a song #if defined(__APPLE__) || defined(macintosh) SDL_QuitSubSystem(SDL_INIT_CDROM); // necessary for rescanning CDROMs #endif initialised = 0; }
/************************************************************************** * * function: I_EjectCD * * description: * * **************************************************************************/ static void I_EjectCD(void) { if (!cdrom || !cdEnabled) return; // no cd init'd I_StopCD(); if (SDL_CDEject(cdrom)) CONS_Printf("%s", M_GetText("CD eject failed\n")); }
static void I_EjectCD() { if (cdrom == NULL || !enabled) return; // no cd init'd I_StopCD(); if (SDL_CDEject(cdrom)) { CONS_Printf("cdrom eject failed\n"); } return; }
static PyObject* _cd_eject (PyObject *self) { SDL_CD *cd = ((PyCD*)self)->cd; ASSERT_CDROM_OPEN(self, NULL); if (SDL_CDEject (cd) == -1) { PyErr_SetString (PyExc_PyGameError, SDL_GetError ()); return NULL; } Py_RETURN_NONE; }
static int modcd_eject( INSTANCE * my, int * params ) { if ( params[0] < 0 || params[0] >= SDL_CDNumDrives() ) return 0; if ( sdl_cd == NULL || sdl_cdnum != params[0] ) { if ( sdl_cd ) SDL_CDClose( sdl_cd ); sdl_cd = SDL_CDOpen( params[0] ); if ( sdl_cd == NULL ) return 0; sdl_cdnum = params[0]; } return !SDL_CDEject( sdl_cd ); }
static PyObject* cd_eject (PyObject* self) { int cd_id = PyCD_AsID (self); SDL_CD* cdrom = cdrom_drivedata[cd_id]; int result; CDROM_INIT_CHECK (); if (!cdrom) { return RAISE (PyExc_SDLError, "CD drive not initialized"); } result = SDL_CDEject (cdrom); if (result == -1) { return RAISE (PyExc_SDLError, SDL_GetError ()); } Py_RETURN_NONE; }
int main(int argc, char *argv[]) { int drive; int i; SDL_CD *cdrom; /* Initialize SDL first */ if ( SDL_Init(SDL_INIT_CDROM) < 0 ) { fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError()); return(1); } /* Find out how many CD-ROM drives are connected to the system */ if ( SDL_CDNumDrives() == 0 ) { printf("No CD-ROM devices detected\n"); quit(0); } printf("Drives available: %d\n", SDL_CDNumDrives()); for ( i=0; i<SDL_CDNumDrives(); ++i ) { printf("Drive %d: \"%s\"\n", i, SDL_CDName(i)); } /* Open the CD-ROM */ drive = 0; i=1; if ( argv[i] && isdigit(argv[i][0]) ) { drive = atoi(argv[i++]); } cdrom = SDL_CDOpen(drive); if ( cdrom == NULL ) { fprintf(stderr, "Couldn't open drive %d: %s\n", drive, SDL_GetError()); quit(2); } #ifdef TEST_NULLCD cdrom = NULL; #endif /* Find out which function to perform */ for ( ; argv[i]; ++i ) { if ( strcmp(argv[i], "-status") == 0 ) { /* PrintStatus(drive, cdrom); */ } else if ( strcmp(argv[i], "-list") == 0 ) { ListTracks(cdrom); } else if ( strcmp(argv[i], "-play") == 0 ) { int strack, sframe; int ntrack, nframe; strack = 0; if ( argv[i+1] && isdigit(argv[i+1][0]) ) { strack = atoi(argv[++i]); } sframe = 0; if ( argv[i+1] && isdigit(argv[i+1][0]) ) { sframe = atoi(argv[++i]); } ntrack = 0; if ( argv[i+1] && isdigit(argv[i+1][0]) ) { ntrack = atoi(argv[++i]); } nframe = 0; if ( argv[i+1] && isdigit(argv[i+1][0]) ) { nframe = atoi(argv[++i]); } if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) { if ( SDL_CDPlayTracks(cdrom, strack, sframe, ntrack, nframe) < 0 ) { fprintf(stderr, "Couldn't play tracks %d/%d for %d/%d: %s\n", strack, sframe, ntrack, nframe, SDL_GetError()); } } else { fprintf(stderr, "No CD in drive!\n"); } } else if ( strcmp(argv[i], "-pause") == 0 ) { if ( SDL_CDPause(cdrom) < 0 ) { fprintf(stderr, "Couldn't pause CD: %s\n", SDL_GetError()); } } else if ( strcmp(argv[i], "-resume") == 0 ) { if ( SDL_CDResume(cdrom) < 0 ) { fprintf(stderr, "Couldn't resume CD: %s\n", SDL_GetError()); } } else if ( strcmp(argv[i], "-stop") == 0 ) { if ( SDL_CDStop(cdrom) < 0 ) { fprintf(stderr, "Couldn't eject CD: %s\n", SDL_GetError()); } } else if ( strcmp(argv[i], "-eject") == 0 ) { if ( SDL_CDEject(cdrom) < 0 ) { fprintf(stderr, "Couldn't eject CD: %s\n", SDL_GetError()); } } else if ( (strcmp(argv[i], "-sleep") == 0) && (argv[i+1] && isdigit(argv[i+1][0])) ) { SDL_Delay(atoi(argv[++i])); printf("Delayed %d milliseconds\n", atoi(argv[i])); } else { PrintUsage(argv[0]); SDL_CDClose(cdrom); quit(1); } } PrintStatus(drive, cdrom); SDL_CDClose(cdrom); SDL_Quit(); return(0); }
void CDAudio_SysEject (void) { SDL_CDEject( cd ); }
bool CDROM_Interface_SDL::LoadUnloadMedia(bool unload) { bool success = (SDL_CDEject(cd)==0); return success; };