Simplify conditions in the manual (should also be done for other features)
[kugel-rb/myfork.git] / apps / status.c
blob92f29c1b830596a8a87f8a357e4e5a7ee965b66f
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #include <string.h>
22 #include <stdbool.h>
23 #include "config.h"
24 #include "status.h"
25 #include "audio.h"
26 #if CONFIG_TUNER
27 #include "radio.h"
28 #endif
30 static enum playmode ff_mode;
32 void status_init(void)
34 ff_mode = 0;
37 void status_set_ffmode(enum playmode mode)
39 ff_mode = mode; /* Either STATUS_FASTFORWARD or STATUS_FASTBACKWARD */
42 enum playmode status_get_ffmode(void)
44 /* only use this function for STATUS_FASTFORWARD or STATUS_FASTBACKWARD */
45 /* use audio_status() for other modes */
46 return ff_mode;
49 int current_playmode(void)
51 int audio_stat = audio_status();
53 /* ff_mode can be either STATUS_FASTFORWARD or STATUS_FASTBACKWARD
54 and that supercedes the other modes */
55 if(ff_mode)
56 return ff_mode;
58 if(audio_stat & AUDIO_STATUS_PLAY)
60 if(audio_stat & AUDIO_STATUS_PAUSE)
61 return STATUS_PAUSE;
62 else
63 return STATUS_PLAY;
66 #ifdef HAVE_RECORDING
67 if(audio_stat & AUDIO_STATUS_RECORD)
69 if(audio_stat & AUDIO_STATUS_PAUSE)
70 return STATUS_RECORD_PAUSE;
71 else
72 return STATUS_RECORD;
74 #endif
76 #if CONFIG_TUNER
77 audio_stat = get_radio_status();
78 if(audio_stat & FMRADIO_PLAYING)
79 return STATUS_RADIO;
81 if(audio_stat & FMRADIO_PAUSED)
82 return STATUS_RADIO_PAUSE;
83 #endif
85 return STATUS_STOP;
88 #if defined(HAVE_LCD_CHARCELLS)
89 bool record = false;
90 bool audio = false;
91 bool param = false;
92 bool usb = false;
94 void status_set_record(bool b)
96 record = b;
99 void status_set_audio(bool b)
101 audio = b;
104 void status_set_param(bool b)
106 param = b;
109 void status_set_usb(bool b)
111 usb = b;
114 #endif /* HAVE_LCD_CHARCELLS */