Lines 81-86
Link Here
|
81 |
|
81 |
|
82 |
#if defined(USE_SDLCD) |
82 |
#if defined(USE_SDLCD) |
83 |
#include "SDL.h" |
83 |
#include "SDL.h" |
|
|
84 |
#include "SDL_thread.h" |
84 |
#elif defined(USE_LIBCDA) |
85 |
#elif defined(USE_LIBCDA) |
85 |
#include "libcda.h" |
86 |
#include "libcda.h" |
86 |
#elif defined(USE_CDDA) |
87 |
#elif defined(USE_CDDA) |
Lines 108-113
Link Here
|
108 |
-- Variables |
109 |
-- Variables |
109 |
----------------------------------------------------------------------------*/ |
110 |
----------------------------------------------------------------------------*/ |
110 |
|
111 |
|
|
|
112 |
#ifdef USE_SDLCD |
113 |
global SDL_mutex *cdromcheck_mutex; // Make the CDRomCheck thread once |
114 |
global SDL_cond *cdromcheck_cond; // and use these three variables to |
115 |
global int cdromcheck_done = 0; // interact with it. |
116 |
#endif |
117 |
|
111 |
global int SoundFildes = -1; /// audio file descriptor |
118 |
global int SoundFildes = -1; /// audio file descriptor |
112 |
global int PlayingMusic; /// flag true if playing music |
119 |
global int PlayingMusic; /// flag true if playing music |
113 |
global int CallbackMusic; /// flag true callback ccl if stops |
120 |
global int CallbackMusic; /// flag true callback ccl if stops |
Lines 230-269
Link Here
|
230 |
global int CDRomCheck(void *unused __attribute__ ((unused))) |
237 |
global int CDRomCheck(void *unused __attribute__ ((unused))) |
231 |
{ |
238 |
{ |
232 |
#if defined(USE_SDLCD) |
239 |
#if defined(USE_SDLCD) |
233 |
if (CDMode != CDModeOff && CDMode != CDModeStopped |
240 |
SDL_mutexP(cdromcheck_mutex); |
234 |
&& SDL_CDStatus(CDRom) == 1) { |
241 |
while (!cdromcheck_done) |
235 |
DebugLevel0Fn("Playing new track\n"); |
242 |
{ |
236 |
if (CDMode == CDModeAll) { |
243 |
SDL_CondWait(cdromcheck_cond, cdromcheck_mutex); |
237 |
PlayCDRom(CDModeAll); |
244 |
if (CDMode != CDModeOff && CDMode != CDModeStopped |
238 |
} else if (CDMode == CDModeRandom) { |
245 |
&& SDL_CDStatus(CDRom) == 1) { |
239 |
PlayCDRom(CDModeRandom); |
246 |
DebugLevel0Fn("Playing new track\n"); |
240 |
} |
247 |
if (CDMode == CDModeAll) { |
241 |
} |
248 |
PlayCDRom(CDModeAll); |
|
|
249 |
} else if (CDMode == CDModeRandom) { |
250 |
PlayCDRom(CDModeRandom); |
251 |
} |
252 |
} |
242 |
#elif defined(USE_LIBCDA) |
253 |
#elif defined(USE_LIBCDA) |
243 |
if (CDMode != CDModeOff && CDMode != CDModeStopped |
254 |
if (CDMode != CDModeOff && CDMode != CDModeStopped |
244 |
&& !cd_current_track() && CDMode != CDModeDefined) { |
255 |
&& !cd_current_track() && CDMode != CDModeDefined) { |
245 |
DebugLevel0Fn("Playing new track\n"); |
256 |
DebugLevel0Fn("Playing new track\n"); |
246 |
PlayCDRom(CDMode); |
257 |
PlayCDRom(CDMode); |
247 |
} else if (CDMode != CDModeOff && CDMode != CDModeStopped) { |
258 |
} else if (CDMode != CDModeOff && CDMode != CDModeStopped) { |
248 |
if (CDMode == CDModeDefined) { |
259 |
if (CDMode == CDModeDefined) { |
249 |
PlayCDRom(CDMode); |
260 |
PlayCDRom(CDMode); |
250 |
} |
261 |
} |
251 |
DebugLevel0Fn("get track\n"); |
262 |
DebugLevel0Fn("get track\n"); |
252 |
CDTrack = cd_current_track() + 1; |
263 |
CDTrack = cd_current_track() + 1; |
253 |
if (CDTrack > NumCDTracks) { |
264 |
if (CDTrack > NumCDTracks) { |
254 |
CDTrack = 1; |
265 |
CDTrack = 1; |
255 |
} |
266 |
} |
256 |
} |
267 |
} |
257 |
#elif defined(USE_CDDA) |
268 |
#elif defined(USE_CDDA) |
258 |
if (CDMode != CDModeOff && CDMode != CDModeStopped |
269 |
if (CDMode != CDModeOff && CDMode != CDModeStopped |
259 |
&& !PlayingMusic) { |
270 |
&& !PlayingMusic) { |
260 |
DebugLevel0Fn("Playing new track\n"); |
271 |
DebugLevel0Fn("Playing new track\n"); |
261 |
if (CDMode == CDModeAll) { |
272 |
if (CDMode == CDModeAll) { |
262 |
PlayCDRom(CDModeAll); |
273 |
PlayCDRom(CDModeAll); |
263 |
} else if (CDMode == CDModeRandom) { |
274 |
} else if (CDMode == CDModeRandom) { |
264 |
PlayCDRom(CDModeRandom); |
275 |
PlayCDRom(CDModeRandom); |
265 |
} |
276 |
} |
|
|
277 |
} |
278 |
#endif |
279 |
#if defined(USE_SDLCD) |
266 |
} |
280 |
} |
|
|
281 |
SDL_mutexV(cdromcheck_mutex); |
267 |
#endif |
282 |
#endif |
268 |
return 0; |
283 |
return 0; |
269 |
} |
284 |
} |