Skip to content

Commit 03696c2

Browse files
committed
mp3player: use standard bool
1 parent cb1934c commit 03696c2

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

gc/mp3player.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
void MP3Player_Init(void);
1212
void MP3Player_Stop(void);
13-
BOOL MP3Player_IsPlaying(void);
13+
bool MP3Player_IsPlaying(void);
1414
void MP3Player_Volume(u32 volume);
1515
s32 MP3Player_PlayBuffer(const void *buffer,s32 len,void (*filterfunc)(struct mad_stream *,struct mad_frame *));
1616
s32 MP3Player_PlayFile(void *cb_data,s32 (*reader)(void *,void *,s32),void (*filterfunc)(struct mad_stream *,struct mad_frame *));

libmad/mp3player.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ static struct _outbuffer_s OutputRingBuffer;
7171
static u32 init_done = 0;
7272
static u32 CurrentBuffer = 0;
7373
static f32 VSA = (1.0/4294967295.0);
74-
static BOOL thr_running = FALSE;
75-
static BOOL MP3Playing = FALSE;
74+
static bool thr_running = false;
75+
static bool MP3Playing = false;
7676
static void *mp3cb_data = NULL;
7777

7878
static void* StreamPlay(void *);
@@ -231,7 +231,7 @@ void MP3Player_Init(void)
231231

232232
s32 MP3Player_PlayBuffer(const void *buffer,s32 len,void (*filterfunc)(struct mad_stream *,struct mad_frame *))
233233
{
234-
if(thr_running==TRUE) return -1;
234+
if(thr_running) return -1;
235235

236236
rambuffer.buf_addr = buffer;
237237
rambuffer.len = len;
@@ -248,7 +248,7 @@ s32 MP3Player_PlayBuffer(const void *buffer,s32 len,void (*filterfunc)(struct ma
248248

249249
s32 MP3Player_PlayFile(void *cb_data,s32 (*reader)(void *,void *,s32),void (*filterfunc)(struct mad_stream *,struct mad_frame *))
250250
{
251-
if(thr_running==TRUE) return -1;
251+
if(thr_running) return -1;
252252

253253
mp3cb_data = cb_data;
254254
mp3read = reader;
@@ -261,28 +261,28 @@ s32 MP3Player_PlayFile(void *cb_data,s32 (*reader)(void *,void *,s32),void (*fil
261261

262262
void MP3Player_Stop(void)
263263
{
264-
if(thr_running==FALSE) return;
264+
if(!thr_running) return;
265265

266-
thr_running = FALSE;
266+
thr_running = false;
267267
LWP_JoinThread(hStreamPlay,NULL);
268268
}
269269

270-
BOOL MP3Player_IsPlaying(void)
270+
bool MP3Player_IsPlaying(void)
271271
{
272272
return thr_running;
273273
}
274274

275275
static void *StreamPlay(void *arg)
276276
{
277-
BOOL atend;
277+
bool atend;
278278
u8 *GuardPtr = NULL;
279279
struct mad_stream Stream;
280280
struct mad_frame Frame;
281281
struct mad_synth Synth;
282282
mad_timer_t Timer;
283283
EQState eqs[2];
284284

285-
thr_running = TRUE;
285+
thr_running = true;
286286

287287
CurrentBuffer = 0;
288288
memset(OutputBuffer[0],0,ADMA_BUFFERSIZE);
@@ -303,9 +303,9 @@ static void *StreamPlay(void *arg)
303303
mad_synth_init(&Synth);
304304
mad_timer_reset(&Timer);
305305

306-
atend = FALSE;
307-
MP3Playing = FALSE;
308-
while(atend==FALSE && thr_running==TRUE) {
306+
atend = false;
307+
MP3Playing = false;
308+
while(!atend && thr_running) {
309309
if(Stream.buffer==NULL || Stream.error==MAD_ERROR_BUFLEN) {
310310
u8 *ReadStart;
311311
s32 ReadSize, Remaining;
@@ -327,14 +327,14 @@ static void *StreamPlay(void *arg)
327327
GuardPtr = ReadStart;
328328
memset(GuardPtr,0,MAD_BUFFER_GUARD);
329329
ReadSize = MAD_BUFFER_GUARD;
330-
atend = TRUE;
330+
atend = true;
331331
}
332332

333333
mad_stream_buffer(&Stream,InputBuffer,(ReadSize + Remaining));
334334
//Stream.error = 0;
335335
}
336336

337-
while (!mad_frame_decode(&Frame,&Stream) && thr_running==TRUE) {
337+
while (!mad_frame_decode(&Frame,&Stream) && thr_running) {
338338
if(mp3filterfunc)
339339
mp3filterfunc(&Stream,&Frame);
340340

@@ -357,7 +357,7 @@ static void *StreamPlay(void *arg)
357357
mad_frame_finish(&Frame);
358358
mad_stream_finish(&Stream);
359359

360-
while(MP3Playing==TRUE)
360+
while(MP3Playing)
361361
LWP_ThreadSleep(thQueue);
362362

363363
#ifndef __SNDLIB_H__
@@ -369,7 +369,7 @@ static void *StreamPlay(void *arg)
369369

370370
LWP_CloseQueue(thQueue);
371371

372-
thr_running = FALSE;
372+
thr_running = false;
373373

374374
return 0;
375375
}
@@ -452,7 +452,7 @@ static void DataTransferCallback(s32 voice)
452452
CurrentBuffer = (CurrentBuffer+1)%3;
453453
MP3Playing = (buf_get(&OutputRingBuffer,OutputBuffer[CurrentBuffer],ADMA_BUFFERSIZE)>0);
454454
#else
455-
if(thr_running!=TRUE) {
455+
if(!thr_running) {
456456
MP3Playing = (buf_get(&OutputRingBuffer,OutputBuffer[CurrentBuffer],ADMA_BUFFERSIZE)>0);
457457
return;
458458
}

0 commit comments

Comments
 (0)