blob: fd89a85e4191fcf93a8495e927ff59a332a5536e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2002 by Linus Nielsen Feltzing
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include "string.h"
#include "lcd.h"
#include "debug.h"
#include "kernel.h"
#include "power.h"
#include "thread.h"
#include "settings.h"
#include "status.h"
#include "mp3_playback.h"
#include "audio.h"
#include "gwps.h"
#include "abrepeat.h"
#include "statusbar.h"
#if CONFIG_RTC
#include "timefuncs.h"
#endif
#ifdef HAVE_LCD_BITMAP
#include "icons.h"
#include "font.h"
#endif
#include "powermgmt.h"
#include "led.h"
#include "sound.h"
#if CONFIG_KEYPAD == IRIVER_H100_PAD
#include "button.h"
#endif
#include "usb.h"
#if CONFIG_TUNER
#include "radio.h"
#endif
#if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC
#include "pcm_record.h"
#endif
static enum playmode ff_mode;
void status_init(void)
{
ff_mode = 0;
}
void status_set_ffmode(enum playmode mode)
{
ff_mode = mode; /* Either STATUS_FASTFORWARD or STATUS_FASTBACKWARD */
}
enum playmode status_get_ffmode(void)
{
/* only use this function for STATUS_FASTFORWARD or STATUS_FASTBACKWARD */
/* use audio_status() for other modes */
return ff_mode;
}
int current_playmode(void)
{
int audio_stat = audio_status();
/* ff_mode can be either STATUS_FASTFORWARD or STATUS_FASTBACKWARD
and that supercedes the other modes */
if(ff_mode)
return ff_mode;
if(audio_stat & AUDIO_STATUS_PLAY)
{
if(audio_stat & AUDIO_STATUS_PAUSE)
return STATUS_PAUSE;
else
return STATUS_PLAY;
}
#ifdef HAVE_RECORDING
if(audio_stat & AUDIO_STATUS_RECORD)
{
if(audio_stat & AUDIO_STATUS_PAUSE)
return STATUS_RECORD_PAUSE;
else
return STATUS_RECORD;
}
#endif
#if CONFIG_TUNER
audio_stat = get_radio_status();
if(audio_stat & FMRADIO_PLAYING)
return STATUS_RADIO;
if(audio_stat & FMRADIO_PAUSED)
return STATUS_RADIO_PAUSE;
#endif
return STATUS_STOP;
}
#if defined(HAVE_LCD_CHARCELLS)
bool record = false;
bool audio = false;
bool param = false;
bool usb = false;
void status_set_record(bool b)
{
record = b;
}
void status_set_audio(bool b)
{
audio = b;
}
void status_set_param(bool b)
{
param = b;
}
void status_set_usb(bool b)
{
usb = b;
}
#endif /* HAVE_LCD_CHARCELLS */
|