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.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2009-05-17 11:56:06 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "config.h"
|
2002-07-22 22:41:32 +00:00
|
|
|
#include "status.h"
|
2005-04-04 12:06:29 +00:00
|
|
|
#include "audio.h"
|
2007-02-18 02:04:47 +00:00
|
|
|
#if CONFIG_TUNER
|
2005-11-19 19:50:04 +00:00
|
|
|
#include "radio.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 */
|