2002-07-22 22:41:32 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 by Linus Nielsen Feltzing
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* 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.
|
2002-07-22 22:41:32 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2003-04-23 11:26:25 +00:00
|
|
|
#include "string.h"
|
2002-07-22 22:41:32 +00:00
|
|
|
#include "lcd.h"
|
|
|
|
#include "debug.h"
|
|
|
|
#include "kernel.h"
|
|
|
|
#include "power.h"
|
|
|
|
#include "thread.h"
|
|
|
|
#include "settings.h"
|
|
|
|
#include "status.h"
|
2004-01-05 20:42:51 +00:00
|
|
|
#include "mp3_playback.h"
|
2005-04-04 12:06:29 +00:00
|
|
|
#include "audio.h"
|
2005-11-17 20:14:59 +00:00
|
|
|
#include "gwps.h"
|
2005-11-20 01:02:14 +00:00
|
|
|
#include "statusbar.h"
|
2007-03-16 23:47:03 +00:00
|
|
|
#if CONFIG_RTC
|
2003-01-27 14:24:40 +00:00
|
|
|
#include "timefuncs.h"
|
2002-08-30 00:58:55 +00:00
|
|
|
#endif
|
2002-08-07 10:35:26 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
#include "icons.h"
|
2003-11-04 13:17:29 +00:00
|
|
|
#include "font.h"
|
2002-08-07 10:35:26 +00:00
|
|
|
#endif
|
2002-08-07 11:41:31 +00:00
|
|
|
#include "powermgmt.h"
|
2005-02-19 00:34:15 +00:00
|
|
|
#include "led.h"
|
2005-04-01 13:41:03 +00:00
|
|
|
#include "sound.h"
|
2005-04-19 11:34:22 +00:00
|
|
|
#if CONFIG_KEYPAD == IRIVER_H100_PAD
|
|
|
|
#include "button.h"
|
|
|
|
#endif
|
2005-06-23 02:18:29 +00:00
|
|
|
#include "usb.h"
|
2007-02-18 02:04:47 +00:00
|
|
|
#if CONFIG_TUNER
|
2005-11-19 19:50:04 +00:00
|
|
|
#include "radio.h"
|
|
|
|
#endif
|
2006-11-06 18:07:30 +00:00
|
|
|
#if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC
|
2006-07-24 09:47:30 +00:00
|
|
|
#include "pcm_record.h"
|
|
|
|
#endif
|
2002-08-07 10:35:26 +00:00
|
|
|
|
2008-04-20 00:04:08 +00:00
|
|
|
static enum playmode ff_mode;
|
2002-07-22 22:41:32 +00:00
|
|
|
|
|
|
|
void status_init(void)
|
|
|
|
{
|
2004-06-27 01:05:40 +00:00
|
|
|
ff_mode = 0;
|
2002-07-22 22:41:32 +00:00
|
|
|
}
|
|
|
|
|
2004-06-27 01:05:40 +00:00
|
|
|
void status_set_ffmode(enum playmode mode)
|
2002-07-22 22:41:32 +00:00
|
|
|
{
|
2004-06-27 01:05:40 +00:00
|
|
|
ff_mode = mode; /* Either STATUS_FASTFORWARD or STATUS_FASTBACKWARD */
|
2002-07-22 22:41:32 +00:00
|
|
|
}
|
|
|
|
|
2005-08-21 19:17:50 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2004-06-27 01:05:40 +00:00
|
|
|
int current_playmode(void)
|
|
|
|
{
|
2005-04-04 12:06:29 +00:00
|
|
|
int audio_stat = audio_status();
|
2004-06-27 01:05:40 +00:00
|
|
|
|
|
|
|
/* ff_mode can be either STATUS_FASTFORWARD or STATUS_FASTBACKWARD
|
|
|
|
and that supercedes the other modes */
|
|
|
|
if(ff_mode)
|
|
|
|
return ff_mode;
|
|
|
|
|
2005-04-04 12:06:29 +00:00
|
|
|
if(audio_stat & AUDIO_STATUS_PLAY)
|
2004-06-27 01:05:40 +00:00
|
|
|
{
|
2005-04-04 12:06:29 +00:00
|
|
|
if(audio_stat & AUDIO_STATUS_PAUSE)
|
2004-06-27 01:05:40 +00:00
|
|
|
return STATUS_PAUSE;
|
|
|
|
else
|
|
|
|
return STATUS_PLAY;
|
|
|
|
}
|
2006-07-24 09:47:30 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_RECORDING
|
|
|
|
if(audio_stat & AUDIO_STATUS_RECORD)
|
2004-06-27 01:05:40 +00:00
|
|
|
{
|
2006-07-24 09:47:30 +00:00
|
|
|
if(audio_stat & AUDIO_STATUS_PAUSE)
|
|
|
|
return STATUS_RECORD_PAUSE;
|
|
|
|
else
|
|
|
|
return STATUS_RECORD;
|
2004-06-27 01:05:40 +00:00
|
|
|
}
|
|
|
|
#endif
|
2005-11-19 19:50:04 +00:00
|
|
|
|
2007-02-18 02:04:47 +00:00
|
|
|
#if CONFIG_TUNER
|
2007-02-08 10:36:49 +00:00
|
|
|
audio_stat = get_radio_status();
|
|
|
|
if(audio_stat & FMRADIO_PLAYING)
|
2005-11-19 20:45:32 +00:00
|
|
|
return STATUS_RADIO;
|
2005-11-19 19:50:04 +00:00
|
|
|
|
2007-02-08 10:36:49 +00:00
|
|
|
if(audio_stat & FMRADIO_PAUSED)
|
2005-11-19 20:45:32 +00:00
|
|
|
return STATUS_RADIO_PAUSE;
|
2005-11-19 19:50:04 +00:00
|
|
|
#endif
|
2004-06-27 01:05:40 +00:00
|
|
|
|
|
|
|
return STATUS_STOP;
|
|
|
|
}
|
|
|
|
|
2002-10-15 12:53:33 +00:00
|
|
|
#if defined(HAVE_LCD_CHARCELLS)
|
2005-10-28 00:00:00 +00:00
|
|
|
bool record = false;
|
|
|
|
bool audio = false;
|
|
|
|
bool param = false;
|
|
|
|
bool usb = false;
|
2002-10-15 12:53:33 +00:00
|
|
|
|
|
|
|
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 */
|