summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-07-17 00:01:32 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-07-24 21:20:13 +0000
commit8cb555460ff79e636a7907fb2589e16db98c8600 (patch)
tree930a3878c7641c9ce045b24f0ade1309e36d5806 /apps
parent0c4f89370d05056faa789aa9cabcccc4e509fb9f (diff)
downloadrockbox-8cb555460f.tar.gz
rockbox-8cb555460f.tar.bz2
rockbox-8cb555460f.zip
[3/4] Completely remove HWCODEC support
'swcodec' is now always set (and recording_swcodec for recording-capable units) in feature.txt so the manual and language strings don't need to all be fixed up. Change-Id: Ib2c9d5d157af8d33653e2d4b4a12881b9aa6ddb0
Diffstat (limited to 'apps')
-rw-r--r--apps/SOURCES6
-rw-r--r--apps/abrepeat.c46
-rw-r--r--apps/abrepeat.h11
-rw-r--r--apps/action.c2
-rw-r--r--apps/bookmark.c27
-rw-r--r--apps/codecs.c1
-rw-r--r--apps/cuesheet.c6
-rw-r--r--apps/debug_menu.c50
-rw-r--r--apps/features.txt8
-rw-r--r--apps/filetypes.c7
-rw-r--r--apps/gui/list.c9
-rw-r--r--apps/gui/list.h2
-rw-r--r--apps/gui/pitchscreen.c78
-rw-r--r--apps/gui/skin_engine/skin_display.c2
-rw-r--r--apps/gui/skin_engine/skin_tokens.c39
-rw-r--r--apps/gui/splash.c2
-rw-r--r--apps/gui/statusbar.c49
-rw-r--r--apps/gui/wps.c128
-rw-r--r--apps/lang/english.lang51
-rw-r--r--apps/main.c49
-rw-r--r--apps/menu.c2
-rw-r--r--apps/menus/eq_menu.c1
-rw-r--r--apps/menus/menu_common.c5
-rw-r--r--apps/menus/menu_common.h2
-rw-r--r--apps/menus/playback_menu.c27
-rw-r--r--apps/menus/radio_menu.c18
-rw-r--r--apps/menus/recording_menu.c20
-rw-r--r--apps/menus/settings_menu.c10
-rw-r--r--apps/menus/sound_menu.c12
-rw-r--r--apps/misc.c31
-rw-r--r--apps/misc.h4
-rw-r--r--apps/mpeg.c1979
-rw-r--r--apps/mpeg.h28
-rw-r--r--apps/playback.h3
-rw-r--r--apps/playlist.c16
-rw-r--r--apps/playlist.h4
-rw-r--r--apps/plugin.c16
-rw-r--r--apps/plugin.h21
-rw-r--r--apps/plugins/SOURCES18
-rw-r--r--apps/plugins/SOURCES.app_build4
-rw-r--r--apps/plugins/SUBDIRS7
-rw-r--r--apps/plugins/SUBDIRS.app_build5
-rw-r--r--apps/plugins/bitmaps/mono/SOURCES2
-rw-r--r--apps/plugins/bitmaps/native/SOURCES2
-rw-r--r--apps/plugins/chip8.c47
-rw-r--r--apps/plugins/lua/rocklib.c6
-rw-r--r--apps/plugins/metronome.c194
-rw-r--r--apps/plugins/mpegplayer/mpeg_settings.c2
-rw-r--r--apps/plugins/oscilloscope.c8
-rw-r--r--apps/plugins/properties.c6
-rw-r--r--apps/plugins/rockboy/rbsound.c26
-rw-r--r--apps/plugins/splitedit.c1231
-rw-r--r--apps/plugins/starfield.c3
-rw-r--r--apps/plugins/vu_meter.c8
-rw-r--r--apps/plugins/zxbox/spmain.c4
-rw-r--r--apps/plugins/zxbox/zxbox.c4
-rw-r--r--apps/plugins/zxbox/zxconfig.h2
-rw-r--r--apps/radio/radio.c111
-rw-r--r--apps/radio/radio_skin.c5
-rw-r--r--apps/recorder/icons.c8
-rw-r--r--apps/recorder/icons.h7
-rw-r--r--apps/recorder/keyboard.c4
-rw-r--r--apps/recorder/peakmeter.c75
-rw-r--r--apps/recorder/recording.c78
-rw-r--r--apps/recorder/recording.h3
-rw-r--r--apps/screens.c9
-rw-r--r--apps/scrobbler.c2
-rw-r--r--apps/settings.c12
-rw-r--r--apps/settings.h29
-rw-r--r--apps/settings_list.c25
-rw-r--r--apps/tagcache.c4
-rw-r--r--apps/tagtree.c10
-rw-r--r--apps/talk.c105
-rw-r--r--apps/tree.c12
74 files changed, 62 insertions, 4788 deletions
diff --git a/apps/SOURCES b/apps/SOURCES
index 6a0b817834..d7cec53506 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -19,7 +19,6 @@ menus/plugin_menu.c
#if CONFIG_TUNER
menus/radio_menu.c
#endif
-#if CONFIG_CODEC == SWCODEC
#ifdef HAVE_WM8978
menus/audiohw_eq_menu.c
#endif
@@ -27,9 +26,6 @@ menus/eq_menu.c
buffering.c
voice_thread.c
rbcodec_helpers.c
-#else /* !SWCODEC */
-mpeg.c
-#endif
menus/main_menu.c
menus/playback_menu.c
menus/playlist_menu.c
@@ -163,7 +159,6 @@ radio/radioart.c
#endif
#endif
-#if CONFIG_CODEC == SWCODEC
#if INPUT_SRC_CAPS != 0
audio_path.c
#endif /* INPUT_SRC_CAPS != 0 */
@@ -179,7 +174,6 @@ beep.c
enc_config.c
recorder/pcm_record.c
#endif
-#endif
#ifdef USB_ENABLE_HID
usb_keymaps.c
#endif
diff --git a/apps/abrepeat.c b/apps/abrepeat.c
index 999d9dcf38..19e9450c99 100644
--- a/apps/abrepeat.c
+++ b/apps/abrepeat.c
@@ -39,7 +39,6 @@ static inline bool ab_B_marker_set(void)
}
-#if (CONFIG_CODEC == SWCODEC)
void ab_end_of_track_report(void)
{
if ( ab_A_marker_set() && ! ab_B_marker_set() )
@@ -47,38 +46,6 @@ void ab_end_of_track_report(void)
ab_jump_to_A_marker();
}
}
-#else
-static int ab_audio_event_handler(unsigned short event, unsigned long data)
-{
- int rc = AUDIO_EVENT_RC_IGNORED;
- if ( ab_repeat_mode_enabled() )
- {
- switch(event)
- {
- case AUDIO_EVENT_POS_REPORT:
- {
- if ( ! (audio_status() & AUDIO_STATUS_PAUSE) &&
- ab_reached_B_marker(data) )
- {
- ab_jump_to_A_marker();
- rc = AUDIO_EVENT_RC_HANDLED;
- }
- break;
- }
- case AUDIO_EVENT_END_OF_TRACK:
- {
- if ( ab_A_marker_set() && ! ab_B_marker_set() )
- {
- ab_jump_to_A_marker();
- rc = AUDIO_EVENT_RC_HANDLED;
- }
- break;
- }
- }
- }
- return rc;
-}
-#endif
void ab_repeat_init(void)
{
@@ -86,10 +53,6 @@ void ab_repeat_init(void)
if ( ! ab_initialized )
{
ab_initialized = true;
-#if (CONFIG_CODEC != SWCODEC)
- audio_register_event_handler(ab_audio_event_handler,
- AUDIO_EVENT_POS_REPORT | AUDIO_EVENT_END_OF_TRACK );
-#endif
}
}
@@ -116,16 +79,7 @@ reasonable amount of time for the typical user to react */
void ab_jump_to_A_marker(void)
{
-#if (CONFIG_CODEC != SWCODEC)
- bool paused = (audio_status() & AUDIO_STATUS_PAUSE) != 0;
- if ( ! paused )
- audio_pause();
-#endif
audio_ff_rewind(ab_A_marker);
-#if (CONFIG_CODEC != SWCODEC)
- if ( ! paused )
- audio_resume();
-#endif
}
void ab_reset_markers(void)
diff --git a/apps/abrepeat.h b/apps/abrepeat.h
index ec0a07c827..f7ee65247c 100644
--- a/apps/abrepeat.h
+++ b/apps/abrepeat.h
@@ -41,9 +41,7 @@ void ab_set_B_marker(unsigned int song_position);
* The actual positions are returned via output parameter */
bool ab_get_A_marker(unsigned int *song_position);
bool ab_get_B_marker(unsigned int *song_position);
-#if (CONFIG_CODEC == SWCODEC)
void ab_end_of_track_report(void);
-#endif
/* These functions really need to be inlined for speed */
extern unsigned int ab_A_marker;
@@ -59,16 +57,9 @@ static inline bool ab_reached_B_marker(unsigned int song_position)
/* following is the size of the window in which we'll detect that the B marker
was hit; it must be larger than the frequency (in milliseconds) at which this
function is called otherwise detection of the B marker will be unreliable */
-#if (CONFIG_CODEC == SWCODEC)
/* On swcodec, the worst case seems to be 9600kHz with 1024 samples between
* calls, meaning ~9 calls per second, look within 1/5 of a second */
#define B_MARKER_DETECT_WINDOW 200
-#else
-/* we assume that this function will be called on each system tick and derive
-the window size from this with a generous margin of error (note: the number
-of ticks per second is given by HZ) */
-#define B_MARKER_DETECT_WINDOW ((1000/HZ)*10)
-#endif
if (ab_B_marker != AB_MARKER_NONE)
{
if ( (song_position >= ab_B_marker)
@@ -78,7 +69,6 @@ of ticks per second is given by HZ) */
return false;
}
-#if (CONFIG_CODEC == SWCODEC)
static inline void ab_position_report(unsigned long position)
{
if (ab_repeat_mode_enabled())
@@ -90,7 +80,6 @@ static inline void ab_position_report(unsigned long position)
}
}
}
-#endif
#endif
diff --git a/apps/action.c b/apps/action.c
index f92b84d105..2aee56ee04 100644
--- a/apps/action.c
+++ b/apps/action.c
@@ -832,10 +832,8 @@ static inline int update_action_last(action_last_t *last, action_cur_t *cur)
last->data = button_get_data();
last->tick = current_tick;
-#if CONFIG_CODEC == SWCODEC
/* Produce keyclick */
keyclick_click(false, action);
-#endif
return action;
}
diff --git a/apps/bookmark.c b/apps/bookmark.c
index b19841fda0..22dfad6cce 100644
--- a/apps/bookmark.c
+++ b/apps/bookmark.c
@@ -183,13 +183,6 @@ bool bookmark_autobookmark(bool prompt_ok)
audio_pause(); /* first pause playback */
update = (global_settings.autoupdatebookmark && bookmark_exists());
bookmark = create_bookmark();
-#if CONFIG_CODEC != SWCODEC
- /* Workaround for inability to speak when paused: all callers will
- just do audio_stop() when we return, so we can do it right
- away. This makes it possible to speak the "Create a Bookmark?"
- prompt and the "Bookmark Created" splash. */
- audio_stop();
-#endif
if (update)
return write_bookmark(true, bookmark);
@@ -415,13 +408,13 @@ static char* create_bookmark()
snprintf(global_bookmark, sizeof(global_bookmark),
/* new optional bookmark token descriptors should be inserted
just before the "%s;%s" in this line... */
-#if CONFIG_CODEC == SWCODEC && defined(HAVE_PITCHCONTROL)
+#if defined(HAVE_PITCHCONTROL)
">%d;%d;%ld;%d;%ld;%d;%d;%ld;%ld;%s;%s",
#else
">%d;%d;%ld;%d;%ld;%d;%d;%s;%s",
#endif
/* ... their flags should go here ... */
-#if CONFIG_CODEC == SWCODEC && defined(HAVE_PITCHCONTROL)
+#if defined(HAVE_PITCHCONTROL)
BM_PITCH | BM_SPEED,
#else
0,
@@ -433,7 +426,7 @@ static char* create_bookmark()
global_settings.repeat_mode,
global_settings.playlist_shuffle,
/* ...and their values should go here */
-#if CONFIG_CODEC == SWCODEC && defined(HAVE_PITCHCONTROL)
+#if defined(HAVE_PITCHCONTROL)
(long)sound_get_pitch(),
(long)dsp_get_timestretch(),
#endif
@@ -950,7 +943,6 @@ static void say_bookmark(const char* bookmark,
talk_number(bookmark_id + 1, false);
-#if CONFIG_CODEC == SWCODEC
bool is_dir = (global_temp_buffer[0]
&& global_temp_buffer[strlen(global_temp_buffer)-1] == '/');
@@ -965,9 +957,6 @@ static void say_bookmark(const char* bookmark,
else talk_file_or_spell(NULL, global_temp_buffer,
TALK_IDARRAY(LANG_PLAYLIST), true);
}
-#else
- (void)show_playlist_name;
-#endif
if(bm.shuffle)
talk_id(LANG_SHUFFLE, true);
@@ -977,13 +966,11 @@ static void say_bookmark(const char* bookmark,
talk_id(LANG_TIME, true);
talk_value(bm.resume_time / 1000, UNIT_TIME, true);
-#if CONFIG_CODEC == SWCODEC
/* Track filename */
if(!is_dir)
global_temp_buffer[0] = 0;
talk_file_or_spell(global_temp_buffer, global_filename,
TALK_IDARRAY(VOICE_FILE), true);
-#endif
}
/* ----------------------------------------------------------------------- */
@@ -992,17 +979,17 @@ static void say_bookmark(const char* bookmark,
/* ------------------------------------------------------------------------*/
static bool play_bookmark(const char* bookmark)
{
-#if CONFIG_CODEC == SWCODEC && defined(HAVE_PITCHCONTROL)
+#if defined(HAVE_PITCHCONTROL)
/* preset pitch and speed to 100% in case bookmark doesn't have info */
bm.pitch = sound_get_pitch();
bm.speed = dsp_get_timestretch();
#endif
-
+
if (parse_bookmark(bookmark, true, true))
{
global_settings.repeat_mode = bm.repeat_mode;
global_settings.playlist_shuffle = bm.shuffle;
-#if CONFIG_CODEC == SWCODEC && defined(HAVE_PITCHCONTROL)
+#if defined(HAVE_PITCHCONTROL)
sound_set_pitch(bm.pitch);
dsp_set_timestretch(bm.speed);
#endif
@@ -1011,7 +998,7 @@ static bool play_bookmark(const char* bookmark)
return bookmark_play(global_temp_buffer, bm.resume_index,
bm.resume_time, bm.resume_offset, bm.resume_seed, global_filename);
}
-
+
return false;
}
diff --git a/apps/codecs.c b/apps/codecs.c
index cabc9ba993..4d2dd34ce0 100644
--- a/apps/codecs.c
+++ b/apps/codecs.c
@@ -40,7 +40,6 @@
#include "lang.h"
#include "keyboard.h"
#include "buffering.h"
-#include "mp3_playback.h"
#include "backlight.h"
#include "storage.h"
#include "talk.h"
diff --git a/apps/cuesheet.c b/apps/cuesheet.c
index 24df4d49da..39152185e5 100644
--- a/apps/cuesheet.c
+++ b/apps/cuesheet.c
@@ -313,14 +313,8 @@ static bool seek(unsigned long pos)
}
else
{
-#if (CONFIG_CODEC == SWCODEC)
audio_pre_ff_rewind();
audio_ff_rewind(pos);
-#else
- audio_pause();
- audio_ff_rewind(pos);
- audio_resume();
-#endif
return true;
}
}
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 8913558e6c..92451f284c 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -37,7 +37,6 @@
#include "system.h"
#include "font.h"
#include "audio.h"
-#include "mp3_playback.h"
#include "settings.h"
#include "list.h"
#include "statusbar.h"
@@ -88,14 +87,12 @@
#endif
#include "logfdisp.h"
#include "core_alloc.h"
-#if CONFIG_CODEC == SWCODEC
#include "pcmbuf.h"
#include "buffering.h"
#include "playback.h"
#if defined(HAVE_SPDIF_OUT) || defined(HAVE_SPDIF_IN)
#include "spdif.h"
#endif
-#endif
#ifdef IRIVER_H300_SERIES
#include "pcf50606.h" /* for pcf50606_read */
#endif
@@ -304,48 +301,6 @@ static bool dbg_cpuinfo(void)
#endif
#ifdef HAVE_LCD_BITMAP
-#if CONFIG_CODEC != SWCODEC
-#ifndef SIMULATOR
-static bool dbg_audio_thread(void)
-{
- struct audio_debug d;
-
- lcd_setfont(FONT_SYSFIXED);
-
- while(1)
- {
- if (action_userabort(HZ/5))
- return false;
-
- audio_get_debugdata(&d);
-
- lcd_clear_display();
-
- lcd_putsf(0, 0, "read: %x", d.audiobuf_read);
- lcd_putsf(0, 1, "write: %x", d.audiobuf_write);
- lcd_putsf(0, 2, "swap: %x", d.audiobuf_swapwrite);
- lcd_putsf(0, 3, "playing: %d", d.playing);
- lcd_putsf(0, 4, "playable: %x", d.playable_space);
- lcd_putsf(0, 5, "unswapped: %x", d.unswapped_space);
-
- /* Playable space left */
- gui_scrollbar_draw(&screens[SCREEN_MAIN],0, 6*8, 112, 4, d.audiobuflen, 0,
- d.playable_space, HORIZONTAL);
-
- /* Show the watermark limit */
- gui_scrollbar_draw(&screens[SCREEN_MAIN],0, 6*8+4, 112, 4, d.audiobuflen, 0,
- d.low_watermark_level, HORIZONTAL);
-
- lcd_putsf(0, 7, "wm: %x - %x",
- d.low_watermark_level, d.lowest_watermark_level);
-
- lcd_update();
- }
- lcd_setfont(FONT_UI);
- return false;
-}
-#endif /* !SIMULATOR */
-#else /* CONFIG_CODEC == SWCODEC */
static unsigned int ticks, freq_sum;
#ifndef CPU_MULTI_FREQUENCY
static unsigned int boost_ticks;
@@ -487,7 +442,6 @@ static bool dbg_buffering_thread(void)
return false;
}
-#endif /* CONFIG_CODEC */
#endif /* HAVE_LCD_BITMAP */
static const char* bf_getname(int selected_item, void *data,
@@ -2606,11 +2560,7 @@ static const struct {
{ "View database info", dbg_tagcache_info },
#endif
#ifdef HAVE_LCD_BITMAP
-#if CONFIG_CODEC == SWCODEC
{ "View buffering thread", dbg_buffering_thread },
-#elif !defined(SIMULATOR)
- { "View audio thread", dbg_audio_thread },
-#endif
#ifdef PM_DEBUG
{ "pm histogram", peak_meter_histogram},
#endif /* PM_DEBUG */
diff --git a/apps/features.txt b/apps/features.txt
index 1c942a7fe2..657b799345 100644
--- a/apps/features.txt
+++ b/apps/features.txt
@@ -109,11 +109,7 @@ radio_remote
#if defined(HAVE_RECORDING)
recording
-#if CONFIG_CODEC == SWCODEC
recording_swcodec
-#else
-recording_hwcodec
-#endif
#if defined(HAVE_LINE_IN)
recording_linein
#endif
@@ -151,11 +147,7 @@ spdif_power
speaker
#endif
-#if CONFIG_CODEC == SWCODEC
swcodec
-#else
-hwcodec
-#endif
#if defined(HAVE_TAGCACHE)
tagcache
diff --git a/apps/filetypes.c b/apps/filetypes.c
index a30f012e53..9abcfec884 100644
--- a/apps/filetypes.c
+++ b/apps/filetypes.c
@@ -41,11 +41,7 @@
#include "logf.h"
/* max filetypes (plugins & icons stored here) */
-#if CONFIG_CODEC == SWCODEC
#define MAX_FILETYPES 192
-#else
-#define MAX_FILETYPES 128
-#endif
/* max viewer plugins */
#ifdef HAVE_LCD_BITMAP
#define MAX_VIEWERS 56
@@ -58,8 +54,6 @@ static const struct filetype inbuilt_filetypes[] = {
{ "mp3", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA },
{ "mp2", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA },
{ "mpa", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA },
-#if CONFIG_CODEC == SWCODEC
- /* Temporary hack to allow playlist creation */
{ "mp1", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA },
{ "ogg", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA },
{ "oga", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA },
@@ -121,7 +115,6 @@ static const struct filetype inbuilt_filetypes[] = {
{ "vgz", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA },
{ "kss", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA },
{ "aac", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA },
-#endif
{ "m3u", FILE_ATTR_M3U, Icon_Playlist, LANG_PLAYLIST },
{ "m3u8",FILE_ATTR_M3U, Icon_Playlist, LANG_PLAYLIST },
{ "cfg", FILE_ATTR_CFG, Icon_Config, VOICE_EXT_CFG },
diff --git a/apps/gui/list.c b/apps/gui/list.c
index ce444cc9c2..b1120aa794 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -317,10 +317,6 @@ static void gui_list_put_selection_on_screen(struct gui_synclist * gui_list,
static void edge_beep(struct gui_synclist * gui_list, bool wrap)
{
-#if CONFIG_CODEC != SWCODEC
- (void)gui_list;
- (void)wrap;
-#else
if (global_settings.keyclick)
{
list_speak_item *cb = gui_list->callback_speak_item;
@@ -354,7 +350,6 @@ static void edge_beep(struct gui_synclist * gui_list, bool wrap)
talk_force_shutup();
}
}
-#endif
}
static void _gui_synclist_speak_item(struct gui_synclist *lists)
@@ -615,7 +610,6 @@ static void gui_synclist_scroll_left(struct gui_synclist * lists)
}
#endif /* HAVE_LCD_BITMAP */
-#if CONFIG_CODEC == SWCODEC
bool gui_synclist_keyclick_callback(int action, void* data)
{
struct gui_synclist *lists = (struct gui_synclist *)data;
@@ -633,7 +627,6 @@ bool gui_synclist_keyclick_callback(int action, void* data)
return action != ACTION_NONE;
}
-#endif
/*
* Magic to make sure the list gets updated correctly if the skin does
@@ -864,9 +857,7 @@ bool list_do_action(int context, int timeout,
do_button, and places the action from get_action in *action. */
{
timeout = list_do_action_timeout(lists, timeout);
-#if CONFIG_CODEC == SWCODEC
keyclick_set_callback(gui_synclist_keyclick_callback, lists);
-#endif
*action = get_action(context, timeout);
return gui_synclist_do_button(lists, action, wrap);
}
diff --git a/apps/gui/list.h b/apps/gui/list.h
index 1be9da496a..9107bf0591 100644
--- a/apps/gui/list.h
+++ b/apps/gui/list.h
@@ -170,9 +170,7 @@ extern void gui_synclist_hide_selection_marker(struct gui_synclist *lists,
extern bool gui_synclist_item_is_onscreen(struct gui_synclist *lists,
enum screen_type screen, int item);
-#if CONFIG_CODEC == SWCODEC
extern bool gui_synclist_keyclick_callback(int action, void* data);
-#endif
/*
* Do the action implied by the given button,
* returns true if the action was handled.
diff --git a/apps/gui/pitchscreen.c b/apps/gui/pitchscreen.c
index bf016fdd5f..0d31193fa6 100644
--- a/apps/gui/pitchscreen.c
+++ b/apps/gui/pitchscreen.c
@@ -38,9 +38,7 @@
#include "misc.h"
#include "pitchscreen.h"
#include "settings.h"
-#if CONFIG_CODEC == SWCODEC
#include "tdspeed.h"
-#endif
#define ICON_BORDER 12 /* icons are currently 7x8, so add ~2 pixels */
/* on both sides when drawing */
@@ -167,13 +165,9 @@ static bool at_limit = false;
static void speak_pitch_mode(bool enqueue)
{
-#if CONFIG_CODEC == SWCODEC
bool timestretch_mode = global_settings.pitch_mode_timestretch && dsp_timestretch_available();
if (timestretch_mode)
talk_id(VOICE_PITCH_TIMESTRETCH_MODE, enqueue);
-#else
-#define timestretch_mode 0
-#endif
if (global_settings.pitch_mode_semitone)
talk_id(VOICE_PITCH_SEMITONE_MODE, timestretch_mode ? true : enqueue);
else
@@ -238,9 +232,7 @@ static void pitchscreen_draw_icons(struct screen *display,
static void pitchscreen_draw(struct screen *display, int max_lines,
struct viewport pitch_viewports[PITCH_ITEM_COUNT],
int32_t pitch, int32_t semitone
-#if CONFIG_CODEC == SWCODEC
,int32_t speed
-#endif
)
{
const char* ptr;
@@ -308,7 +300,6 @@ static void pitchscreen_draw(struct screen *display, int max_lines,
/* Middle section upper line - hide for a small screen */
if ((show_lang_pitch = (max_lines >= 3)))
{
-#if CONFIG_CODEC == SWCODEC
if(global_settings.pitch_mode_timestretch)
{
/* Pitch:XXX.X% */
@@ -330,7 +321,6 @@ static void pitchscreen_draw(struct screen *display, int max_lines,
}
}
else
-#endif
{
/* Rate */
snprintf(buf, sizeof(buf), "%s:", str(LANG_PLAYBACK_RATE));
@@ -344,7 +334,6 @@ static void pitchscreen_draw(struct screen *display, int max_lines,
/* Middle section lower line */
/* "Speed:XXX%" */
-#if CONFIG_CODEC == SWCODEC
if(global_settings.pitch_mode_timestretch)
{
snprintf(buf, sizeof(buf), "%s: %ld.%ld%%", str(LANG_SPEED),
@@ -352,7 +341,6 @@ static void pitchscreen_draw(struct screen *display, int max_lines,
(speed % PITCH_SPEED_PRECISION) / (PITCH_SPEED_PRECISION / 10));
}
else
-#endif
{
if(global_settings.pitch_mode_semitone)
{
@@ -396,13 +384,11 @@ static void pitchscreen_draw(struct screen *display, int max_lines,
/* Middle section left/right labels */
const char *leftlabel = "-2%";
const char *rightlabel = "+2%";
-#if CONFIG_CODEC == SWCODEC
if (global_settings.pitch_mode_timestretch)
{
leftlabel = "<<";
rightlabel = ">>";
}
-#endif
/* Only display if they fit */
display->getstringsize(leftlabel, &w, &h);
@@ -423,16 +409,12 @@ static void pitchscreen_draw(struct screen *display, int max_lines,
}
static int32_t pitch_increase(int32_t pitch, int32_t pitch_delta, bool allow_cutoff
-#if CONFIG_CODEC == SWCODEC
/* need this to maintain correct pitch/speed caps */
, int32_t speed
-#endif
)
{
int32_t new_pitch;
-#if CONFIG_CODEC == SWCODEC
int32_t new_stretch;
-#endif
at_limit = false;
if (pitch_delta < 0)
@@ -480,7 +462,6 @@ static int32_t pitch_increase(int32_t pitch, int32_t pitch_delta, bool allow_cut
/* pitch_delta == 0 -> no real change */
return pitch;
}
-#if CONFIG_CODEC == SWCODEC
if (dsp_timestretch_available())
{
/* increase the multiple to increase precision of this calculation */
@@ -504,7 +485,6 @@ static int32_t pitch_increase(int32_t pitch, int32_t pitch_delta, bool allow_cut
at_limit = true;
}
}
-#endif
sound_set_pitch(new_pitch);
@@ -579,9 +559,7 @@ static int32_t get_pitch_from_semitone(int32_t semitone)
static int32_t pitch_increase_semitone(int32_t pitch,
int32_t current_semitone,
int32_t semitone_delta
-#if CONFIG_CODEC == SWCODEC
, int32_t speed
-#endif
)
{
int32_t new_semitone = current_semitone;
@@ -613,7 +591,6 @@ static int32_t pitch_increase_semitone(int32_t pitch,
int32_t new_pitch = get_pitch_from_semitone(new_semitone);
-#if CONFIG_CODEC == SWCODEC
int32_t new_stretch = GET_STRETCH(new_pitch, speed);
/* clamp the pitch so it doesn't go beyond the stretch limits */
@@ -629,12 +606,9 @@ static int32_t pitch_increase_semitone(int32_t pitch,
new_semitone = get_semitone_from_pitch(new_pitch);
at_limit = true;
}
-#endif
pitch_increase(pitch, new_pitch - pitch, false
-#if CONFIG_CODEC == SWCODEC
, speed
-#endif
);
return new_semitone;
@@ -765,7 +739,6 @@ int gui_syncpitchscreen_run(void)
push_current_activity(ACTIVITY_PITCHSCREEN);
-#if CONFIG_CODEC == SWCODEC
int32_t new_speed = 0, new_stretch;
/* the speed variable holds the apparent speed of the playback */
@@ -785,7 +758,6 @@ int gui_syncpitchscreen_run(void)
global_settings.pitch_mode_timestretch = false;
settings_save();
}
-#endif
/* Count decimals for speaking */
for (i = PITCH_SPEED_PRECISION; i >= 10; i /= 10)
@@ -806,23 +778,17 @@ int gui_syncpitchscreen_run(void)
/* also, draw the icons now, it's only needed once */
pitchscreen_draw_icons(&screens[i], &parent[i]);
}
-#if CONFIG_CODEC == SWCODEC
pcmbuf_set_low_latency(true);
-#endif
while (!exit)
{
FOR_NB_SCREENS(i)
pitchscreen_draw(&screens[i], max_lines[i],
pitch_viewports[i], pitch, semitone
-#if CONFIG_CODEC == SWCODEC
, speed
-#endif
);
pitch_delta = 0;
-#if CONFIG_CODEC == SWCODEC
new_speed = 0;
-#endif
if (global_settings.talk_menu && updated)
{
@@ -835,29 +801,23 @@ int gui_syncpitchscreen_run(void)
else
talk_value_decimal(pitch, UNIT_PERCENT, decimals, false);
break;
-#if CONFIG_CODEC == SWCODEC
case 2:
talk_value_decimal(speed, UNIT_PERCENT, decimals, false);
break;
-#endif
case 3:
speak_pitch_mode(false);
break;
case 4:
-#if CONFIG_CODEC == SWCODEC
if (global_settings.pitch_mode_timestretch && dsp_timestretch_available())
talk_id(LANG_PITCH, false);
else
-#endif
talk_id(LANG_PLAYBACK_RATE, false);
talk_value_decimal(pitch, UNIT_PERCENT, decimals, true);
-#if CONFIG_CODEC == SWCODEC
if (global_settings.pitch_mode_timestretch && dsp_timestretch_available())
{
talk_id(LANG_SPEED, true);
talk_value_decimal(speed, UNIT_PERCENT, decimals, true);
}
-#endif
speak_pitch_mode(true);
break;
default:
@@ -910,24 +870,17 @@ int gui_syncpitchscreen_run(void)
break;
case ACTION_PS_NUDGE_RIGHT:
-#if CONFIG_CODEC == SWCODEC
if (!global_settings.pitch_mode_timestretch)
{
-#endif
new_pitch = pitch_increase(pitch, PITCH_NUDGE_DELTA, false
-#if CONFIG_CODEC == SWCODEC
, speed
-#endif
);
nudged = (new_pitch != pitch);
pitch = new_pitch;
semitone = get_semitone_from_pitch(pitch);
-#if CONFIG_CODEC == SWCODEC
speed = pitch;
-#endif
updated = nudged ? 1 : 0;
break;
-#if CONFIG_CODEC == SWCODEC
}
else
{
@@ -948,19 +901,14 @@ int gui_syncpitchscreen_run(void)
updated = 2;
}
break;
-#endif
case ACTION_PS_NUDGE_RIGHTOFF:
if (nudged)
{
pitch = pitch_increase(pitch, -PITCH_NUDGE_DELTA, false
-#if CONFIG_CODEC == SWCODEC
, speed
-#endif
);
-#if CONFIG_CODEC == SWCODEC
speed = pitch;
-#endif
semitone = get_semitone_from_pitch(pitch);
nudged = false;
updated = 1;
@@ -968,24 +916,17 @@ int gui_syncpitchscreen_run(void)
break;
case ACTION_PS_NUDGE_LEFT:
-#if CONFIG_CODEC == SWCODEC
if (!global_settings.pitch_mode_timestretch)
{
-#endif
new_pitch = pitch_increase(pitch, -PITCH_NUDGE_DELTA, false
-#if CONFIG_CODEC == SWCODEC
, speed
-#endif
);
nudged = (new_pitch != pitch);
pitch = new_pitch;
semitone = get_semitone_from_pitch(pitch);
-#if CONFIG_CODEC == SWCODEC
speed = pitch;
-#endif
updated = nudged ? 1 : 0;
break;
-#if CONFIG_CODEC == SWCODEC
}
else
{
@@ -1006,19 +947,14 @@ int gui_syncpitchscreen_run(void)
updated = 2;
}
break;
-#endif
case ACTION_PS_NUDGE_LEFTOFF:
if (nudged)
{
pitch = pitch_increase(pitch, PITCH_NUDGE_DELTA, false
-#if CONFIG_CODEC == SWCODEC
, speed
-#endif
);
-#if CONFIG_CODEC == SWCODEC
speed = pitch;
-#endif
semitone = get_semitone_from_pitch(pitch);
nudged = false;
updated = 1;
@@ -1028,21 +964,18 @@ int gui_syncpitchscreen_run(void)
case ACTION_PS_RESET:
pitch = PITCH_SPEED_100;
sound_set_pitch(pitch);
-#if CONFIG_CODEC == SWCODEC
speed = PITCH_SPEED_100;
if (dsp_timestretch_available())
{
dsp_set_timestretch(PITCH_SPEED_100);
at_limit = false;
}
-#endif
semitone = get_semitone_from_pitch(pitch);
updated = 4;
break;
case ACTION_PS_TOGGLE_MODE:
global_settings.pitch_mode_semitone = !global_settings.pitch_mode_semitone;
-#if CONFIG_CODEC == SWCODEC
if (dsp_timestretch_available() && !global_settings.pitch_mode_semitone)
{
@@ -1055,7 +988,6 @@ int gui_syncpitchscreen_run(void)
}
}
settings_save();
-#endif
updated = 3;
break;
@@ -1073,22 +1005,17 @@ int gui_syncpitchscreen_run(void)
if (global_settings.pitch_mode_semitone)
{
semitone = pitch_increase_semitone(pitch, semitone, pitch_delta
-#if CONFIG_CODEC == SWCODEC
, speed
-#endif
);
pitch = get_pitch_from_semitone(semitone);
}
else
{
pitch = pitch_increase(pitch, pitch_delta, true
-#if CONFIG_CODEC == SWCODEC
, speed
-#endif
);
semitone = get_semitone_from_pitch(pitch);
}
-#if CONFIG_CODEC == SWCODEC
if (global_settings.pitch_mode_timestretch)
{
/* do this to make sure we properly obey the stretch limits */
@@ -1098,10 +1025,8 @@ int gui_syncpitchscreen_run(void)
{
speed = pitch;
}
-#endif
}
-#if CONFIG_CODEC == SWCODEC
if(new_speed)
{
new_stretch = GET_STRETCH(pitch, new_speed);
@@ -1135,11 +1060,8 @@ int gui_syncpitchscreen_run(void)
/* when needed */
new_speed = 0;
}
-#endif
}
-#if CONFIG_CODEC == SWCODEC
pcmbuf_set_low_latency(false);
-#endif
pop_current_activity();
return 0;
}
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c
index 7ee349b346..345d74b65c 100644
--- a/apps/gui/skin_engine/skin_display.c
+++ b/apps/gui/skin_engine/skin_display.c
@@ -57,9 +57,7 @@
#endif
#include "cuesheet.h"
-#if CONFIG_CODEC == SWCODEC
#include "playback.h"
-#endif
#include "backdrop.h"
#include "viewport.h"
#if CONFIG_TUNER
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c
index 50704fd66e..2528a0af55 100644
--- a/apps/gui/skin_engine/skin_tokens.c
+++ b/apps/gui/skin_engine/skin_tokens.c
@@ -47,10 +47,8 @@
#include "albumart.h"
#endif
#include "playlist.h"
-#if CONFIG_CODEC == SWCODEC
#include "playback.h"
#include "tdspeed.h"
-#endif
#include "viewport.h"
#include "tagcache.h"
@@ -558,18 +556,16 @@ static struct mp3entry* get_mp3entry_from_offset(int offset, char **filename)
static char filename_buf[MAX_PATH + 1];
fname = playlist_peek(offset, filename_buf, sizeof(filename_buf));
*filename = (char*)fname;
-#if CONFIG_CODEC == SWCODEC
static struct mp3entry tempid3;
if (
#if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE)
tagcache_fill_tags(&tempid3, fname) ||
-#endif
+#endif
audio_peek_track(&tempid3, offset)
)
{
pid3 = &tempid3;
}
-#endif
}
return pid3;
}
@@ -1224,7 +1220,6 @@ const char *get_token_value(struct gui_wps *gwps,
}
#endif
-#if (CONFIG_CODEC == SWCODEC)
case SKIN_TOKEN_CROSSFADE:
#ifdef HAVE_CROSSFADE
if (intval)
@@ -1277,7 +1272,6 @@ const char *get_token_value(struct gui_wps *gwps,
}
return buf;
}
-#endif /* (CONFIG_CODEC == SWCODEC) */
#if defined (HAVE_PITCHCONTROL)
case SKIN_TOKEN_SOUND_PITCH:
@@ -1294,7 +1288,7 @@ const char *get_token_value(struct gui_wps *gwps,
}
#endif
-#if (CONFIG_CODEC == SWCODEC) && defined (HAVE_PITCHCONTROL)
+#if defined (HAVE_PITCHCONTROL)
case SKIN_TOKEN_SOUND_SPEED:
{
int32_t pitch = sound_get_pitch();
@@ -1462,7 +1456,6 @@ const char *get_token_value(struct gui_wps *gwps,
return NULL;
case SKIN_TOKEN_REC_FREQ: /* order from REC_FREQ_CFG_VAL_LIST */
{
-#if CONFIG_CODEC == SWCODEC
unsigned long samprk;
int rec_freq = global_settings.rec_frequency;
@@ -1528,26 +1521,8 @@ const char *get_token_value(struct gui_wps *gwps,
}
}
snprintf(buf, buf_size, "%lu.%1lu", samprk/1000,samprk%1000);
-#else /* HWCODEC */
-
- static const char * const freq_strings[] =
- {"--", "44", "48", "32", "22", "24", "16"};
- int freq = 1 + global_settings.rec_frequency;
-#ifdef HAVE_SPDIF_REC
- if (global_settings.rec_source == AUDIO_SRC_SPDIF)
- {
- /* Can't measure S/PDIF sample rate on Archos/Sim yet */
- freq = 0;
- }
-#endif /* HAVE_SPDIF_IN */
- if (intval)
- *intval = freq+1; /* so the token gets a value 1<=x<=7 */
- snprintf(buf, buf_size, "%s\n",
- freq_strings[global_settings.rec_frequency]);
-#endif
return buf;
}
-#if CONFIG_CODEC == SWCODEC
case SKIN_TOKEN_REC_ENCODER:
{
int rec_format = global_settings.rec_format+1; /* WAV, AIFF, WV, MPEG */
@@ -1568,9 +1543,7 @@ const char *get_token_value(struct gui_wps *gwps,
}
break;
}
-#endif
case SKIN_TOKEN_REC_BITRATE:
-#if CONFIG_CODEC == SWCODEC
if (global_settings.rec_format == REC_FORMAT_MPA_L3)
{
if (intval)
@@ -1632,17 +1605,11 @@ const char *get_token_value(struct gui_wps *gwps,
}
else
return NULL; /* Fixme later */
-#else /* CONFIG_CODEC == HWCODEC */
- if (intval)
- *intval = global_settings.rec_quality+1;
- snprintf(buf, buf_size, "%d", global_settings.rec_quality);
- return buf;
-#endif
case SKIN_TOKEN_REC_MONO:
if (!global_settings.rec_channels)
return "m";
return NULL;
-
+
case SKIN_TOKEN_REC_SECONDS:
{
int time = (audio_recorded_time() / HZ) % 60;
diff --git a/apps/gui/splash.c b/apps/gui/splash.c
index 56df77d57a..fa2c21768a 100644
--- a/apps/gui/splash.c
+++ b/apps/gui/splash.c
@@ -199,7 +199,7 @@ void splashf(int ticks, const char *fmt, ...)
void splash(int ticks, const char *str)
{
-#if !defined(SIMULATOR) || CONFIG_CODEC == SWCODEC
+#if !defined(SIMULATOR)
long id;
/* fmt may be a so called virtual pointer. See settings.h. */
if((id = P2ID((const unsigned char*)str)) >= 0)
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c
index 90d04a7930..0c8f54f749 100644
--- a/apps/gui/statusbar.c
+++ b/apps/gui/statusbar.c
@@ -27,9 +27,7 @@
#include "sound.h"
#include "settings.h"
#include "viewport.h"
-#if CONFIG_CODEC == SWCODEC
#include "metadata.h"
-#endif
#include "icons.h"
#include "powermgmt.h"
#include "usb.h"
@@ -602,7 +600,6 @@ static void gui_statusbar_time(struct screen * display, struct tm *time)
#endif
#ifdef HAVE_RECORDING
-#if CONFIG_CODEC == SWCODEC
/**
* Write a number to the display using bitmaps and return new position
*/
@@ -650,7 +647,7 @@ static void gui_statusbar_write_format_info(struct screen * display)
xpos += BM_GLYPH_WIDTH;
}
}
-
+
/* Show bitmap - clipping right edge if needed */
display->mono_bitmap_part(bm, 0, 0, STATUSBAR_ENCODER_WIDTH,
@@ -695,58 +692,14 @@ static void gui_statusbar_write_samplerate_info(struct screen * display)
STATUSBAR_Y_POS, BM_GLYPH_WIDTH,
STATUSBAR_HEIGHT);
}
-#endif /* CONFIG_CODEC == SWCODEC */
static void gui_statusbar_icon_recording_info(struct screen * display)
{
-#if CONFIG_CODEC != SWCODEC
- char buffer[3];
- const char *p = buffer;
- int width, height;
- display->setfont(FONT_SYSFIXED);
-#endif /* CONFIG_CODEC != SWCODEC */
-
/* Display Codec info in statusbar */
-#if CONFIG_CODEC == SWCODEC
gui_statusbar_write_format_info(display);
-#else /* !SWCODEC */
- display->mono_bitmap(bitmap_icons_5x8[Icon_q],
- STATUSBAR_ENCODER_X_POS + 8, STATUSBAR_Y_POS,
- 5, STATUSBAR_HEIGHT);
-
- snprintf(buffer, sizeof(buffer), "%d", global_settings.rec_quality);
- display->getstringsize(buffer, &width, &height);
- if (height <= STATUSBAR_HEIGHT)
- display->putsxy(STATUSBAR_ENCODER_X_POS + 13, STATUSBAR_Y_POS, buffer);
-#endif /* CONFIG_CODEC == SWCODEC */
/* Display Samplerate info in statusbar */
-#if CONFIG_CODEC == SWCODEC
- /* SWCODEC targets use bitmaps for glyphs */
gui_statusbar_write_samplerate_info(display);
-#else /* !SWCODEC */
- /* hwcodec targets have sysfont characters */
-#ifdef HAVE_SPDIF_REC
- if (global_settings.rec_source == AUDIO_SRC_SPDIF)
- {
- /* Can't measure S/PDIF sample rate on Archos/Sim yet */
- p = "--";
- }
- else
-#endif /* HAVE_SPDIF_IN */
- {
- static const char * const freq_strings[] =
- {"44", "48", "32", "22", "24", "16"};
- p = freq_strings[global_settings.rec_frequency];
- }
-
- display->getstringsize(p, &width, &height);
-
- if (height <= STATUSBAR_HEIGHT)
- display->putsxy(STATUSBAR_RECFREQ_X_POS, STATUSBAR_Y_POS, p);
-
- display->setfont(FONT_UI);
-#endif /* CONFIG_CODEC == SWCODEC */
/* Display Channel status in status bar */
if(global_settings.rec_channels)
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index b417f82922..82321ff945 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -33,7 +33,6 @@
#include "filetypes.h"
#include "settings.h"
#include "skin_engine/skin_engine.h"
-#include "mp3_playback.h"
#include "audio.h"
#include "usb.h"
#include "status.h"
@@ -124,26 +123,17 @@ static void update_non_static(void)
void pause_action(bool may_fade, bool updatewps)
{
-#if CONFIG_CODEC == SWCODEC
/* Do audio first, then update, unless skin were to use its local
status in which case, reverse it */
audio_pause();
if (updatewps)
update_non_static();
-#else
- if (may_fade && global_settings.fade_on_stop)
- fade(false, updatewps);
- else
- audio_pause();
-#endif
if (global_settings.pause_rewind) {
long newpos;
-#if (CONFIG_CODEC == SWCODEC)
audio_pre_ff_rewind();
-#endif
newpos = audio_current_track()->elapsed
- global_settings.pause_rewind * 1000;
audio_ff_rewind(newpos > 0 ? newpos : 0);
@@ -154,80 +144,16 @@ void pause_action(bool may_fade, bool updatewps)
void unpause_action(bool may_fade, bool updatewps)
{
-#if CONFIG_CODEC == SWCODEC
/* Do audio first, then update, unless skin were to use its local
status in which case, reverse it */
audio_resume();
if (updatewps)
update_non_static();
-#else
- if (may_fade && global_settings.fade_on_stop)
- fade(true, updatewps);
- else
- audio_resume();
-#endif
(void)may_fade;
}
-#if CONFIG_CODEC != SWCODEC
-void fade(bool fade_in, bool updatewps)
-{
- int fp_global_vol = global_settings.volume << 8;
- int fp_min_vol = sound_min(SOUND_VOLUME) << 8;
- int fp_step = (fp_global_vol - fp_min_vol) / 10;
-
- skin_get_global_state()->is_fading = !fade_in;
- if (fade_in) {
- /* fade in */
- int fp_volume = fp_min_vol;
-
- /* zero out the sound */
- sound_set_volume(fp_min_vol >> 8);
-
- sleep(HZ/10); /* let audio thread run */
- audio_resume();
-
- if (updatewps)
- update_non_static();
-
- while (fp_volume < fp_global_vol - fp_step) {
- fp_volume += fp_step;
- sound_set_volume(fp_volume >> 8);
- sleep(1);
- }
- sound_set_volume(global_settings.volume);
- }
- else {
- /* fade out */
- int fp_volume = fp_global_vol;
-
- if (updatewps)
- update_non_static();
-
- while (fp_volume > fp_min_vol + fp_step) {
- fp_volume -= fp_step;
- sound_set_volume(fp_volume >> 8);
- sleep(1);
- }
- audio_pause();
-
- skin_get_global_state()->is_fading = false;
-#if CONFIG_CODEC != SWCODEC
-#ifndef SIMULATOR
- /* let audio thread run and wait for the mas to run out of data */
- while (!mp3_pause_done())
-#endif
- sleep(HZ/10);
-#endif
-
- /* reset volume to what it was before the fade */
- sound_set_volume(global_settings.volume);
- }
-}
-#endif /* SWCODEC */
-
static bool update_onvol_change(enum screen_type screen)
{
skin_update(WPS, screen, SKIN_REFRESH_NON_STATIC);
@@ -264,17 +190,8 @@ static int skintouch_to_wps(struct wps_data *data)
#endif
case ACTION_TOUCH_SCROLLBAR:
skin_get_global_state()->id3->elapsed = skin_get_global_state()->id3->length*offset/100;
-#if (CONFIG_CODEC == SWCODEC)
audio_pre_ff_rewind();
-#else
- if (!skin_get_global_state()->paused)
- audio_pause();
-#endif
audio_ff_rewind(skin_get_global_state()->id3->elapsed);
-#if (CONFIG_CODEC != SWCODEC)
- if (!skin_get_global_state()->paused)
- audio_resume();
-#endif
return ACTION_TOUCHSCREEN;
case ACTION_TOUCH_VOLUME:
{
@@ -344,12 +261,7 @@ bool ffwd_rew(int button)
if ( (audio_status() & AUDIO_STATUS_PLAY) &&
skin_get_global_state()->id3 && skin_get_global_state()->id3->length )
{
-#if (CONFIG_CODEC == SWCODEC)
audio_pre_ff_rewind();
-#else
- if (!skin_get_global_state()->paused)
- audio_pause();
-#endif
if (direction > 0)
status_set_ffmode(STATUS_FASTFORWARD);
else
@@ -393,10 +305,6 @@ bool ffwd_rew(int button)
skin_get_global_state()->ff_rewind_count = 0;
skin_get_global_state()->ff_rewind = false;
status_set_ffmode(0);
-#if (CONFIG_CODEC != SWCODEC)
- if (!skin_get_global_state()->paused)
- audio_resume();
-#endif
exit = true;
break;
@@ -495,19 +403,8 @@ static void prev_track(unsigned long skip_thresh)
return;
}
-#if (CONFIG_CODEC == SWCODEC)
audio_pre_ff_rewind();
-#else
- if (!state->paused)
- audio_pause();
-#endif
-
audio_ff_rewind(0);
-
-#if (CONFIG_CODEC != SWCODEC)
- if (!state->paused)
- audio_resume();
-#endif
}
}
@@ -573,9 +470,7 @@ static void play_hop(int direction)
}
else if (direction == 1 && step >= remaining)
{
-#if CONFIG_CODEC == SWCODEC
system_sound_play(SOUND_TRACK_NO_MORE);
-#endif
return;
}
else if (direction == -1 && elapsed < step)
@@ -588,21 +483,10 @@ static void play_hop(int direction)
}
if(audio_status() & AUDIO_STATUS_PLAY)
{
-#if (CONFIG_CODEC == SWCODEC)
audio_pre_ff_rewind();
-#else
- if (!state->paused)
- audio_pause();
-#endif
}
-#if (CONFIG_CODEC == SWCODEC)
audio_ff_rewind(elapsed);
-#else
- audio_ff_rewind(state->id3->elapsed = elapsed);
- if (!state->paused)
- audio_resume();
-#endif
}
@@ -867,12 +751,7 @@ long gui_wps_show(void)
{
if (state->id3->cuesheet)
{
-#if (CONFIG_CODEC == SWCODEC)
audio_pre_ff_rewind();
-#else
- if (!state->paused)
- audio_pause();
-#endif
audio_ff_rewind(0);
}
else
@@ -1128,13 +1007,8 @@ long gui_wps_show(void)
}
if (exit) {
-#if CONFIG_CODEC != SWCODEC
- if (global_settings.fade_on_stop)
- fade(false, true);
-#else
audio_pause();
update_non_static();
-#endif
if (bookmark)
bookmark_autobookmark(true);
audio_stop();
@@ -1200,11 +1074,9 @@ static void wps_state_init(void)
/* add the WPS track event callbacks */
add_event(PLAYBACK_EVENT_TRACK_CHANGE, track_info_callback);
add_event(PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, track_info_callback);
-#if CONFIG_CODEC == SWCODEC
/* Use the same callback as ..._TRACK_CHANGE for when remaining handles have
finished */
add_event(PLAYBACK_EVENT_CUR_TRACK_READY, track_info_callback);
-#endif
#ifdef AUDIO_FAST_SKIP_PREVIEW
add_event(PLAYBACK_EVENT_TRACK_SKIP, track_info_callback);
#endif
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 11770606a1..fbd49c233d 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -5368,23 +5368,6 @@
</voice>
</phrase>
<phrase>
- id: LANG_RECORDING_QUALITY
- desc: in the recording settings
- user: core
- <source>
- *: none
- recording_hwcodec: "Quality"
- </source>
- <dest>
- *: none
- recording_hwcodec: "Quality"
- </dest>
- <voice>
- *: none
- recording_hwcodec: "Quality"
- </voice>
-</phrase>
-<phrase>
id: LANG_FREQUENCY
desc: in recording and playback settings
user: core
@@ -5490,23 +5473,6 @@
</voice>
</phrase>
<phrase>
- id: LANG_RECORDING_EDITABLE
- desc: Editable recordings setting
- user: core
- <source>
- *: none
- recording_hwcodec: "Independent Frames"
- </source>
- <dest>
- *: none
- recording_hwcodec: "Independent Frames"
- </dest>
- <voice>
- *: none
- recording_hwcodec: "Independent Frames"
- </voice>
-</phrase>
-<phrase>
id: LANG_RECORD_TIMESPLIT
desc: Record split menu
user: core
@@ -9464,23 +9430,6 @@
</voice>
</phrase>
<phrase>
- id: LANG_SYSFONT_RECORDING_QUALITY
- desc: in the recording settings
- user: core
- <source>
- *: none
- recording_hwcodec: "Quality"
- </source>
- <dest>
- *: none
- recording_hwcodec: "Quality"
- </dest>
- <voice>
- *: none
- recording_hwcodec: "Quality"
- </voice>
-</phrase>
-<phrase>
id: LANG_SYSFONT_RECORDING_FREQUENCY
desc: in the recording settings
user: core
diff --git a/apps/main.c b/apps/main.c
index fe15675c69..4f468fa65b 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -45,7 +45,6 @@
#include "serial.h"
#endif
#include "audio.h"
-#include "mp3_playback.h"
#include "settings.h"
#include "backlight.h"
#include "status.h"
@@ -87,12 +86,10 @@
#include "iap.h"
#endif
-#if (CONFIG_CODEC == SWCODEC)
#include "audio_thread.h"
#include "playback.h"
#include "tdspeed.h"
-#endif
-#if (CONFIG_CODEC == SWCODEC) && defined(HAVE_RECORDING) && !defined(SIMULATOR)
+#if defined(HAVE_RECORDING) && !defined(SIMULATOR)
#include "pcm_record.h"
#endif
@@ -258,7 +255,7 @@ static void init_tagcache(void) INIT_ATTR;
static void init_tagcache(void)
{
bool clear = false;
-#if 0 /* CONFIG_CODEC == SWCODEC */
+#if 0
long talked_tick = 0;
#endif
tagcache_init();
@@ -269,7 +266,7 @@ static void init_tagcache(void)
if (ret > 0)
{
-#if 0 /* FIXME: Audio isn't even initialized yet! */ /* CONFIG_CODEC == SWCODEC */
+#if 0 /* FIXME: Audio isn't even initialized yet! */
/* hwcodec can't use voice here, as the database commit
* uses the audio buffer. */
if(global_settings.talk_menu
@@ -365,10 +362,8 @@ static void init(void)
viewportmanager_init();
storage_init();
-#if CONFIG_CODEC == SWCODEC
pcm_init();
dsp_init();
-#endif
settings_reset();
settings_load(SETTINGS_ALL);
settings_apply(true);
@@ -384,23 +379,6 @@ static void init(void)
playlist_init();
shortcuts_init();
-#if CONFIG_CODEC != SWCODEC
- mp3_init( global_settings.volume,
- global_settings.bass,
- global_settings.treble,
- global_settings.balance,
- global_settings.loudness,
- global_settings.avc,
- global_settings.channel_config,
- global_settings.stereo_width,
- global_settings.mdb_strength,
- global_settings.mdb_harmonics,
- global_settings.mdb_center,
- global_settings.mdb_shape,
- global_settings.mdb_enable,
- global_settings.superbass);
-#endif /* CONFIG_CODEC != SWCODEC */
-
if (global_settings.audioscrobbler)
scrobbler_init();
@@ -599,10 +577,8 @@ static void init(void)
}
}
-#if CONFIG_CODEC == SWCODEC
pcm_init();
dsp_init();
-#endif
#if defined(SETTINGS_RESET) || (CONFIG_KEYPAD == IPOD_4G_PAD) || \
(CONFIG_KEYPAD == IRIVER_H10_PAD)
@@ -669,25 +645,6 @@ static void init(void)
shortcuts_init();
-#if CONFIG_CODEC != SWCODEC
- /* No buffer allocation (see buffer.c) may take place after the call to
- audio_init() since the mpeg thread takes the rest of the buffer space */
- mp3_init( global_settings.volume,
- global_settings.bass,
- global_settings.treble,
- global_settings.balance,
- global_settings.loudness,
- global_settings.avc,
- global_settings.channel_config,
- global_settings.stereo_width,
- global_settings.mdb_strength,
- global_settings.mdb_harmonics,
- global_settings.mdb_center,
- global_settings.mdb_shape,
- global_settings.mdb_enable,
- global_settings.superbass);
-#endif /* CONFIG_CODEC != SWCODEC */
-
CHART(">audio_init");
audio_init();
CHART("<audio_init");
diff --git a/apps/menu.c b/apps/menu.c
index 97af181267..49e6c58b2b 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -391,9 +391,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
{
int new_audio_status;
redraw_lists = false;
-#if CONFIG_CODEC == SWCODEC
keyclick_set_callback(gui_synclist_keyclick_callback, &lists);
-#endif
action = get_action(CONTEXT_MAINMENU,
list_do_action_timeout(&lists, HZ));
diff --git a/apps/menus/eq_menu.c b/apps/menus/eq_menu.c
index b41e4b0981..683025629b 100644
--- a/apps/menus/eq_menu.c
+++ b/apps/menus/eq_menu.c
@@ -30,7 +30,6 @@
#include "list.h"
#include "menu.h"
#include "action.h"
-#include "mp3_playback.h"
#include "settings.h"
#include "screens.h"
#include "icons.h"
diff --git a/apps/menus/menu_common.c b/apps/menus/menu_common.c
index 2ef48cc23b..1fa8ba3af2 100644
--- a/apps/menus/menu_common.c
+++ b/apps/menus/menu_common.c
@@ -25,11 +25,8 @@
#include "action.h"
#include "menu.h"
#include "menu_common.h"
-#if CONFIG_CODEC == SWCODEC
#include "pcmbuf.h"
-#endif
-#if CONFIG_CODEC == SWCODEC
/* Use this callback if your menu adjusts DSP settings. */
int lowlatency_callback(int action,
const struct menu_item_ex *this_item,
@@ -48,5 +45,3 @@ int lowlatency_callback(int action,
}
return action;
}
-#endif
-
diff --git a/apps/menus/menu_common.h b/apps/menus/menu_common.h
index e85ed8dc61..5a28c3f03c 100644
--- a/apps/menus/menu_common.h
+++ b/apps/menus/menu_common.h
@@ -24,11 +24,9 @@
#include "menu.h"
#include "config.h"
-#if CONFIG_CODEC == SWCODEC
int lowlatency_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list);
-#endif
#endif /* _MENU_COMMON_H */
diff --git a/apps/menus/playback_menu.c b/apps/menus/playback_menu.c
index bf770c0f11..41c738725c 100644
--- a/apps/menus/playback_menu.c
+++ b/apps/menus/playback_menu.c
@@ -35,16 +35,13 @@
#include "audio.h"
#include "cuesheet.h"
#include "misc.h"
-#if CONFIG_CODEC == SWCODEC
#include "playback.h"
#include "pcm_sampr.h"
#ifdef HAVE_PLAY_FREQ
#include "talk.h"
#endif
-#endif
-
-#if (CONFIG_CODEC == SWCODEC) && defined(HAVE_CROSSFADE)
+#if defined(HAVE_CROSSFADE)
static int setcrossfadeonexit_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
@@ -60,7 +57,7 @@ static int setcrossfadeonexit_callback(int action,
return action;
}
-#endif /* CONFIG_CODEC == SWCODEC */
+#endif /* HAVE_CROSSFADE */
/***********************************/
/* PLAYBACK MENU */
@@ -77,7 +74,6 @@ MENUITEM_SETTING(ff_rewind_min_step, &global_settings.ff_rewind_min_step, NULL);
MAKE_MENU(ff_rewind_settings_menu, ID2P(LANG_WIND_MENU), 0, Icon_NOICON,
&ff_rewind_min_step, &ff_rewind_accel);
#ifdef HAVE_DISK_STORAGE
-#if CONFIG_CODEC == SWCODEC
static int buffermargin_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
@@ -92,16 +88,12 @@ static int buffermargin_callback(int action,
}
return action;
}
-#else
-# define buffermargin_callback NULL
-#endif
MENUITEM_SETTING(buffer_margin, &global_settings.buffer_margin,
buffermargin_callback);
#endif /*HAVE_DISK_STORAGE */
MENUITEM_SETTING(fade_on_stop, &global_settings.fade_on_stop, NULL);
MENUITEM_SETTING(party_mode, &global_settings.party_mode, NULL);
-#if CONFIG_CODEC == SWCODEC
#ifdef HAVE_CROSSFADE
/* crossfade submenu */
MENUITEM_SETTING(crossfade, &global_settings.crossfade, setcrossfadeonexit_callback);
@@ -150,7 +142,6 @@ MAKE_MENU(replaygain_settings_menu,ID2P(LANG_REPLAYGAIN),0, Icon_NOICON,
&replaygain_type, &replaygain_noclip, &replaygain_preamp);
MENUITEM_SETTING(beep, &global_settings.beep ,NULL);
-#endif /* CONFIG_CODEC == SWCODEC */
#ifdef HAVE_SPDIF_POWER
MENUITEM_SETTING(spdif_enable, &global_settings.spdif_enable, NULL);
@@ -188,13 +179,7 @@ static int cuesheet_callback(int action,
switch (action)
{
case ACTION_EXIT_MENUITEM: /* on exit */
-#if CONFIG_CODEC == SWCODEC
audio_set_cuesheet(global_settings.cuesheet);
-#else
- if (global_settings.cuesheet)
- splash(HZ*2, ID2P(LANG_PLEASE_REBOOT));
- break;
-#endif
}
return action;
}
@@ -209,9 +194,7 @@ MAKE_MENU(unplug_menu, ID2P(LANG_HEADPHONE_UNPLUG), 0, Icon_NOICON,
MENUITEM_SETTING(skip_length, &global_settings.skip_length, NULL);
MENUITEM_SETTING(prevent_skip, &global_settings.prevent_skip, NULL);
-#if CONFIG_CODEC == SWCODEC
MENUITEM_SETTING(resume_rewind, &global_settings.resume_rewind, NULL);
-#endif
MENUITEM_SETTING(pause_rewind, &global_settings.pause_rewind, NULL);
#ifdef HAVE_PLAY_FREQ
MENUITEM_SETTING(play_frequency, &global_settings.play_frequency,
@@ -227,13 +210,11 @@ MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0,
#endif
&fade_on_stop, &party_mode,
-#if (CONFIG_CODEC == SWCODEC) && defined(HAVE_CROSSFADE)
+#if defined(HAVE_CROSSFADE)
&crossfade_settings_menu,
#endif
-#if CONFIG_CODEC == SWCODEC
&replaygain_settings_menu, &beep,
-#endif
#ifdef HAVE_SPDIF_POWER
&spdif_enable,
@@ -244,9 +225,7 @@ MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0,
#endif
,&skip_length, &prevent_skip
-#if CONFIG_CODEC == SWCODEC
,&resume_rewind
-#endif
,&pause_rewind
#ifdef HAVE_PLAY_FREQ
,&play_frequency
diff --git a/apps/menus/radio_menu.c b/apps/menus/radio_menu.c
index 8871421c11..a6d259a21d 100644
--- a/apps/menus/radio_menu.c
+++ b/apps/menus/radio_menu.c
@@ -34,7 +34,7 @@
#ifdef HAVE_RECORDING
#include "recording.h" /* recording_screen() */
-#if defined(HAVE_FMRADIO_REC) && CONFIG_CODEC == SWCODEC
+#if defined(HAVE_FMRADIO_REC)
#define FM_RECORDING_SCREEN
static int fm_recording_screen(void)
{
@@ -53,30 +53,20 @@ static int fm_recording_screen(void)
MENUITEM_FUNCTION(recscreen_item, 0, ID2P(LANG_RECORDING),
fm_recording_screen, NULL, NULL, Icon_Recording);
-#endif /* defined(HAVE_FMRADIO_REC) && CONFIG_CODEC == SWCODEC */
+#endif /* defined(HAVE_FMRADIO_REC) */
-#if defined(HAVE_FMRADIO_REC) || CONFIG_CODEC != SWCODEC
+#if defined(HAVE_FMRADIO_REC)
#define FM_RECORDING_SETTINGS
static int fm_recording_settings(void)
{
int ret = recording_menu(true);
-#if CONFIG_CODEC != SWCODEC
- if (!ret)
- {
- struct audio_recording_options rec_options;
- rec_init_recording_options(&rec_options);
- rec_options.rec_source = AUDIO_SRC_LINEIN;
- rec_set_recording_options(&rec_options);
- }
-#endif
-
return ret;
}
MENUITEM_FUNCTION(recsettings_item, 0, ID2P(LANG_RECORDING_SETTINGS),
fm_recording_settings, NULL, NULL, Icon_Recording);
-#endif /* defined(HAVE_FMRADIO_REC) || CONFIG_CODEC != SWCODEC */
+#endif /* defined(HAVE_FMRADIO_REC) */
#endif /* HAVE_RECORDING */
#ifndef FM_PRESET
diff --git a/apps/menus/recording_menu.c b/apps/menus/recording_menu.c
index 0f24420a63..c841de4e89 100644
--- a/apps/menus/recording_menu.c
+++ b/apps/menus/recording_menu.c
@@ -29,7 +29,6 @@
#include "lcd.h"
#include "menu.h"
#include "button.h"
-#include "mp3_playback.h"
#include "settings.h"
#include "screens.h"
#include "icons.h"
@@ -51,14 +50,12 @@
#include "peakmeter.h"
#endif
#include "splash.h"
-#if CONFIG_CODEC == SWCODEC
#include "metadata.h"
#include "menus/eq_menu.h"
#ifdef HAVE_RECORDING
#include "enc_config.h"
#endif
#include "general.h"
-#endif
#include "action.h"
#include "recording.h"
#include "sound_menu.h"
@@ -101,7 +98,6 @@ static int recsource_func(void)
MENUITEM_FUNCTION(recsource, 0, ID2P(LANG_RECORDING_SOURCE),
recsource_func, NULL, recmenu_callback, Icon_Menu_setting);
-#if CONFIG_CODEC == SWCODEC
/* Makes an options list from a source list of options and indexes */
static void make_options_from_indexes(const struct opt_items *src_names,
const long *src_indexes,
@@ -112,12 +108,8 @@ static void make_options_from_indexes(const struct opt_items *src_names,
dst_names[n_indexes] = src_names[src_indexes[n_indexes]];
} /* make_options_from_indexes */
-
-#endif /* CONFIG_CODEC == SWCODEC */
-
static int recfrequency_func(void)
{
-#if CONFIG_CODEC == SWCODEC
static const struct opt_items names[REC_NUM_FREQ] = {
REC_HAVE_96_([REC_FREQ_96] = { "96kHz", TALK_ID(96, UNIT_KHZ) },)
REC_HAVE_88_([REC_FREQ_88] = { "88.2kHz", TALK_ID(88, UNIT_KHZ) },)
@@ -195,7 +187,6 @@ static int recfrequency_func(void)
}
return ret;
-#endif /* CONFIG_CODEC == SWCODEC */
} /* recfrequency */
MENUITEM_FUNCTION(recfrequency, 0, ID2P(LANG_FREQUENCY),
recfrequency_func, NULL, NULL, Icon_Menu_setting);
@@ -208,7 +199,6 @@ static int recchannels_func(void)
[CHN_MODE_MONO] = { STR(LANG_CHANNEL_MONO) }
};
-#if CONFIG_CODEC == SWCODEC
struct opt_items opts[CHN_NUM_MODES];
long table[CHN_NUM_MODES];
struct encoder_caps caps;
@@ -238,13 +228,10 @@ static int recchannels_func(void)
global_settings.rec_channels = table[rec_channels];
return ret;
-#endif /* CONFIG_CODEC == SWCODEC */
}
MENUITEM_FUNCTION(recchannels, 0, ID2P(LANG_CHANNELS),
recchannels_func, NULL, NULL, Icon_Menu_setting);
-#if CONFIG_CODEC == SWCODEC
-
static int recmonomode_func(void)
{
static const struct opt_items names[3] = {
@@ -293,9 +280,6 @@ MENUITEM_FUNCTION(enc_global_config_menu_item, 0, ID2P(LANG_ENCODER_SETTINGS),
enc_global_config_menu,
NULL, NULL, Icon_Submenu);
-#endif /* CONFIG_CODEC == SWCODEC */
-
-
static int recmenu_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
@@ -603,14 +587,10 @@ MENUITEM_FUNCTION(save_recpresets_item, 0, ID2P(LANG_SAVE_SETTINGS),
MAKE_MENU(recording_settings_menu, ID2P(LANG_RECORDING_SETTINGS),
NULL, Icon_Recording,
-#if CONFIG_CODEC == SWCODEC
&recformat, &enc_global_config_menu_item,
-#endif
&recfrequency, &recsource, /* recsource not shown if no_source */
&recchannels,
-#if CONFIG_CODEC == SWCODEC
&recmonomode,
-#endif
&filesplitoptionsmenu,
&rec_prerecord_time,
&clear_rec_directory_item,
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c
index 2957b0635c..e2b496a6f7 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -38,9 +38,7 @@
#include "yesno.h"
#include "talk.h"
#include "powermgmt.h"
-#if CONFIG_CODEC == SWCODEC
#include "playback.h"
-#endif
#if CONFIG_RTC
#include "screens.h"
#endif
@@ -326,7 +324,6 @@ MAKE_MENU(limits_menu, ID2P(LANG_LIMITS_MENU), 0, Icon_NOICON,
/* Keyclick menu */
-#if CONFIG_CODEC == SWCODEC
MENUITEM_SETTING(keyclick, &global_settings.keyclick, NULL);
MENUITEM_SETTING(keyclick_repeats, &global_settings.keyclick_repeats, NULL);
#ifdef HAVE_HARDWARE_CLICK
@@ -337,7 +334,6 @@ MAKE_MENU(keyclick_menu, ID2P(LANG_KEYCLICK), 0, Icon_NOICON,
MAKE_MENU(keyclick_menu, ID2P(LANG_KEYCLICK), 0, Icon_NOICON,
&keyclick, &keyclick_repeats);
#endif
-#endif
#if CONFIG_CHARGING
MENUITEM_SETTING(car_adapter_mode, &global_settings.car_adapter_mode, NULL);
@@ -437,9 +433,7 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
&buttonlight_brightness,
#endif
-#if CONFIG_CODEC == SWCODEC
&keyclick_menu,
-#endif
#ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
&touchpad_sensitivity,
#endif
@@ -619,7 +613,6 @@ MAKE_MENU(bookmark_settings_menu, ID2P(LANG_BOOKMARK_SETTINGS), 0,
/***********************************/
/* AUTORESUME MENU */
#ifdef HAVE_TAGCACHE
-#if CONFIG_CODEC == SWCODEC
static int autoresume_callback(int action,
const struct menu_item_ex *this_item,
@@ -674,7 +667,6 @@ MAKE_MENU(autoresume_menu, ID2P(LANG_AUTORESUME),
0, Icon_NOICON,
&autoresume_enable, &autoresume_automatic);
-#endif /* CONFIG_CODEC == SWCODEC */
#endif /* HAVE_TAGCACHE */
/* AUTORESUME MENU */
/***********************************/
@@ -758,10 +750,8 @@ MAKE_MENU(settings_menu_item, ID2P(LANG_GENERAL_SETTINGS), 0,
&startup_shutdown_menu,
&bookmark_settings_menu,
#ifdef HAVE_TAGCACHE
-#if CONFIG_CODEC == SWCODEC
&autoresume_menu,
#endif
-#endif
&browse_langs, &voice_settings_menu,
#ifdef HAVE_HOTKEY
&hotkey_menu,
diff --git a/apps/menus/sound_menu.c b/apps/menus/sound_menu.c
index ee966ac62a..174329fcc8 100644
--- a/apps/menus/sound_menu.c
+++ b/apps/menus/sound_menu.c
@@ -108,18 +108,10 @@ MENUITEM_SETTING(treble_cutoff, &global_settings.treble_cutoff, NULL);
MENUITEM_SETTING(balance, &global_settings.balance, NULL);
MENUITEM_SETTING(channel_config, &global_settings.channel_config,
-#if CONFIG_CODEC == SWCODEC
lowlatency_callback
-#else
- NULL
-#endif
);
MENUITEM_SETTING(stereo_width, &global_settings.stereo_width,
-#if CONFIG_CODEC == SWCODEC
lowlatency_callback
-#else
- NULL
-#endif
);
#ifdef AUDIOHW_HAVE_DEPTH_3D
@@ -134,7 +126,6 @@ MENUITEM_SETTING(roll_off, &global_settings.roll_off, NULL);
MENUITEM_SETTING(func_mode, &global_settings.func_mode, NULL);
#endif
-#if CONFIG_CODEC == SWCODEC
/* Crossfeed Submenu */
MENUITEM_SETTING(crossfeed, &global_settings.crossfeed, lowlatency_callback);
MENUITEM_SETTING(crossfeed_direct_gain,
@@ -216,7 +207,6 @@ static int timestretch_callback(int action,
MAKE_MENU(compressor_menu,ID2P(LANG_COMPRESSOR), NULL, Icon_NOICON,
&compressor_threshold, &compressor_gain, &compressor_ratio,
&compressor_knee, &compressor_attack, &compressor_release);
-#endif
#ifdef HAVE_SPEAKER
MENUITEM_SETTING(speaker_mode, &global_settings.speaker_mode, NULL);
@@ -253,14 +243,12 @@ MAKE_MENU(sound_settings, ID2P(LANG_SOUND_SETTINGS), NULL, Icon_Audio,
#ifdef AUDIOHW_HAVE_FUNCTIONAL_MODE
,&func_mode
#endif
-#if CONFIG_CODEC == SWCODEC
,&crossfeed_menu, &equalizer_menu, &dithering_enabled
,&surround_menu, &pbe_menu, &afr_enabled
#ifdef HAVE_PITCHCONTROL
,&timestretch_enabled
#endif
,&compressor_menu
-#endif
#ifdef HAVE_SPEAKER
,&speaker_mode
#endif
diff --git a/apps/misc.c b/apps/misc.c
index 2e3292dba5..b20a0095ab 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -91,11 +91,7 @@
#include "bookmark.h"
#include "wps.h"
#include "playback.h"
-#if CONFIG_CODEC == SWCODEC
#include "voice_thread.h"
-#else
-#include "mp3_playback.h"
-#endif
#ifdef BOOTFILE
#if !defined(USB_NONE) && !defined(USB_HANDLED_BY_OF) \
@@ -302,7 +298,7 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter)
#endif
{
bool batt_safe = battery_level_safe();
-#if CONFIG_CODEC != SWCODEC || defined(HAVE_RECORDING)
+#if defined(HAVE_RECORDING)
int audio_stat = audio_status();
#endif
@@ -339,19 +335,12 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter)
splashf(0, "%s %s", str(LANG_WARNING_BATTERY_EMPTY),
str(LANG_SHUTTINGDOWN));
}
-#if CONFIG_CODEC != SWCODEC
- if (global_settings.fade_on_stop
- && (audio_stat & AUDIO_STATUS_PLAY))
- {
- fade(false, false);
- }
-#endif
#ifdef HAVE_DISK_STORAGE
if (batt_safe) /* do not save on critical battery */
#endif
{
-#if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC
+#if defined(HAVE_RECORDING)
if (audio_stat & AUDIO_STATUS_RECORD)
{
rec_command(RECORDING_CMD_STOP);
@@ -368,13 +357,7 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter)
if (callback != NULL)
callback(parameter);
-#if CONFIG_CODEC != SWCODEC
- /* wait for audio_stop or audio_stop_recording to complete */
- while (audio_status())
- sleep(1);
-#endif
-
-#if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC
+#if defined(HAVE_RECORDING)
audio_close_recording();
#endif
scrobbler_shutdown(true);
@@ -403,9 +386,7 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter)
enqueue = true;
}
talk_id(LANG_SHUTTINGDOWN, enqueue);
-#if CONFIG_CODEC == SWCODEC
voice_wait();
-#endif
}
shutdown_hw();
@@ -426,10 +407,6 @@ bool list_stop_handler(void)
{
if (!global_settings.party_mode)
{
-#if CONFIG_CODEC != SWCODEC
- if (global_settings.fade_on_stop)
- fade(false, false);
-#endif
bookmark_autobookmark(true);
audio_stop();
ret = true; /* bookmarking can make a refresh necessary */
@@ -894,7 +871,6 @@ char *strip_extension(char* buffer, int buffer_size, const char *filename)
return buffer;
}
-#if CONFIG_CODEC == SWCODEC
/* Play a standard sound */
void system_sound_play(enum system_sound sound)
{
@@ -1046,7 +1022,6 @@ void replaygain_update(void)
settings.type = replaygain_setting_mode(settings.type);
dsp_replaygain_set_settings(&settings);
}
-#endif /* CONFIG_CODEC == SWCODEC */
/* format a sound value like: -1.05 dB */
int format_sound_value(char *buf, size_t size, int snd, int val)
diff --git a/apps/misc.h b/apps/misc.h
index 8d72e79a3d..10626dfaf4 100644
--- a/apps/misc.h
+++ b/apps/misc.h
@@ -181,7 +181,6 @@ enum current_activity {
ACTIVITY_USBSCREEN
};
-#if CONFIG_CODEC == SWCODEC
void beep_play(unsigned int frequency, unsigned int duration,
unsigned int amplitude);
@@ -209,9 +208,6 @@ void keyclick_click(bool rawbutton, int action);
struct mp3entry;
int id3_get_replaygain_mode(const struct mp3entry *id3);
void replaygain_update(void);
-#else
-static inline void replaygain_update(void) {}
-#endif /* CONFIG_CODEC == SWCODEC */
void push_current_activity(enum current_activity screen);
void pop_current_activity(void);
diff --git a/apps/mpeg.c b/apps/mpeg.c
deleted file mode 100644
index e04c227cb1..0000000000
--- a/apps/mpeg.c
+++ /dev/null
@@ -1,1979 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * 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 <stdbool.h>
-#include <stdlib.h>
-#include "config.h"
-
-#if CONFIG_CODEC != SWCODEC
-
-#include "debug.h"
-#include "panic.h"
-#include "metadata.h"
-#include "mpeg.h"
-#include "audio.h"
-#include "storage.h"
-#include "string.h"
-#include <kernel.h>
-#include "thread.h"
-#include "errno.h"
-#include "mp3data.h"
-#include "core_alloc.h"
-#include "mp3_playback.h"
-#include "talk.h"
-#include "sound.h"
-#include "system.h"
-#include "appevents.h"
-#include "playlist.h"
-#include "cuesheet.h"
-#include "settings.h"
-#ifndef SIMULATOR
-#include "i2c.h"
-#include "system.h"
-#include "usb.h"
-#include "file.h"
-#include "hwcompat.h"
-#endif /* !SIMULATOR */
-#ifdef HAVE_LCD_BITMAP
-#include "lcd.h"
-#endif /* CONFIG_CODEC != SWCODEC */
-
-#define MPEG_SWAP_CHUNKSIZE 0x2000
-#define MPEG_HIGH_WATER 2 /* We leave 2 bytes empty because otherwise we
- wouldn't be able to see the difference between
- an empty buffer and a full one. */
-#define MPEG_LOW_WATER 0x60000
-#define MPEG_RECORDING_LOW_WATER 0x80000
-#define MPEG_LOW_WATER_CHUNKSIZE 0x40000
-#define MPEG_LOW_WATER_SWAP_CHUNKSIZE 0x10000
-#if (CONFIG_STORAGE & STORAGE_MMC)
-#define MPEG_PLAY_PENDING_THRESHOLD 0x20000
-#define MPEG_PLAY_PENDING_SWAPSIZE 0x20000
-#else
-#define MPEG_PLAY_PENDING_THRESHOLD 0x10000
-#define MPEG_PLAY_PENDING_SWAPSIZE 0x10000
-#endif
-
-#define MPEG_MAX_PRERECORD_SECONDS 30
-
-/* For ID3 info and VBR header */
-#define MPEG_RESERVED_HEADER_SPACE (4096 + 576)
-
-#ifndef SIMULATOR
-extern unsigned long mas_version_code;
-#endif
-
-#define MPEG_PLAY 1
-#define MPEG_STOP 2
-#define MPEG_PAUSE 3
-#define MPEG_RESUME 4
-#define MPEG_NEXT 5
-#define MPEG_PREV 6
-#define MPEG_FF_REWIND 7
-#define MPEG_FLUSH_RELOAD 8
-#define MPEG_RECORD 9
-#define MPEG_INIT_RECORDING 10
-#define MPEG_INIT_PLAYBACK 11
-#define MPEG_NEW_FILE 12
-#define MPEG_PAUSE_RECORDING 13
-#define MPEG_RESUME_RECORDING 14
-#define MPEG_NEED_DATA 100
-#define MPEG_TRACK_CHANGE 101
-#define MPEG_SAVE_DATA 102
-#define MPEG_STOP_DONE 103
-#define MPEG_PRERECORDING_TICK 104
-
-/* indicator for MPEG_NEED_DATA */
-#define GENERATE_UNBUFFER_EVENTS 1
-
-/* list of tracks in memory */
-#define MAX_TRACK_ENTRIES (1<<4) /* Must be power of 2 */
-#define MAX_TRACK_ENTRIES_MASK (MAX_TRACK_ENTRIES - 1)
-
-struct trackdata
-{
- struct mp3entry id3;
- int mempos;
- int load_ahead_index;
-};
-
-static struct trackdata trackdata[MAX_TRACK_ENTRIES];
-
-static unsigned int current_track_counter = 0;
-
-#ifndef SIMULATOR
-static void stop_playing(void);
-
-static int track_read_idx = 0;
-static int track_write_idx = 0;
-#endif /* !SIMULATOR */
-
-/* Cuesheet support */
-static struct cuesheet *curr_cuesheet = NULL;
-static bool checked_for_cuesheet = false;
-
-static const char mpeg_thread_name[] = "mpeg";
-static unsigned int audio_thread_id;
-static bool audio_is_initialized;
-static unsigned int mpeg_errno;
-
-static bool playing = false; /* We are playing an MP3 stream */
-static bool is_playing = false; /* We are (attempting to) playing MP3 files */
-static bool paused; /* playback is paused */
-static int audiobuf_handle; /* handle to the audio buffer */
-static char* mpeg_audiobuf; /* poiunter to the audio buffer */
-static long audiobuflen; /* length of the audio buffer */
-#define AUDIO_BUFFER_RESERVE (256*1024)
-#ifdef SIMULATOR
-static char mpeg_stack[DEFAULT_STACK_SIZE];
-static struct mp3entry taginfo;
-#else /* !SIMULATOR */
-static struct event_queue mpeg_queue SHAREDBSS_ATTR;
-static long mpeg_stack[(DEFAULT_STACK_SIZE + 0x1000)/sizeof(long)];
-
-static int audiobuf_write;
-static int audiobuf_swapwrite;
-static long audiobuf_read;
-
-static int mpeg_file;
-
-static bool play_pending; /* We are about to start playing */
-static bool play_pending_track_change; /* When starting play we're starting a new file */
-static bool filling; /* We are filling the buffer with data from disk */
-static bool dma_underrun; /* True when the DMA has stopped because of
- slow disk reading (read error, shaking) */
-static bool mpeg_stop_done;
-
-static int last_dma_tick = 0;
-static int last_dma_chunk_size;
-
-static long low_watermark; /* Dynamic low watermark level */
-static long low_watermark_margin = 0; /* Extra time in seconds for watermark */
-static long lowest_watermark_level; /* Debug value to observe the buffer
- usage */
-
-struct audio_resume_info
-{
- unsigned long elapsed;
- unsigned long offset;
-};
-
-#ifdef HAVE_RECORDING
-static const unsigned char empty_id3_header[] =
-{
- 'I', 'D', '3', 0x03, 0x00, 0x00,
- 0x00, 0x00, 0x1f, 0x76 /* Size is 4096 minus 10 bytes for the header */
-};
-#endif /* HAVE_RECORDING */
-
-
-static int get_unplayed_space(void);
-static int get_playable_space(void);
-static int get_unswapped_space(void);
-#endif /* !SIMULATOR */
-
-static void audio_reset_buffer_noalloc(void* buf, size_t bufsize);
-static void audio_reset_buffer(void);
-
-
-#ifndef SIMULATOR
-static int num_tracks_in_memory(void)
-{
- return (track_write_idx - track_read_idx) & MAX_TRACK_ENTRIES_MASK;
-}
-
-#ifdef DEBUG_TAGS
-static void debug_tags(void)
-{
- int i;
-
- for(i = 0;i < MAX_TRACK_ENTRIES;i++)
- {
- DEBUGF("%d - %s\n", i, trackdata[i].id3.path);
- }
- DEBUGF("read: %d, write :%d\n", track_read_idx, track_write_idx);
- DEBUGF("num_tracks_in_memory: %d\n", num_tracks_in_memory());
-}
-#else /* !DEBUG_TAGS */
-#define debug_tags()
-#endif /* !DEBUG_TAGS */
-
-static void remove_current_tag(void)
-{
- if(num_tracks_in_memory() > 0)
- {
- /* First move the index, so nobody tries to access the tag */
- track_read_idx = (track_read_idx+1) & MAX_TRACK_ENTRIES_MASK;
- checked_for_cuesheet = false;
- debug_tags();
- }
- else
- {
- DEBUGF("remove_current_tag: no tracks to remove\n");
- }
-}
-
-static void remove_all_non_current_tags(void)
-{
- track_write_idx = (track_read_idx+1) & MAX_TRACK_ENTRIES_MASK;
- debug_tags();
-}
-
-static void remove_all_tags(void)
-{
- track_write_idx = track_read_idx;
-
- debug_tags();
-}
-
-static struct trackdata *get_trackdata(int offset)
-{
- if(offset >= num_tracks_in_memory())
- return NULL;
- else
- return &trackdata[(track_read_idx + offset) & MAX_TRACK_ENTRIES_MASK];
-}
-#endif /* !SIMULATOR */
-
-/***********************************************************************/
-/* audio event handling */
-
-#define MAX_EVENT_HANDLERS 10
-struct event_handlers_table
-{
- AUDIO_EVENT_HANDLER handler;
- unsigned short mask;
-};
-static struct event_handlers_table event_handlers[MAX_EVENT_HANDLERS];
-static int event_handlers_count = 0;
-
-void audio_register_event_handler(AUDIO_EVENT_HANDLER handler, unsigned short mask)
-{
- if (event_handlers_count < MAX_EVENT_HANDLERS)
- {
- event_handlers[event_handlers_count].handler = handler;
- event_handlers[event_handlers_count].mask = mask;
- event_handlers_count++;
- }
-}
-
-/* dispatch calls each handler in the order registered and returns after some
- handler actually handles the event (the event is assumed to no longer be valid
- after this, due to the handler changing some condition); returns true if someone
- handled the event, which is expected to cause the caller to skip its own handling
- of the event */
-#ifndef SIMULATOR
-static bool audio_dispatch_event(unsigned short event, unsigned long data)
-{
- int i = 0;
- for(i=0; i < event_handlers_count; i++)
- {
- if ( event_handlers[i].mask & event )
- {
- int rc = event_handlers[i].handler(event, data);
- if ( rc == AUDIO_EVENT_RC_HANDLED )
- return true;
- }
- }
- return false;
-}
-
-static void send_track_event(unsigned int id, struct mp3entry *id3)
-{
- struct mp3entry *cur_id3 =
- &trackdata[track_read_idx & MAX_TRACK_ENTRIES_MASK].id3;
- unsigned int flags = id3 == cur_id3 ? TEF_CURRENT : 0;
- send_event(id, &(struct track_event){ .flags = flags, .id3 = id3 });
-}
-#endif /* SIMULATOR */
-
-/***********************************************************************/
-
-static void set_elapsed(struct mp3entry* id3)
-{
- if ( id3->vbr ) {
- if ( id3->has_toc ) {
- /* calculate elapsed time using TOC */
- int i;
- unsigned int remainder, plen, relpos, nextpos;
-
- /* find wich percent we're at */
- for (i=0; i<100; i++ )
- {
- if ( id3->offset < id3->toc[i] * (id3->filesize / 256) )
- {
- break;
- }
- }
-
- i--;
- if (i < 0)
- i = 0;
-
- relpos = id3->toc[i];
-
- if (i < 99)
- {
- nextpos = id3->toc[i+1];
- }
- else
- {
- nextpos = 256;
- }
-
- remainder = id3->offset - (relpos * (id3->filesize / 256));
-
- /* set time for this percent (divide before multiply to prevent
- overflow on long files. loss of precision is negligible on
- short files) */
- id3->elapsed = i * (id3->length / 100);
-
- /* calculate remainder time */
- plen = (nextpos - relpos) * (id3->filesize / 256);
- id3->elapsed += (((remainder * 100) / plen) *
- (id3->length / 10000));
- }
- else {
- /* no TOC exists. set a rough estimate using average bitrate */
- int tpk = id3->length / (id3->filesize / 1024);
- id3->elapsed = id3->offset / 1024 * tpk;
- }
- }
- else
- /* constant bitrate, use exact calculation */
- id3->elapsed = id3->offset / (id3->bitrate / 8);
-}
-
-static int audio_get_file_pos_int(struct mp3entry *id3)
-{
- int pos = -1;
-
- if (id3->vbr)
- {
- if (id3->has_toc)
- {
- /* Use the TOC to find the new position */
- unsigned int percent, remainder;
- int curtoc, nexttoc, plen;
-
- percent = (id3->elapsed*100)/id3->length;
- if (percent > 99)
- percent = 99;
-
- curtoc = id3->toc[percent];
-
- if (percent < 99)
- nexttoc = id3->toc[percent+1];
- else
- nexttoc = 256;
-
- pos = (id3->filesize/256)*curtoc;
-
- /* Use the remainder to get a more accurate position */
- remainder = (id3->elapsed*100)%id3->length;
- remainder = (remainder*100)/id3->length;
- plen = (nexttoc - curtoc)*(id3->filesize/256);
- pos += (plen/100)*remainder;
- }
- else
- {
- /* No TOC exists, estimate the new position */
- pos = (id3->filesize / (id3->length / 1000)) *
- (id3->elapsed / 1000);
- }
- }
- else if (id3->bitrate)
- pos = id3->elapsed * (id3->bitrate / 8);
- else
- {
- return -1;
- }
-
- if (pos >= (int)(id3->filesize - id3->id3v1len))
- {
- /* Don't seek right to the end of the file so that we can
- transition properly to the next song */
- pos = id3->filesize - id3->id3v1len - 1;
- }
- else if (pos < (int)id3->first_frame_offset)
- {
- /* skip past id3v2 tag and other leading garbage */
- pos = id3->first_frame_offset;
- }
- return pos;
-}
-
-int audio_get_file_pos(void)
-{
- struct mp3entry *id3 = audio_current_track();
- return id3 ? audio_get_file_pos_int(id3) : 0;
-}
-
-unsigned long mpeg_get_last_header(void)
-{
-#ifdef SIMULATOR
- return 0;
-#else /* !SIMULATOR */
- unsigned long tmp[2];
-
- /* Read the frame data from the MAS and reconstruct it with the
- frame sync and all */
- mas_readmem(MAS_BANK_D0, MAS_D0_MPEG_STATUS_1, tmp, 2);
- return 0xffe00000 | ((tmp[0] & 0x7c00) << 6) | (tmp[1] & 0xffff);
-#endif /* !SIMULATOR */
-}
-
-static void do_stop(void)
-{
- is_playing = false;
- paused = false;
-
-#ifndef SIMULATOR
- if (playing)
- playlist_update_resume_info(audio_current_track());
-
- stop_playing();
- mpeg_stop_done = true;
-#else
- playing = false;
-#endif
-}
-
-/* Buffer must not move. */
-static int shrink_callback(int handle, unsigned hints, void* start, size_t old_size)
-{
- ssize_t extradata_size = old_size - audiobuflen;
- /* check what buflib requests */
- size_t wanted_size = (hints & BUFLIB_SHRINK_SIZE_MASK);
- ssize_t size = (ssize_t)old_size - wanted_size;
-
- /* keep at least 256K for the buffering */
- if ((size - extradata_size) < AUDIO_BUFFER_RESERVE)
- {
- /* check if buflib needs the memory really hard. if yes we give
- * up playback for now, otherwise refuse to shrink to keep at least
- * 256K for the buffering */
- if ((hints & BUFLIB_SHRINK_POS_MASK) != BUFLIB_SHRINK_POS_MASK)
- return BUFLIB_CB_CANNOT_SHRINK;
- }
- /* TODO: Do it without stopping playback, if possible */
- bool playing = (audio_status() & AUDIO_STATUS_PLAY) == AUDIO_STATUS_PLAY;
- struct mp3entry *id3 = audio_current_track();
- unsigned long elapsed = 0, offset = 0;
- if (id3)
- {
- elapsed = id3->elapsed;
- offset = id3->offset;
- }
- /* don't call audio_hard_stop() as it frees this handle */
- if (thread_self() == audio_thread_id)
- { /* inline case MPEG_STOP (audio_stop()) response
- * if we're in the audio thread since audio_stop() otherwise deadlocks */
- do_stop();
- }
- else
- audio_stop();
-
- switch (hints & BUFLIB_SHRINK_POS_MASK)
- {
- case BUFLIB_SHRINK_POS_BACK:
- core_shrink(handle, start, size);
- audio_reset_buffer_noalloc(start, size);
- break;
- case BUFLIB_SHRINK_POS_FRONT:
- core_shrink(handle, start + wanted_size, size);
- audio_reset_buffer_noalloc(start + wanted_size, size);
- break;
- case BUFLIB_SHRINK_POS_MASK:
- audiobuf_handle = core_free(audiobuf_handle);
- mpeg_audiobuf = NULL;
- talk_buffer_set_policy(TALK_BUFFER_DEFAULT);
- playing = false;
- break;
- }
- if (playing)
- { /* safe to call even from the audio thread (due to queue_post()) */
- audio_play(elapsed, offset);
- }
-
- return BUFLIB_CB_OK;
-}
-
-static struct buflib_callbacks ops = {
- .move_callback = NULL,
- .shrink_callback = shrink_callback,
-};
-
-#ifndef SIMULATOR
-/* Send callback events to notify about removing old tracks. */
-static void generate_unbuffer_events(void)
-{
- int i;
- int numentries = MAX_TRACK_ENTRIES - num_tracks_in_memory();
- int cur_idx = track_write_idx;
-
- for (i = 0; i < numentries; i++)
- {
- /* Send an event to notify that track has finished. */
- send_track_event(PLAYBACK_EVENT_TRACK_FINISH, &trackdata[cur_idx].id3);
- cur_idx = (cur_idx + 1) & MAX_TRACK_ENTRIES_MASK;
- }
-}
-
-/* Send callback events to notify about new tracks. */
-static void generate_postbuffer_events(void)
-{
- int i;
- int numentries = num_tracks_in_memory();
- int cur_idx = track_read_idx;
-
- for (i = 0; i < numentries; i++)
- {
- send_track_event(PLAYBACK_EVENT_TRACK_BUFFER, &trackdata[cur_idx].id3);
- cur_idx = (cur_idx + 1) & MAX_TRACK_ENTRIES_MASK;
- }
-}
-
-static void recalculate_watermark(int bitrate)
-{
- int bytes_per_sec;
- int time = storage_spinup_time();
-
- /* A bitrate of 0 probably means empty VBR header. We play safe
- and set a high threshold */
- if(bitrate == 0)
- bitrate = 320;
-
- bytes_per_sec = bitrate * 1000 / 8;
-
- if(time)
- {
- /* No drive spins up faster than 3.5s */
- if(time < 350)
- time = 350;
-
- time = time * 3;
- low_watermark = ((low_watermark_margin * HZ + time) *
- bytes_per_sec) / HZ;
- }
- else
- {
- low_watermark = MPEG_LOW_WATER;
- }
-}
-
-#ifdef HAVE_DISK_STORAGE
-void audio_set_buffer_margin(int setting)
-{
- low_watermark_margin = setting; /* in seconds */
-}
-#endif
-
-void audio_get_debugdata(struct audio_debug *dbgdata)
-{
- dbgdata->audiobuflen = audiobuflen;
- dbgdata->audiobuf_write = audiobuf_write;
- dbgdata->audiobuf_swapwrite = audiobuf_swapwrite;
- dbgdata->audiobuf_read = audiobuf_read;
-
- dbgdata->last_dma_chunk_size = last_dma_chunk_size;
-
- dbgdata->playing = playing;
- dbgdata->play_pending = play_pending;
- dbgdata->is_playing = is_playing;
- dbgdata->filling = filling;
- dbgdata->dma_underrun = dma_underrun;
-
- dbgdata->unplayed_space = get_unplayed_space();
- dbgdata->playable_space = get_playable_space();
- dbgdata->unswapped_space = get_unswapped_space();
-
- dbgdata->low_watermark_level = low_watermark;
- dbgdata->lowest_watermark_level = lowest_watermark_level;
-}
-
-#ifdef DEBUG
-static void dbg_timer_start(void)
-{
- /* We are using timer 2 */
-
- TSTR &= ~0x04; /* Stop the timer */
- TSNC &= ~0x04; /* No synchronization */
- TMDR &= ~0x44; /* Operate normally */
-
- TCNT2 = 0; /* Start counting at 0 */
- TCR2 = 0x03; /* Sysclock/8 */
-
- TSTR |= 0x04; /* Start timer 2 */
-}
-
-static int dbg_cnt2us(unsigned int cnt)
-{
- return (cnt * 10000) / (FREQ/800);
-}
-#endif /* DEBUG */
-
-static int get_unplayed_space(void)
-{
- int space = audiobuf_write - audiobuf_read;
- if (space < 0)
- space += audiobuflen;
- return space;
-}
-
-static int get_playable_space(void)
-{
- int space = audiobuf_swapwrite - audiobuf_read;
- if (space < 0)
- space += audiobuflen;
- return space;
-}
-
-static int get_unplayed_space_current_song(void)
-{
- int space;
-
- if (num_tracks_in_memory() > 1)
- {
- space = get_trackdata(1)->mempos - audiobuf_read;
- }
- else
- {
- space = audiobuf_write - audiobuf_read;
- }
-
- if (space < 0)
- space += audiobuflen;
-
- return space;
-}
-
-static int get_unswapped_space(void)
-{
- int space = audiobuf_write - audiobuf_swapwrite;
- if (space < 0)
- space += audiobuflen;
- return space;
-}
-
-void playback_tick(void)
-{
- struct trackdata *ptd = get_trackdata(0);
- if(ptd)
- {
- ptd->id3.elapsed += (current_tick - last_dma_tick) * 1000 / HZ;
- last_dma_tick = current_tick;
- audio_dispatch_event(AUDIO_EVENT_POS_REPORT,
- (unsigned long)ptd->id3.elapsed);
- }
-}
-
-static void reset_mp3_buffer(void)
-{
- audiobuf_read = 0;
- audiobuf_write = 0;
- audiobuf_swapwrite = 0;
- lowest_watermark_level = audiobuflen;
-}
-
- /* DMA transfer end interrupt callback */
-static void transfer_end(const void** ppbuf, size_t* psize)
-{
- if(playing && !paused)
- {
- int unplayed_space_left;
- int space_until_end_of_buffer;
- int track_offset = 1;
- struct trackdata *track;
-
- audiobuf_read += last_dma_chunk_size;
- if(audiobuf_read >= audiobuflen)
- audiobuf_read = 0;
-
- /* First, check if we are on a track boundary */
- if (num_tracks_in_memory() > 1)
- {
- if (audiobuf_read == get_trackdata(track_offset)->mempos)
- {
- if ( ! audio_dispatch_event(AUDIO_EVENT_END_OF_TRACK, 0) )
- {
- queue_post(&mpeg_queue, MPEG_TRACK_CHANGE, 0);
- track_offset++;
- }
- }
- }
-
- unplayed_space_left = get_unplayed_space();
-
- space_until_end_of_buffer = audiobuflen - audiobuf_read;
-
- if(!filling && unplayed_space_left < low_watermark)
- {
- filling = true;
- queue_post(&mpeg_queue, MPEG_NEED_DATA, GENERATE_UNBUFFER_EVENTS);
- }
-
- if(unplayed_space_left)
- {
- last_dma_chunk_size = MIN(0x2000, unplayed_space_left);
- last_dma_chunk_size = MIN(last_dma_chunk_size,
- space_until_end_of_buffer);
-
- /* several tracks loaded? */
- track = get_trackdata(track_offset);
- if(track)
- {
- /* will we move across the track boundary? */
- if (( audiobuf_read < track->mempos ) &&
- ((audiobuf_read+last_dma_chunk_size) >
- track->mempos ))
- {
- /* Make sure that we end exactly on the boundary */
- last_dma_chunk_size = track->mempos - audiobuf_read;
- }
- }
-
- *psize = last_dma_chunk_size & 0xffff;
- *ppbuf = mpeg_audiobuf + audiobuf_read;
- track = get_trackdata(0);
- if(track)
- track->id3.offset += last_dma_chunk_size;
-
- /* Update the watermark debug level */
- if(unplayed_space_left < lowest_watermark_level)
- lowest_watermark_level = unplayed_space_left;
- }
- else
- {
- /* Check if the end of data is because of a hard disk error.
- If there is an open file handle, we are still playing music.
- If not, the last file has been loaded, and the file handle is
- closed. */
- if(mpeg_file >= 0)
- {
- /* Update the watermark debug level */
- if(unplayed_space_left < lowest_watermark_level)
- lowest_watermark_level = unplayed_space_left;
-
- DEBUGF("DMA underrun.\n");
- dma_underrun = true;
- }
- else
- {
- if ( ! audio_dispatch_event(AUDIO_EVENT_END_OF_TRACK, 0) )
- {
- DEBUGF("No more MP3 data. Stopping.\n");
- queue_post(&mpeg_queue, MPEG_TRACK_CHANGE, 0);
- playing = false;
- }
- }
- *psize = 0; /* no more transfer */
- }
- }
-}
-
-static struct trackdata *add_track_to_tag_list(const char *filename)
-{
- struct trackdata *track;
- bool send_nid3_event;
-
- if(num_tracks_in_memory() >= MAX_TRACK_ENTRIES)
- {
- DEBUGF("Tag memory is full\n");
- return NULL;
- }
-
- track = &trackdata[track_write_idx];
-
- /* grab id3 tag of new file and
- remember where in memory it starts */
- if(mp3info(&track->id3, filename))
- {
- DEBUGF("Bad mp3\n");
- return NULL;
- }
- track->mempos = audiobuf_write;
- track->id3.elapsed = 0;
-#ifdef HAVE_LCD_BITMAP
- if (track->id3.title)
- lcd_getstringsize(track->id3.title, NULL, NULL);
- if (track->id3.artist)
- lcd_getstringsize(track->id3.artist, NULL, NULL);
- if (track->id3.album)
- lcd_getstringsize(track->id3.album, NULL, NULL);
-#endif
-
- /* if this track is the next track then let the UI know it can get it */
- send_nid3_event = (track_write_idx == track_read_idx + 1);
- track_write_idx = (track_write_idx+1) & MAX_TRACK_ENTRIES_MASK;
- if (send_nid3_event)
- send_track_event(PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, &track->id3);
- debug_tags();
- return track;
-}
-
-static int new_file(int steps)
-{
- int max_steps = playlist_amount();
- int start = 0;
- int i;
- struct trackdata *track;
- char name_buf[MAX_PATH+1];
- const char *trackname;
-
- /* Find out how many steps to advance. The load_ahead_index field tells
- us how many playlist entries it had to skip to get to a valid one.
- We add those together to find out where to start. */
- if(steps > 0 && num_tracks_in_memory() > 1)
- {
- /* Begin with the song after the currently playing one */
- i = 1;
- while((track = get_trackdata(i++)))
- {
- start += track->load_ahead_index;
- }
- }
-
- do {
- trackname = playlist_peek(start + steps, name_buf, sizeof(name_buf));
- if ( !trackname )
- return -1;
-
- DEBUGF("Loading %s\n", trackname);
-
- mpeg_file = open(trackname, O_RDONLY);
- if(mpeg_file < 0) {
- DEBUGF("Couldn't open file: %s\n",trackname);
- if(steps < 0)
- steps--;
- else
- steps++;
- }
- else
- {
- struct trackdata *track = add_track_to_tag_list(trackname);
-
- if(!track)
- {
- /* Bad mp3 file */
- if(steps < 0)
- steps--;
- else
- steps++;
- close(mpeg_file);
- mpeg_file = -1;
- }
- else
- {
- /* skip past id3v2 tag */
- lseek(mpeg_file,
- track->id3.first_frame_offset,
- SEEK_SET);
- track->id3.index = steps;
- track->load_ahead_index = steps;
- track->id3.offset = 0;
-
- if(track->id3.vbr)
- /* Average bitrate * 1.5 */
- recalculate_watermark(
- (track->id3.bitrate * 3) / 2);
- else
- recalculate_watermark(
- track->id3.bitrate);
-
- }
- }
-
- /* Bail out if no file could be opened */
- if(abs(steps) > max_steps)
- return -1;
- } while ( mpeg_file < 0 );
-
- return 0;
-}
-
-static void stop_playing(void)
-{
- /* Stop the current stream */
- mp3_play_stop();
- playing = false;
- filling = false;
-
- if(mpeg_file >= 0)
- close(mpeg_file);
- mpeg_file = -1;
- remove_all_tags();
- generate_unbuffer_events();
- reset_mp3_buffer();
-}
-
-static void end_current_track(void)
-{
- play_pending = false;
- playing = false;
- mp3_play_pause(false);
-
- reset_mp3_buffer();
- remove_all_tags();
- generate_unbuffer_events();
-
- if(mpeg_file >= 0)
- close(mpeg_file);
-}
-
-/* Is this a really the end of playback or is a new playlist starting */
-static void check_playlist_end(int direction)
-{
- /* Use the largest possible step size to account for skipped tracks */
- int steps = playlist_amount();
-
- if (direction < 0)
- steps = -steps;
-
- if (playlist_next(steps) < 0)
- is_playing = false;
-}
-
-static void update_playlist(void)
-{
- if (num_tracks_in_memory() > 0)
- {
- struct trackdata *track = get_trackdata(0);
- track->id3.index = playlist_next(track->id3.index);
- }
- else
- {
- /* End of playlist? */
- check_playlist_end(1);
- }
-
- playlist_update_resume_info(audio_current_track());
-}
-
-static void track_change(void)
-{
- DEBUGF("Track change\n");
-
- if (num_tracks_in_memory() > 0)
- {
- remove_current_tag();
- update_playlist();
- if (is_playing)
- {
- send_track_event(PLAYBACK_EVENT_TRACK_CHANGE,
- audio_current_track());
- }
- }
-
- current_track_counter++;
-}
-
-#ifdef DEBUG
-void hexdump(const unsigned char *buf, int len)
-{
- int i;
-
- for(i = 0;i < len;i++)
- {
- if(i && (i & 15) == 0)
- {
- DEBUGF("\n");
- }
- DEBUGF("%02x ", buf[i]);
- }
- DEBUGF("\n");
-}
-#endif /* DEBUG */
-
-static void start_playback_if_ready(void)
-{
- int playable_space;
-
- playable_space = audiobuf_swapwrite - audiobuf_read;
- if(playable_space < 0)
- playable_space += audiobuflen;
-
- /* See if we have started playing yet. If not, do it. */
- if(play_pending || dma_underrun)
- {
- /* If the filling has stopped, and we still haven't reached
- the watermark, the file must be smaller than the
- watermark. We must still play it. */
- if((playable_space >= MPEG_PLAY_PENDING_THRESHOLD) ||
- !filling || dma_underrun)
- {
- DEBUGF("P\n");
- if (play_pending) /* don't do this when recovering from DMA underrun */
- {
- generate_postbuffer_events(); /* signal first track as buffered */
- if (play_pending_track_change)
- {
- play_pending_track_change = false;
- send_track_event(PLAYBACK_EVENT_TRACK_CHANGE,
- audio_current_track());
- }
- play_pending = false;
- }
- playing = true;
-
- last_dma_chunk_size = MIN(0x2000, get_unplayed_space_current_song());
- mp3_play_data(mpeg_audiobuf + audiobuf_read, last_dma_chunk_size, transfer_end);
- dma_underrun = false;
-
- if (!paused)
- {
- last_dma_tick = current_tick;
- mp3_play_pause(true);
- }
-
- /* Tell ourselves that we need more data */
- queue_post(&mpeg_queue, MPEG_NEED_DATA, 0);
- }
- }
-}
-
-static bool swap_one_chunk(void)
-{
- int free_space_left;
- int amount_to_swap;
-
- free_space_left = get_unswapped_space();
-
- if(free_space_left == 0 && !play_pending)
- return false;
-
- /* Swap in larger chunks when the user is waiting for the playback
- to start, or when there is dangerously little playable data left */
- if(play_pending)
- amount_to_swap = MIN(MPEG_PLAY_PENDING_SWAPSIZE, free_space_left);
- else
- {
- if(get_playable_space() < low_watermark)
- amount_to_swap = MIN(MPEG_LOW_WATER_SWAP_CHUNKSIZE,
- free_space_left);
- else
- amount_to_swap = MIN(MPEG_SWAP_CHUNKSIZE, free_space_left);
- }
-
- if(audiobuf_write < audiobuf_swapwrite)
- amount_to_swap = MIN(audiobuflen - audiobuf_swapwrite,
- amount_to_swap);
- else
- amount_to_swap = MIN(audiobuf_write - audiobuf_swapwrite,
- amount_to_swap);
-
- bitswap(mpeg_audiobuf + audiobuf_swapwrite, amount_to_swap);
-
- audiobuf_swapwrite += amount_to_swap;
- if(audiobuf_swapwrite >= audiobuflen)
- {
- audiobuf_swapwrite = 0;
- }
-
- return true;
-}
-
-static void mpeg_thread(void)
-{
- static int pause_tick = 0;
- static unsigned int pause_track = 0;
- struct queue_event ev;
- int len;
- int free_space_left;
- int unplayed_space_left;
- int amount_to_read;
- int t1, t2;
- unsigned long start_elapsed, start_offset;
-
- is_playing = false;
- play_pending = false;
- playing = false;
- mpeg_file = -1;
-
- while(1)
- {
- yield();
-
- /* Swap if necessary, and don't block on the queue_wait() */
- if(swap_one_chunk())
- {
- queue_wait_w_tmo(&mpeg_queue, &ev, 0);
- }
- else if (playing)
- {
- /* periodically update resume info */
- queue_wait_w_tmo(&mpeg_queue, &ev, HZ/2);
- }
- else
- {
- DEBUGF("S R:%x W:%x SW:%x\n",
- audiobuf_read, audiobuf_write, audiobuf_swapwrite);
- queue_wait(&mpeg_queue, &ev);
- }
-
- start_playback_if_ready();
-
- switch(ev.id)
- {
- case MPEG_PLAY:
- DEBUGF("MPEG_PLAY\n");
-
-#if CONFIG_TUNER
- /* Silence the A/D input, it may be on because the radio
- may be playing */
- mas_codec_writereg(6, 0x0000);
-#endif /* CONFIG_TUNER */
-
- /* Stop the current stream */
- paused = false;
- end_current_track();
-
- if ( new_file(0) == -1 )
- {
- is_playing = false;
- track_change();
- break;
- }
-
- start_elapsed = ((struct audio_resume_info *)ev.data)->elapsed;
- start_offset = ((struct audio_resume_info *)ev.data)->offset;
-
- /* mid-song resume? */
- if (!start_offset && start_elapsed) {
- struct mp3entry *id3 = &get_trackdata(0)->id3;
- id3->elapsed = start_elapsed;
- start_offset = audio_get_file_pos_int(id3);
- }
-
- if (start_offset) {
- struct mp3entry* id3 = &get_trackdata(0)->id3;
- lseek(mpeg_file, start_offset, SEEK_SET);
- id3->offset = start_offset;
- set_elapsed(id3);
- }
- else {
- /* skip past id3v2 tag */
- lseek(mpeg_file,
- get_trackdata(0)->id3.first_frame_offset,
- SEEK_SET);
-
- }
-
- /* Make it read more data */
- filling = true;
- queue_post(&mpeg_queue, MPEG_NEED_DATA, 0);
-
- /* Tell the file loading code that we want to start playing
- as soon as we have some data */
- play_pending = true;
- play_pending_track_change = true;
-
- update_playlist();
- current_track_counter++;
- break;
-
- case MPEG_STOP:
- do_stop();
- break;
-
- case MPEG_PAUSE:
- DEBUGF("MPEG_PAUSE\n");
- /* Stop the current stream */
- if (playing)
- playlist_update_resume_info(audio_current_track());
- paused = true;
- playing = false;
- pause_tick = current_tick;
- pause_track = current_track_counter;
- mp3_play_pause(false);
- break;
-
- case MPEG_RESUME:
- DEBUGF("MPEG_RESUME\n");
- /* Continue the current stream */
- paused = false;
- if (!play_pending)
- {
- playing = true;
- if ( current_track_counter == pause_track )
- last_dma_tick += current_tick - pause_tick;
- else
- last_dma_tick = current_tick;
- pause_tick = 0;
- mp3_play_pause(true);
- }
- break;
-
- case MPEG_NEXT:
- DEBUGF("MPEG_NEXT\n");
- /* is next track in ram? */
- if ( num_tracks_in_memory() > 1 ) {
- int unplayed_space_left, unswapped_space_left;
-
- /* stop the current stream */
- play_pending = false;
- playing = false;
- mp3_play_pause(false);
-
- track_change();
- audiobuf_read = get_trackdata(0)->mempos;
- last_dma_chunk_size = MIN(0x2000, get_unplayed_space_current_song());
- mp3_play_data(mpeg_audiobuf + audiobuf_read, last_dma_chunk_size, transfer_end);
- dma_underrun = false;
- last_dma_tick = current_tick;
-
- unplayed_space_left = get_unplayed_space();
- unswapped_space_left = get_unswapped_space();
-
- /* should we start reading more data? */
- if(!filling && (unplayed_space_left < low_watermark)) {
- filling = true;
- queue_post(&mpeg_queue, MPEG_NEED_DATA, GENERATE_UNBUFFER_EVENTS);
- play_pending = true;
- } else if(unswapped_space_left &&
- unswapped_space_left > unplayed_space_left) {
- /* Stop swapping the data from the previous file */
- audiobuf_swapwrite = audiobuf_read;
- play_pending = true;
- } else {
- playing = true;
- if (!paused)
- mp3_play_pause(true);
- }
- }
- else {
- if (!playlist_check(1))
- break;
-
- /* stop the current stream */
- end_current_track();
-
- if (new_file(1) < 0) {
- DEBUGF("No more files to play\n");
- filling = false;
-
- check_playlist_end(1);
- current_track_counter++;
- } else {
- /* Make it read more data */
- filling = true;
- queue_post(&mpeg_queue, MPEG_NEED_DATA, 0);
-
- /* Tell the file loading code that we want
- to start playing as soon as we have some data */
- play_pending = true;
- play_pending_track_change = true;
-
- update_playlist();
- current_track_counter++;
- }
- }
- break;
-
- case MPEG_PREV: {
- DEBUGF("MPEG_PREV\n");
-
- if (!playlist_check(-1))
- break;
-
- /* stop the current stream */
- end_current_track();
-
- /* Open the next file */
- if (new_file(-1) < 0) {
- DEBUGF("No more files to play\n");
- filling = false;
-
- check_playlist_end(-1);
- current_track_counter++;
- } else {
- /* Make it read more data */
- filling = true;
- queue_post(&mpeg_queue, MPEG_NEED_DATA, 0);
-
- /* Tell the file loading code that we want to
- start playing as soon as we have some data */
- play_pending = true;
- play_pending_track_change = true;
-
- update_playlist();
- current_track_counter++;
- }
- break;
- }
-
- case MPEG_FF_REWIND: {
- struct mp3entry *id3 = audio_current_track();
- unsigned int oldtime = id3->elapsed;
- unsigned int newtime = (unsigned int)ev.data;
- int curpos, newpos, diffpos;
- DEBUGF("MPEG_FF_REWIND\n");
-
- id3->elapsed = newtime;
-
- newpos = audio_get_file_pos_int(id3);
- if(newpos < 0)
- {
- id3->elapsed = oldtime;
- break;
- }
-
- if (mpeg_file >= 0)
- curpos = lseek(mpeg_file, 0, SEEK_CUR);
- else
- curpos = id3->filesize;
-
- if (num_tracks_in_memory() > 1)
- {
- /* We have started loading other tracks that need to be
- accounted for */
- struct trackdata *track;
- int i = 0;
-
- while((track = get_trackdata(i++)))
- {
- curpos += track->id3.filesize;
- }
- }
-
- diffpos = curpos - newpos;
-
- if(!filling && diffpos >= 0 && diffpos < audiobuflen)
- {
- int unplayed_space_left, unswapped_space_left;
-
- /* We are changing to a position that's already in
- memory, so we just move the DMA read pointer. */
- audiobuf_read = audiobuf_write - diffpos;
- if (audiobuf_read < 0)
- {
- audiobuf_read += audiobuflen;
- }
-
- unplayed_space_left = get_unplayed_space();
- unswapped_space_left = get_unswapped_space();
-
- /* If unswapped_space_left is larger than
- unplayed_space_left, it means that the swapwrite pointer
- hasn't yet advanced up to the new location of the read
- pointer. We just move it, there is no need to swap
- data that won't be played anyway. */
-
- if (unswapped_space_left > unplayed_space_left)
- {
- DEBUGF("Moved swapwrite\n");
- audiobuf_swapwrite = audiobuf_read;
- play_pending = true;
- }
-
- if (mpeg_file>=0 && unplayed_space_left < low_watermark)
- {
- /* We need to load more data before starting */
- filling = true;
- queue_post(&mpeg_queue, MPEG_NEED_DATA, GENERATE_UNBUFFER_EVENTS);
- play_pending = true;
- }
- else
- {
- /* resume will start at new position */
- last_dma_chunk_size =
- MIN(0x2000, get_unplayed_space_current_song());
- mp3_play_data(mpeg_audiobuf + audiobuf_read,
- last_dma_chunk_size, transfer_end);
- dma_underrun = false;
- }
- }
- else
- {
- /* Move to the new position in the file and start
- loading data */
- reset_mp3_buffer();
-
- if (num_tracks_in_memory() > 1)
- {
- /* We have to reload the current track */
- close(mpeg_file);
- remove_all_non_current_tags();
- generate_unbuffer_events();
- mpeg_file = -1;
- }
-
- if (mpeg_file < 0)
- {
- mpeg_file = open(id3->path, O_RDONLY);
- if (mpeg_file < 0)
- {
- id3->elapsed = oldtime;
- break;
- }
- }
-
- if(-1 == lseek(mpeg_file, newpos, SEEK_SET))
- {
- id3->elapsed = oldtime;
- break;
- }
-
- filling = true;
- queue_post(&mpeg_queue, MPEG_NEED_DATA, 0);
-
- /* Tell the file loading code that we want to start playing
- as soon as we have some data */
- play_pending = true;
- }
-
- id3->offset = newpos;
-
- break;
- }
-
- case MPEG_FLUSH_RELOAD: {
- int numtracks = num_tracks_in_memory();
- bool reload_track = false;
-
- if (numtracks > 1)
- {
- /* Reset the buffer */
- audiobuf_write = get_trackdata(1)->mempos;
-
- /* Reset swapwrite unless we're still swapping current
- track */
- if (get_unplayed_space() <= get_playable_space())
- audiobuf_swapwrite = audiobuf_write;
-
- close(mpeg_file);
- remove_all_non_current_tags();
- generate_unbuffer_events();
- mpeg_file = -1;
- reload_track = true;
- }
- else if (numtracks == 1 && mpeg_file < 0)
- {
- reload_track = true;
- }
-
- if(reload_track && new_file(1) >= 0)
- {
- /* Tell ourselves that we want more data */
- filling = true;
- queue_post(&mpeg_queue, MPEG_NEED_DATA, 0);
- }
-
- break;
- }
-
- case MPEG_NEED_DATA:
- free_space_left = audiobuf_read - audiobuf_write;
-
- /* We interpret 0 as "empty buffer" */
- if(free_space_left <= 0)
- free_space_left += audiobuflen;
-
- unplayed_space_left = audiobuflen - free_space_left;
-
- /* Make sure that we don't fill the entire buffer */
- free_space_left -= MPEG_HIGH_WATER;
-
- if (ev.data == GENERATE_UNBUFFER_EVENTS)
- generate_unbuffer_events();
-
- /* do we have any more buffer space to fill? */
- if(free_space_left <= 0)
- {
- DEBUGF("0\n");
- filling = false;
- generate_postbuffer_events();
- storage_sleep();
- break;
- }
-
- /* Read small chunks while we are below the low water mark */
- if(unplayed_space_left < low_watermark)
- amount_to_read = MIN(MPEG_LOW_WATER_CHUNKSIZE,
- free_space_left);
- else
- amount_to_read = free_space_left;
-
- /* Don't read more than until the end of the buffer */
- amount_to_read = MIN(audiobuflen - audiobuf_write,
- amount_to_read);
-#if (CONFIG_STORAGE & STORAGE_MMC)
- /* MMC is slow, so don't read too large chunks */
- amount_to_read = MIN(0x40000, amount_to_read);
-#elif MEMORYSIZE == 8
- amount_to_read = MIN(0x100000, amount_to_read);
-#endif
-
- /* Read as much mpeg data as we can fit in the buffer */
- if(mpeg_file >= 0)
- {
- DEBUGF("R\n");
- t1 = current_tick;
- len = read(mpeg_file, mpeg_audiobuf + audiobuf_write,
- amount_to_read);
- if(len > 0)
- {
- t2 = current_tick;
- DEBUGF("time: %d\n", t2 - t1);
- DEBUGF("R: %x\n", len);
-
- /* Now make sure that we don't feed the MAS with ID3V1
- data */
- if (len < amount_to_read)
- {
- int i;
- static const unsigned char tag[] = "TAG";
- int taglen = 128;
- int tagptr = audiobuf_write + len - 128;
-
- /* Really rare case: entire potential tag wasn't
- read in this call AND audiobuf_write < 128 */
- if (tagptr < 0)
- tagptr += audiobuflen;
-
- for(i = 0;i < 3;i++)
- {
- if(tagptr >= audiobuflen)
- tagptr -= audiobuflen;
-
- if(mpeg_audiobuf[tagptr] != tag[i])
- {
- taglen = 0;
- break;
- }
-
- tagptr++;
- }
-
- if(taglen)
- {
- /* Skip id3v1 tag */
- DEBUGF("Skipping ID3v1 tag\n");
- len -= taglen;
-
- /* In the very rare case when the entire tag
- wasn't read in this read() len will be < 0.
- Take care of this when changing the write
- pointer. */
- }
- }
-
- audiobuf_write += len;
-
- if (audiobuf_write < 0)
- audiobuf_write += audiobuflen;
-
- if(audiobuf_write >= audiobuflen)
- {
- audiobuf_write = 0;
- DEBUGF("W\n");
- }
-
- /* Tell ourselves that we want more data */
- queue_post(&mpeg_queue, MPEG_NEED_DATA, 0);
- }
- else
- {
- if(len < 0)
- {
- DEBUGF("MPEG read error\n");
- }
-
- close(mpeg_file);
- mpeg_file = -1;
-
- if(new_file(1) < 0)
- {
- /* No more data to play */
- DEBUGF("No more files to play\n");
- filling = false;
- }
- else
- {
- /* Tell ourselves that we want more data */
- queue_post(&mpeg_queue, MPEG_NEED_DATA, 0);
- }
- }
- }
- break;
-
- case MPEG_TRACK_CHANGE:
- track_change();
- break;
-
-#ifndef USB_NONE
- case SYS_USB_CONNECTED:
- is_playing = false;
- paused = false;
- stop_playing();
-
- /* Tell the USB thread that we are safe */
- DEBUGF("mpeg_thread got SYS_USB_CONNECTED\n");
- usb_acknowledge(SYS_USB_CONNECTED_ACK);
-
- /* Wait until the USB cable is extracted again */
- usb_wait_for_disconnect(&mpeg_queue);
- break;
-#endif /* !USB_NONE */
-
- case SYS_TIMEOUT:
- if (playing)
- playlist_update_resume_info(audio_current_track());
- break;
- }
- }
-}
-#endif /* !SIMULATOR */
-
-struct mp3entry* audio_current_track(void)
-{
-#ifdef SIMULATOR
- struct mp3entry *id3 = &taginfo;
-#else /* !SIMULATOR */
- if(num_tracks_in_memory())
- {
- struct mp3entry *id3 = &get_trackdata(0)->id3;
-#endif
- if (!checked_for_cuesheet && curr_cuesheet && id3->cuesheet == NULL)
- {
- checked_for_cuesheet = true; /* only check once per track */
- struct cuesheet_file cue_file;
-
- if (look_for_cuesheet_file(id3, &cue_file) &&
- parse_cuesheet(&cue_file, curr_cuesheet))
- {
- id3->cuesheet = curr_cuesheet;
- }
- }
- return id3;
-#ifndef SIMULATOR
- }
- else
- return NULL;
-#endif /* !SIMULATOR */
-}
-
-struct mp3entry* audio_next_track(void)
-{
-#ifdef SIMULATOR
- return &taginfo;
-#else /* !SIMULATOR */
- if(num_tracks_in_memory() > 1)
- return &get_trackdata(1)->id3;
- else
- return NULL;
-#endif /* !SIMULATOR */
-}
-
-size_t audio_buffer_size(void)
-{
- if (audiobuf_handle > 0)
- return audiobuflen;
- return 0;
-}
-
-size_t audio_buffer_available(void)
-{
- size_t size = 0;
- size_t core_size = core_available();
- if (audiobuf_handle > 0)
- return audiobuflen - AUDIO_BUFFER_RESERVE - 128;
- return MAX(core_size, size);
-}
-
-static void audio_reset_buffer_noalloc(void* buf, size_t bufsize)
-{
- mpeg_audiobuf = buf;
- audiobuflen = bufsize;
- if (global_settings.cuesheet)
- { /* enable cuesheet support */
- curr_cuesheet = (struct cuesheet*)mpeg_audiobuf;
- mpeg_audiobuf = SKIPBYTES(mpeg_audiobuf, sizeof(struct cuesheet));
- audiobuflen -= sizeof(struct cuesheet);
- }
-}
-
-static void audio_reset_buffer(void)
-{
- size_t bufsize = audiobuflen;
-
- /* alloc buffer if it's was never allocated or freed by audio_hard_stop()
- * because voice cannot be played during audio playback make
- * talk.c give up all buffers and disable itself */
- if (!audiobuf_handle)
- {
- talk_buffer_set_policy(TALK_BUFFER_LOOSE);
- audiobuf_handle = core_alloc_maximum("audiobuf", &bufsize, &ops);
- }
-
- audio_reset_buffer_noalloc(core_get_data(audiobuf_handle), bufsize);
-}
-
-void audio_play(unsigned long elapsed, unsigned long offset)
-{
- audio_reset_buffer();
-#ifdef SIMULATOR
- char name_buf[MAX_PATH+1];
- const char* trackname;
- int steps=0;
-
- is_playing = true;
-
- do {
- trackname = playlist_peek(steps, name_buf, sizeof(name_buf));
- if (!trackname)
- break;
- if(mp3info(&taginfo, trackname)) {
- /* bad mp3, move on */
- if(++steps > playlist_amount())
- break;
- continue;
- }
-#ifdef HAVE_MPEG_PLAY
- real_mpeg_play(trackname);
-#endif
- playlist_next(steps);
- if (!offset && elapsed)
- {
- /* has an elapsed time but no offset; elapsed may take
- precedence in this case */
- taginfo.elapsed = elapsed;
- taginfo.offset = audio_get_file_pos_int(&taginfo);
- }
- else
- {
- taginfo.offset = offset;
- set_elapsed(&taginfo);
- }
- is_playing = true;
- playing = true;
- break;
- } while(1);
-#else /* !SIMULATOR */
- static struct audio_resume_info resume;
- is_playing = true;
- resume.elapsed = elapsed;
- resume.offset = offset;
- queue_post(&mpeg_queue, MPEG_PLAY, (intptr_t)&resume);
-#endif /* !SIMULATOR */
-
- mpeg_errno = 0;
-}
-
-void audio_stop(void)
-{
- if (audiobuf_handle <= 0)
- return; /* nothing to do, must be hard-stopped already */
-#ifndef SIMULATOR
- mpeg_stop_done = false;
- queue_post(&mpeg_queue, MPEG_STOP, 0);
- while(!mpeg_stop_done)
- yield();
-#else /* SIMULATOR */
- paused = false;
- is_playing = false;
- playing = false;
-#endif /* SIMULATOR */
-}
-
-/* dummy */
-void audio_stop_recording(void)
-{
- audio_stop();
-}
-
-void audio_hard_stop(void)
-{
- if (audiobuf_handle > 0)
- {
- audio_stop();
- audiobuf_handle = core_free(audiobuf_handle);
- mpeg_audiobuf = NULL;
- talk_buffer_set_policy(TALK_BUFFER_DEFAULT);
- }
-}
-
-void audio_pause(void)
-{
-#ifndef SIMULATOR
- queue_post(&mpeg_queue, MPEG_PAUSE, 0);
-#else /* SIMULATOR */
- is_playing = true;
- playing = false;
- paused = true;
-#endif /* SIMULATOR */
-}
-
-void audio_resume(void)
-{
-#ifndef SIMULATOR
- queue_post(&mpeg_queue, MPEG_RESUME, 0);
-#else /* SIMULATOR */
- is_playing = true;
- playing = true;
- paused = false;
-#endif /* SIMULATOR */
-}
-
-void audio_next(void)
-{
-#ifndef SIMULATOR
- queue_remove_from_head(&mpeg_queue, MPEG_NEED_DATA);
- queue_post(&mpeg_queue, MPEG_NEXT, 0);
-#else /* SIMULATOR */
- char name_buf[MAX_PATH+1];
- const char* file;
- int steps = 1;
-
- do {
- file = playlist_peek(steps, name_buf, sizeof(name_buf));
- if(!file)
- break;
- if(mp3info(&taginfo, file)) {
- if(++steps > playlist_amount())
- break;
- continue;
- }
- playlist_next(steps);
- current_track_counter++;
- is_playing = true;
- playing = true;
- break;
- } while(1);
-#endif /* SIMULATOR */
-}
-
-void audio_prev(void)
-{
-#ifndef SIMULATOR
- queue_remove_from_head(&mpeg_queue, MPEG_NEED_DATA);
- queue_post(&mpeg_queue, MPEG_PREV, 0);
-#else /* SIMULATOR */
- char name_buf[MAX_PATH+1];
- const char* file;
- int steps = -1;
-
- do {
- file = playlist_peek(steps, name_buf, sizeof(name_buf));
- if(!file)
- break;
- if(mp3info(&taginfo, file)) {
- steps--;
- continue;
- }
- playlist_next(steps);
- current_track_counter++;
- is_playing = true;
- playing = true;
- break;
- } while(1);
-#endif /* SIMULATOR */
-}
-
-void audio_ff_rewind(long newpos)
-{
-#ifndef SIMULATOR
- queue_post(&mpeg_queue, MPEG_FF_REWIND, newpos);
-#else /* SIMULATOR */
- (void)newpos;
-#endif /* SIMULATOR */
-}
-
-void audio_flush_and_reload_tracks(void)
-{
-#ifndef SIMULATOR
- queue_post(&mpeg_queue, MPEG_FLUSH_RELOAD, 0);
-#endif /* !SIMULATOR*/
-}
-
-int audio_status(void)
-{
- int ret = 0;
-
- if(is_playing)
- ret |= AUDIO_STATUS_PLAY;
-
- if(paused)
- ret |= AUDIO_STATUS_PAUSE;
-
- if(mpeg_errno)
- ret |= AUDIO_STATUS_ERROR;
-
- return ret;
-}
-
-/* Unused function
-unsigned int audio_error(void)
-{
- return mpeg_errno;
-}
-*/
-
-void audio_error_clear(void)
-{
- mpeg_errno = 0;
-}
-
-#ifdef SIMULATOR
-static void mpeg_thread(void)
-{
- struct mp3entry* id3;
- while ( 1 ) {
- if (is_playing) {
- id3 = audio_current_track();
- if (!paused)
- {
- id3->elapsed+=1000;
- id3->offset+=1000;
- }
- if (id3->elapsed>=id3->length)
- audio_next();
- }
- sleep(HZ);
- }
-}
-#endif /* SIMULATOR */
-
-void audio_init(void)
-{
- mpeg_errno = 0;
-
- audio_reset_buffer();
-
-#ifndef SIMULATOR
- queue_init(&mpeg_queue, true);
-#endif /* !SIMULATOR */
- audio_thread_id = create_thread(mpeg_thread, mpeg_stack,
- sizeof(mpeg_stack), 0, mpeg_thread_name
- IF_PRIO(, PRIORITY_SYSTEM)
- IF_COP(, CPU));
-
- memset(trackdata, 0, sizeof(trackdata));
-
-#ifdef DEBUG
-#ifndef SIMULATOR
- dbg_timer_start();
- dbg_cnt2us(0);
-#endif /* !SIMULATOR */
-#endif /* DEBUG */
- audio_is_initialized = true;
-}
-
-#endif /* CONFIG_CODEC != SWCODEC */
diff --git a/apps/mpeg.h b/apps/mpeg.h
deleted file mode 100644
index 106933dba3..0000000000
--- a/apps/mpeg.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * 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.
- *
- ****************************************************************************/
-#ifndef _MPEG_H_
-#define _MPEG_H_
-
-#if CONFIG_CODEC != SWCODEC
-unsigned long mpeg_get_last_header(void);
-
-#endif
-#endif
diff --git a/apps/playback.h b/apps/playback.h
index c2682e6baf..a87ef873d0 100644
--- a/apps/playback.h
+++ b/apps/playback.h
@@ -26,7 +26,6 @@
#include <stdlib.h>
#include "config.h"
-#if CONFIG_CODEC == SWCODEC
/* Including the code for fast previews is entirely optional since it
does add two more mp3entry's - for certain targets it may be less
beneficial such as flash-only storage */
@@ -34,8 +33,6 @@
#define AUDIO_FAST_SKIP_PREVIEW
#endif
-#endif /* CONFIG_CODEC == SWCODEC */
-
#ifdef HAVE_ALBUMART
#include "bmp.h"
diff --git a/apps/playlist.c b/apps/playlist.c
index 2bdc1f39cc..f903458004 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -647,11 +647,7 @@ static int create_and_play_dir(int direction, bool play_last)
else
index = 0;
-#if (CONFIG_CODEC == SWCODEC)
current_playlist.started = true;
-#else
- playlist_start(index, 0, 0);
-#endif
}
/* we've overwritten the dircache when getting the next/previous dir,
@@ -1090,7 +1086,6 @@ static int calculate_step_count(const struct playlist_info *playlist, int steps)
return steps;
}
-#if CONFIG_CODEC == SWCODEC
/* Marks the index of the track to be skipped that is "steps" away from
* current playing track.
*/
@@ -1100,7 +1095,7 @@ void playlist_skip_entry(struct playlist_info *playlist, int steps)
if (playlist == NULL)
playlist = &current_playlist;
-
+
/* need to account for already skipped tracks */
steps = calculate_step_count(playlist, steps);
@@ -1112,7 +1107,6 @@ void playlist_skip_entry(struct playlist_info *playlist, int steps)
playlist->indices[index] |= PLAYLIST_SKIPPED;
}
-#endif /* CONFIG_CODEC == SWCODEC */
/*
* returns the index of the track that is "steps" away from current playing
@@ -2649,11 +2643,9 @@ const char* playlist_peek(int steps, char* buf, size_t buf_size)
if (index < 0)
return NULL;
-#if CONFIG_CODEC == SWCODEC
/* Just testing - don't care about the file name */
if (!buf || !buf_size)
return "";
-#endif
control_file = playlist->indices[index] & PLAYLIST_INSERT_TYPE_MASK;
seek = playlist->indices[index] & PLAYLIST_SEEK_MASK;
@@ -2730,11 +2722,7 @@ int playlist_next(int steps)
sort_playlist(playlist, false, false);
randomise_playlist(playlist, current_tick, false, true);
-#if CONFIG_CODEC == SWCODEC
playlist->started = true;
-#else
- playlist_start(0, 0, 0);
-#endif
playlist->index = 0;
index = 0;
}
@@ -2780,7 +2768,6 @@ int playlist_next(int steps)
return index;
}
-#if CONFIG_CODEC == SWCODEC
/* try playing next or previous folder */
bool playlist_next_dir(int direction)
{
@@ -2790,7 +2777,6 @@ bool playlist_next_dir(int direction)
return create_and_play_dir(direction, false) >= 0;
}
-#endif /* CONFIG_CODEC == SWCODEC */
/* Get resume info for current playing song. If return value is -1 then
settings shouldn't be saved. */
diff --git a/apps/playlist.h b/apps/playlist.h
index 220a577fb2..2eca7355e4 100644
--- a/apps/playlist.h
+++ b/apps/playlist.h
@@ -139,9 +139,7 @@ void playlist_start(int start_index, unsigned long elapsed,
bool playlist_check(int steps);
const char *playlist_peek(int steps, char* buf, size_t buf_size);
int playlist_next(int steps);
-#if CONFIG_CODEC == SWCODEC
bool playlist_next_dir(int direction);
-#endif
int playlist_get_resume_info(int *resume_index);
int playlist_update_resume_info(const struct mp3entry* id3);
int playlist_get_display_index(void);
@@ -165,9 +163,7 @@ int playlist_insert_directory(struct playlist_info* playlist,
bool recurse);
int playlist_insert_playlist(struct playlist_info* playlist, const char *filename,
int position, bool queue);
-#if CONFIG_CODEC == SWCODEC
void playlist_skip_entry(struct playlist_info *playlist, int steps);
-#endif
int playlist_delete(struct playlist_info* playlist, int index);
int playlist_move(struct playlist_info* playlist, int index, int new_index);
int playlist_randomise(struct playlist_info* playlist, unsigned int seed,
diff --git a/apps/plugin.c b/apps/plugin.c
index 0ab73281ee..4c0f44b2e8 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -466,7 +466,6 @@ static const struct plugin_api rockbox_api = {
thread_self,
thread_exit,
thread_wait,
-#if (CONFIG_CODEC == SWCODEC)
thread_thaw,
#ifdef HAVE_PRIORITY_SCHEDULING
thread_set_priority,
@@ -474,7 +473,6 @@ static const struct plugin_api rockbox_api = {
mutex_init,
mutex_lock,
mutex_unlock,
-#endif
#ifdef HAVE_SEMAPHORE_OBJECTS
semaphore_init,
semaphore_wait,
@@ -517,13 +515,11 @@ static const struct plugin_api rockbox_api = {
queue_delete,
queue_post,
queue_wait_w_tmo,
-#if CONFIG_CODEC == SWCODEC
queue_enable_queue_send,
queue_empty,
queue_wait,
queue_send,
queue_reply,
-#endif
#ifdef RB_PROFILE
profile_thread,
@@ -601,7 +597,7 @@ static const struct plugin_api rockbox_api = {
#ifdef AUDIOHW_HAVE_EQ
sound_enum_hw_eq_band_setting,
#endif
-#if ((CONFIG_CODEC == SWCODEC)) && defined (HAVE_PITCHCONTROL)
+#if defined (HAVE_PITCHCONTROL)
sound_set_pitch,
#endif
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
@@ -609,11 +605,7 @@ static const struct plugin_api rockbox_api = {
mp3_play_pause,
mp3_play_stop,
mp3_is_playing,
-#if CONFIG_CODEC != SWCODEC
- bitswap,
#endif
-#endif
-#if CONFIG_CODEC == SWCODEC
&audio_master_sampr_list[0],
&hw_freq_sampr[0],
pcm_apply_settings,
@@ -667,7 +659,6 @@ static const struct plugin_api rockbox_api = {
pcmbuf_fade,
system_sound_play,
keyclick_click,
-#endif /* CONFIG_CODEC == SWCODEC */
/* metadata */
get_metadata,
@@ -716,9 +707,6 @@ static const struct plugin_api rockbox_api = {
audio_current_track,
audio_flush_and_reload_tracks,
audio_get_file_pos,
-#if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
- mpeg_get_last_header,
-#endif
/* menu */
root_menu_get_options,
@@ -783,7 +771,6 @@ static const struct plugin_api rockbox_api = {
#ifdef ROCKBOX_HAS_LOGF
_logf,
#endif
-#if CONFIG_CODEC == SWCODEC
codec_thread_do_callback,
codec_load_file,
codec_run_proc,
@@ -792,7 +779,6 @@ static const struct plugin_api rockbox_api = {
find_array_ptr,
remove_array_ptr,
round_value_to_list32,
-#endif /* CONFIG_CODEC == SWCODEC */
#ifdef HAVE_LCD_BITMAP
read_bmp_file,
diff --git a/apps/plugin.h b/apps/plugin.h
index 8584d45fa7..41f65947a3 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -66,9 +66,8 @@ void* plugin_get_buffer(size_t *buffer_size);
#include "scroll_engine.h"
#include "metadata.h"
#include "sound.h"
-#include "mpeg.h"
#include "audio.h"
-#include "mp3_playback.h"
+#include "voice_thread.h"
#include "root_menu.h"
#include "talk.h"
#include "lang_enum.h"
@@ -77,7 +76,6 @@ void* plugin_get_buffer(size_t *buffer_size);
#endif
#include "misc.h"
#include "pathfuncs.h"
-#if (CONFIG_CODEC == SWCODEC)
#include "pcm_mixer.h"
#include "dsp-util.h"
#include "dsp_core.h"
@@ -88,7 +86,6 @@ void* plugin_get_buffer(size_t *buffer_size);
#ifdef HAVE_RECORDING
#include "recording.h"
#endif
-#endif /* CONFIG_CODEC == SWCODEC */
#include "settings.h"
#include "timer.h"
#include "playlist.h"
@@ -526,7 +523,6 @@ struct plugin_api {
unsigned int (*thread_self)(void);
void (*thread_exit)(void);
void (*thread_wait)(unsigned int thread_id);
-#if CONFIG_CODEC == SWCODEC
void (*thread_thaw)(unsigned int thread_id);
#ifdef HAVE_PRIORITY_SCHEDULING
int (*thread_set_priority)(unsigned int thread_id, int priority);
@@ -534,7 +530,6 @@ struct plugin_api {
void (*mutex_init)(struct mutex *m);
void (*mutex_lock)(struct mutex *m);
void (*mutex_unlock)(struct mutex *m);
-#endif
#ifdef HAVE_SEMAPHORE_OBJECTS
void (*semaphore_init)(struct semaphore *s, int max, int start);
int (*semaphore_wait)(struct semaphore *s, int timeout);
@@ -580,7 +575,6 @@ struct plugin_api {
void (*queue_post)(struct event_queue *q, long id, intptr_t data);
void (*queue_wait_w_tmo)(struct event_queue *q, struct queue_event *ev,
int ticks);
-#if CONFIG_CODEC == SWCODEC
void (*queue_enable_queue_send)(struct event_queue *q,
struct queue_sender_list *send,
unsigned int thread_id);
@@ -589,7 +583,6 @@ struct plugin_api {
intptr_t (*queue_send)(struct event_queue *q, long id,
intptr_t data);
void (*queue_reply)(struct event_queue *q, intptr_t retval);
-#endif /* CONFIG_CODEC == SWCODEC */
#ifdef RB_PROFILE
void (*profile_thread)(void);
@@ -673,7 +666,7 @@ struct plugin_api {
int (*sound_enum_hw_eq_band_setting)(unsigned int band,
unsigned int band_setting);
#endif /* AUDIOHW_HAVE_EQ */
-#if ((CONFIG_CODEC == SWCODEC) && defined (HAVE_PITCHCONTROL))
+#if defined (HAVE_PITCHCONTROL)
void (*sound_set_pitch)(int32_t pitch);
#endif
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
@@ -682,11 +675,7 @@ struct plugin_api {
void (*mp3_play_pause)(bool play);
void (*mp3_play_stop)(void);
bool (*mp3_is_playing)(void);
-#if CONFIG_CODEC != SWCODEC
- void (*bitswap)(unsigned char *data, int length);
-#endif
#endif /* PLATFORM_NATIVE */
-#if CONFIG_CODEC == SWCODEC
const unsigned long *audio_master_sampr_list;
const unsigned long *hw_freq_sampr;
void (*pcm_apply_settings)(void);
@@ -752,7 +741,6 @@ struct plugin_api {
void (*pcmbuf_fade)(bool fade, bool in);
void (*system_sound_play)(enum system_sound sound);
void (*keyclick_click)(bool rawbutton, int action);
-#endif /* CONFIG_CODEC == SWCODEC */
/* metadata */
bool (*get_metadata)(struct mp3entry* id3, int fd, const char* trackname);
@@ -817,9 +805,6 @@ struct plugin_api {
struct mp3entry* (*audio_current_track)(void);
void (*audio_flush_and_reload_tracks)(void);
int (*audio_get_file_pos)(void);
-#if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
- unsigned long (*mpeg_get_last_header)(void);
-#endif
/* menu */
struct menu_table *(*root_menu_get_options)(int *nb_options);
@@ -902,7 +887,6 @@ struct plugin_api {
#ifdef ROCKBOX_HAS_LOGF
void (*logf)(const char *fmt, ...) ATTRIBUTE_PRINTF(1, 2);
#endif
-#if CONFIG_CODEC == SWCODEC
void (*codec_thread_do_callback)(void (*fn)(void),
unsigned int *audio_thread_id);
int (*codec_load_file)(const char* codec, struct codec_api *api);
@@ -915,7 +899,6 @@ struct plugin_api {
const unsigned long list[],
int count,
bool signd);
-#endif /* CONFIG_CODEC == SWCODEC */
#ifdef HAVE_LCD_BITMAP
int (*read_bmp_file)(const char* filename, struct bitmap *bm, int maxsize,
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES
index 197f58ef5c..96ad535863 100644
--- a/apps/plugins/SOURCES
+++ b/apps/plugins/SOURCES
@@ -46,17 +46,12 @@ remote_control.c
lamp.c
#endif /* HAVE_BACKLIGHT */
-
-
-#if CONFIG_CODEC == SWCODEC
#if defined(HAVE_RECORDING) && (defined(HAVE_LINE_IN) || defined(HAVE_MIC_IN))
pitch_detector.c
#endif
mp3_encoder.c
wav2wv.c
-#endif /* CONFIG_CODEC */
-
#if CONFIG_RTC
alarmclock.c
@@ -99,15 +94,6 @@ pictureflow.c
#endif /* PLUGIN_BUFFER_SIZE <= 0x20000 && HAVE_LCD_BITMAP */
-
-#if CONFIG_CODEC != SWCODEC
-
-#if defined(HAVE_LCD_BITMAP)
-splitedit.c
-#endif
-
-#endif /* HWCODEC */
-
#if defined(IRIVER_H100_SERIES)
iriver_flash.c
#endif
@@ -207,9 +193,7 @@ superdom.c
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
test_boost.c
#endif
-#if CONFIG_CODEC == SWCODEC
test_codec.c
-#endif
#ifdef HAVE_JPEG
test_core_jpeg.c
#endif
@@ -232,9 +216,7 @@ test_mem_jpeg.c
#ifdef HAVE_LCD_COLOR
test_resize.c
#endif
-#if CONFIG_CODEC == SWCODEC
test_sampr.c
-#endif
#ifdef HAVE_TOUCHSCREEN
test_touchscreen.c
#endif
diff --git a/apps/plugins/SOURCES.app_build b/apps/plugins/SOURCES.app_build
index 89a8b0ede6..8cfc5881b2 100644
--- a/apps/plugins/SOURCES.app_build
+++ b/apps/plugins/SOURCES.app_build
@@ -23,9 +23,7 @@ test_fps.c
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
test_boost.c
#endif
-#if CONFIG_CODEC == SWCODEC
test_codec.c
-#endif
#ifdef HAVE_JPEG
test_core_jpeg.c
#endif
@@ -46,9 +44,7 @@ test_mem_jpeg.c
#ifdef HAVE_LCD_COLOR
test_resize.c
#endif
-#if CONFIG_CODEC == SWCODEC
test_sampr.c
-#endif
test_viewports.c
#endif /* HAVE_TEST_PLUGINS */
diff --git a/apps/plugins/SUBDIRS b/apps/plugins/SUBDIRS
index 5fd2d433c7..2c8e43c837 100644
--- a/apps/plugins/SUBDIRS
+++ b/apps/plugins/SUBDIRS
@@ -37,7 +37,7 @@ rockboy
pictureflow
#endif
-#if CONFIG_CODEC == SWCODEC && PLUGIN_BUFFER_SIZE > 0x20000
+#if PLUGIN_BUFFER_SIZE > 0x20000
fft
#endif
@@ -70,9 +70,6 @@ pacbox
doom
#endif
-/* For all the swcodec targets */
-#if CONFIG_CODEC == SWCODEC
-
#if MEMORYSIZE > 2 /* we need a lot of RAM for instruments */
midi
mikmod
@@ -91,8 +88,6 @@ pdbox
mpegplayer
#endif
-#endif /* CONFIG_CODEC == SWCODEC */
-
/* Lua needs at least 160 KB to work in */
#if PLUGIN_BUFFER_SIZE >= 0x80000
lua
diff --git a/apps/plugins/SUBDIRS.app_build b/apps/plugins/SUBDIRS.app_build
index 48a2d36d87..95b5e64639 100644
--- a/apps/plugins/SUBDIRS.app_build
+++ b/apps/plugins/SUBDIRS.app_build
@@ -10,7 +10,7 @@ lua
lua_scripts
#ifdef HAVE_LCD_BITMAP
-#if CONFIG_CODEC == SWCODEC && PLUGIN_BUFFER_SIZE > 0x20000
+#if PLUGIN_BUFFER_SIZE > 0x20000
fft
#endif
@@ -23,11 +23,8 @@ pictureflow
#endif /* HAVE_LCD_BITMAP */
/* For all the swcodec targets */
-#if CONFIG_CODEC == SWCODEC
-
#if MEMORYSIZE > 2 /* we need a lot of RAM for instruments */
mikmod
#endif
-#endif /* CONFIG_CODEC == SWCODEC */
#endif /* HAVE_TOUCHSCREEN */
diff --git a/apps/plugins/bitmaps/mono/SOURCES b/apps/plugins/bitmaps/mono/SOURCES
index df1397d2e2..ad8b951e45 100644
--- a/apps/plugins/bitmaps/mono/SOURCES
+++ b/apps/plugins/bitmaps/mono/SOURCES
@@ -50,12 +50,10 @@ invadrox_fire.6x6x1.bmp
#endif
#endif
-#if CONFIG_CODEC == SWCODEC
/* MPEGplayer */
mpegplayer_status_icons_8x8x1.bmp
mpegplayer_status_icons_12x12x1.bmp
mpegplayer_status_icons_16x16x1.bmp
-#endif
#if LCD_WIDTH == 160 && LCD_HEIGHT == 128 && LCD_DEPTH < 16
superdom_boarditems.160x128x1.bmp
diff --git a/apps/plugins/bitmaps/native/SOURCES b/apps/plugins/bitmaps/native/SOURCES
index 16df8a03d7..22f82800a7 100644
--- a/apps/plugins/bitmaps/native/SOURCES
+++ b/apps/plugins/bitmaps/native/SOURCES
@@ -957,7 +957,7 @@ rockboxlogo.91x32x1.bmp
/* Pitch detector */
/* The following preprocessor condition must match the condition */
/* for pitch detector from plugins/SOURCES */
-#if (CONFIG_CODEC == SWCODEC) && defined(HAVE_RECORDING) && \
+#if defined(HAVE_RECORDING) && \
(defined(HAVE_LINE_IN) || defined(HAVE_MIC_IN))
#if (LCD_WIDTH >= 320) && (LCD_HEIGHT >= 240) && (LCD_DEPTH >= 16)
pitch_notes.320x240x16.bmp
diff --git a/apps/plugins/chip8.c b/apps/plugins/chip8.c
index f861d19caa..cb7b85786f 100644
--- a/apps/plugins/chip8.c
+++ b/apps/plugins/chip8.c
@@ -1331,39 +1331,11 @@ static byte chip8_keymap[16];
static unsigned long starttimer; /* Timer value at the beginning */
static unsigned long cycles; /* Number of update cycles (50Hz) */
-#if (CONFIG_CODEC != SWCODEC) && !defined(SIMULATOR)
-static bool is_playing;
-
-/* one frame of bitswapped mp3 data */
-static unsigned char beep[]={255,
-223, 28, 35, 0,192,210, 35,226, 72,188,242, 1,128,166, 16, 68,146,252,151, 19,
- 10,180,245,127, 96,184, 3,184, 30, 0,118, 59,128,121,102, 6,212, 0, 97, 6,
- 42, 65, 28,134,192,145, 57, 38,136, 73, 29, 38,132, 15, 21, 70, 91,185, 99,198,
- 15,192, 83, 6, 33,129, 20, 6, 97, 33, 4, 6,245,128, 92, 6, 24, 0, 86, 6,
- 56,129, 44, 24,224, 25, 13, 48, 50, 82,180, 11,251,106,249, 59, 24, 82,175,223,
-252,119, 76,134,120,236,149,250,247,115,254,145,173,174,168,180,255,107,195, 89,
- 24, 25, 48,131,192, 61, 48, 64, 10,176, 49, 64, 1,152, 50, 32, 8,140, 48, 16,
- 5,129, 51,196,187, 41,177, 23,138, 70, 50, 8, 10,242, 48,192, 3,248,226, 0,
- 20,100, 18, 96, 41, 96, 78,102, 7,201,122, 76,119, 20,137, 37,177, 15,132,224,
- 20, 17,191, 67,147,187,116,211, 41,169, 63,172,182,186,217,155,111,140,104,254,
-111,181,184,144, 17,148, 21,101,166,227,100, 86, 85, 85, 85};
-/* callback to request more mp3 data */
-static void callback(const void** start, size_t* size)
-{
- *start = beep; /* give it the same frame again */
- *size = sizeof(beep);
-}
-#endif /* PLATFORM_NATIVE */
-
/****************************************************************************/
/* Turn sound on */
/****************************************************************************/
static void chip8_sound_on (void)
{
-#if(CONFIG_CODEC != SWCODEC) && !defined(SIMULATOR)
- if (!is_playing)
- rb->mp3_play_pause(true); /* kickoff audio */
-#endif
}
/****************************************************************************/
@@ -1371,10 +1343,6 @@ static void chip8_sound_on (void)
/****************************************************************************/
static void chip8_sound_off (void)
{
-#if (CONFIG_CODEC != SWCODEC) && !defined(SIMULATOR)
- if (!is_playing)
- rb->mp3_play_pause(false); /* pause audio */
-#endif
}
/****************************************************************************/
@@ -1576,27 +1544,12 @@ static bool chip8_run(const char* file)
rb->lcd_drawrect(CHIP8_X-1,CHIP8_Y-1,CHIP8_LCDWIDTH+2,CHIP8_HEIGHT+2);
#endif
rb->lcd_update();
-#if (CONFIG_CODEC != SWCODEC) && !defined(SIMULATOR)
- /* init sound */
- is_playing = rb->mp3_is_playing(); /* would we disturb playback? */
- if (!is_playing) /* no? then we can make sound */
- { /* prepare */
- rb->mp3_play_data(beep, sizeof(beep), callback);
- }
-#endif
starttimer = *rb->current_tick;
chip8_iperiod=15;
cycles = 0;
chip8();
-#if (CONFIG_CODEC != SWCODEC) && !defined(SIMULATOR)
- if (!is_playing)
- { /* stop it if we used audio */
- rb->mp3_play_stop(); /* Stop audio playback */
- }
-#endif
-
if (chip8_running == 3) {
/* unsupported instruction */
rb->splash(HZ, "Error: Unsupported"
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c
index 4fa989da46..e6eb543eda 100644
--- a/apps/plugins/lua/rocklib.c
+++ b/apps/plugins/lua/rocklib.c
@@ -487,7 +487,7 @@ RB_WRAP(sound)
lua_pushstring (L, rb->sound_unit(setting));
return 1;
break;
-#if ((CONFIG_CODEC == SWCODEC) && defined (HAVE_PITCHCONTROL))
+#if defined (HAVE_PITCHCONTROL)
case SOUND_SET_PITCH:
rb->sound_set_pitch(setting);
return 1;/*nil*/
@@ -507,7 +507,6 @@ RB_WRAP(sound)
return 1;
}
-#if CONFIG_CODEC == SWCODEC
RB_WRAP(pcm)
{
enum e_pcm {PCM_APPLYSETTINGS = 0, PCM_ISPLAYING, PCM_ISPAUSED,
@@ -579,7 +578,6 @@ RB_WRAP(mixer_frequency)
lua_pushinteger(L, result);
return 1;
}
-#endif /*CONFIG_CODEC == SWCODEC*/
/* DEVICE LIGHTING CONTROL */
RB_WRAP(backlight_onoff)
@@ -953,10 +951,8 @@ static const luaL_Reg rocklib[] =
RB_FUNC(audio),
RB_FUNC(playlist),
RB_FUNC(sound),
-#if CONFIG_CODEC == SWCODEC
RB_FUNC(pcm),
RB_FUNC(mixer_frequency),
-#endif
/* DEVICE LIGHTING CONTROL */
RB_FUNC(backlight_onoff),
diff --git a/apps/plugins/metronome.c b/apps/plugins/metronome.c
index 75947df618..eec8a92e78 100644
--- a/apps/plugins/metronome.c
+++ b/apps/plugins/metronome.c
@@ -123,143 +123,6 @@ const struct button_mapping *plugin_contexts[] =
};
#define PLA_ARRAY_COUNT sizeof(plugin_contexts)/sizeof(plugin_contexts[0])
-#if CONFIG_CODEC != SWCODEC
-#ifndef SIMULATOR
-/* MP3 tick sounds */
-static unsigned char tick_sound[] =
-{
- 255,251,112,196, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 73,110,102,111, 0, 0, 0, 15, 0, 0, 0, 3, 0, 0, 4,229, 0, 85, 85
-, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85
-, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,170,170,170,170,170,170,170,170,170
-,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170
-,170,170,170,170,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
-,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 0, 0, 0
-, 57, 76, 65, 77, 69, 51, 46, 57, 57,114, 1,205, 0, 0, 0, 0, 46,102, 0, 0
-, 20, 96, 36, 3, 64, 66, 0, 0, 96, 0, 0, 4,229,101,175,184,232, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,251,112,196, 0, 0, 13
-, 92,189,103, 52,194,128, 2,165,176,176,247, 51, 16, 2, 0, 0, 24, 32, 0, 12
-,204,204,204,204,207,215,221,121,229, 74,224,152, 1,128, 24, 19, 17,207,217,246
-,252,132,212,226,225,192, 16, 0, 0, 0, 0, 32,163,100,111,255, 66, 7, 0, 48
-, 12, 14, 31, 59,255,255,234,112,248,112, 56, 40,223,193, 0, 64, 16, 4, 1, 51
-,229, 29,234, 4,193,240,124, 31, 62, 15,135,255, 7,193, 0, 64, 16, 12, 9, 1
-, 15,168, 16, 1,131,224,254,254,146,224,254, 8, 28, 88,127,255,148, 4, 32,128
-, 32,196,182,166,245,242,214,222,214, 73, 45,110, 52,137, 81, 39,107,255, 44, 76
-,148,140, 8,250, 66,148,195, 43, 3, 41, 15, 18,163, 80, 5, 20,248,174,140,138
-,115, 1,146, 50, 49, 32, 44,201,152,157, 53, 32, 33,157, 8, 34, 85,135, 88,105
-,186,131,252, 48,143,168,162, 44,209,142, 16, 88,221, 10,214, 94, 51, 52, 46,148
-,133, 36, 38,129,165, 36,164,139, 64,211, 11,115,101, 49, 5,136, 33,157, 18,241
-,137, 50, 53,194,213,173, 78,241,108, 1, 24,172,129,146,141,136, 24,119, 73, 51
-, 85,162,138,146, 51, 20,101,163,242,129, 56,212, 84,233, 44, 94, 11, 97,117, 74
-, 73, 37,162, 58, 20,146, 95,203, 31,246, 50, 55,111,214,223,205,213,230, 31,232
-,122,143,183, 14, 39, 91, 57, 15,251,186, 21,185,149, 48, 1,100, 64,200, 16,121
-,155, 72,110, 24,130, 98,255,251,114,196, 7,128, 17,169,247, 95,221,152,128, 10
-, 80, 62,233,185,150,170,113,174,203,251, 59, 12,190,170, 98, 4,156,122,140, 97
-,155, 60, 39, 8,145,195,116, 22,164, 82,118,116, 42,116,157, 68, 88, 70, 64, 93
-, 17, 35, 39,163,118,118, 77, 75, 82,187,215, 89,140, 46,100,112,151, 75, 73,169
-,107,181,157,170,251, 45,140, 75, 34,122, 28,228,146,111,255,235,210, 81,124,114
-,199, 52,180,138,174,207,255,235, 82,210, 64,123, 34,197,101, 47,255,254,234, 91
-, 14, 74, 68,234,219,255,254,206,131,143,162,120,234,210,191,255,245, 93, 18,200
-,225, 42, 29,171,255,254,165,164,196, 24,137, 32,223, 90, 93, 96, 64,217, 78, 35
-, 32, 53,185,107,237, 43,113, 98, 80,107,161, 3,206, 60,192, 10, 78,226,219,199
-,158,146,158, 47, 59, 90,253,154,221,198,138,147,100,150,206,233, 32, 39,192, 73
-, 23, 76,150,201, 41,209,186,217, 37,250,233, 38,198, 34, 24, 18, 33,130, 38,158
-, 73, 54, 69,146, 91, 36,182, 75,235, 64,216,196,138, 9,201, 69,174,138,157,244
-,154,150,208,246, 57, 72, 71, 2,148, 23, 76,115, 83,255,210,218,161, 56, 3, 68
-, 81, 49,190,139,253,125, 81,205, 25, 13,202,146,156,173,255,250,234,194, 8, 69
-, 13,142,255,255,209, 88,136, 73, 6,145,235, 26,142,191,255, 85,100,154,104,178
-,131,213, 0, 34, 0, 17,132, 0, 7,227, 82,135, 11,113, 70,110,105, 94,118, 22
-,255,251,112,196, 9, 0, 17, 61,249, 41,128,101,163, 73,217,178,153, 88,147, 21
-, 48,158,206,220,162,156,221, 7,209, 69, 20,117,163, 69,146, 68,145, 26,131,150
-, 0, 4,132, 41, 8,214,202,209, 69, 30,191,116, 76,156,240, 41,194,118, 23,147
-, 67,173, 87,255,233, 29, 64,216, 73,129, 10, 28,227,197,217, 43,255,254,203, 40
-,140, 48,129, 5,201, 21, 58, 95,255,232,180,168, 70,136,131,201,146,255,254,182
-,169,206, 5,216,101, 36,146,217,109,255,250,169, 38, 96, 35, 69, 51,167,157,191
-,255, 82,158,152,225, 46, 14, 99,235,100,159,255,253, 22, 29,162, 98, 84,108,210
-,202,128, 74, 16, 23,220, 23, 96,152, 17, 5,129,242, 49,137, 75, 60, 81, 16, 80
-, 34,106, 74, 91,255,222, 53, 18, 64,160, 70, 1,195, 5,139,230, 84,118,254,236
-, 44, 29, 1,130,196,195,130,236,237,255,253,156, 84, 60, 17, 10, 10, 19, 35,179
-,255,254,206,198, 14,132,130,194,196, 14, 67,179,255,254,198, 40,144,136, 80, 80
-, 76, 64,228, 57, 29,191,251, 57, 76, 34, 18, 8,132, 66,132,200,114, 59, 63,255
-,220,166, 17, 18, 18, 26, 32,112,201,159,240,144,184,169, 23,127,197,133, 69, 85
-, 76, 65, 77, 69, 51, 46, 57, 57, 46, 53, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85
-, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85
-, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85
-};
-static unsigned char tock_sound[] =
-{
- 255,251,112,196, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 73,110,102,111, 0, 0, 0, 15, 0, 0, 0, 3, 0, 0, 4,229, 0, 85, 85
-, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85
-, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,170,170,170,170,170,170,170,170,170
-,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170
-,170,170,170,170,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
-,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 0, 0, 0
-, 57, 76, 65, 77, 69, 51, 46, 57, 57,114, 1,205, 0, 0, 0, 0, 46,100, 0, 0
-, 20, 96, 36, 3, 64, 66, 0, 0, 96, 0, 0, 4,229,187,155,119, 17, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,251,112,196, 0, 0, 13
-,105, 19,104,212,146,128, 10,164, 41,175,119, 51, 32, 0, 2, 32, 41, 84, 9,130
-, 96,152,109,228, 0, 16, 0, 6, 9,209,163,111,127,154, 48, 0, 0, 0, 0,129
-,194, 19,212,226, 97,240,248,187,255, 65, 0,248,124, 92,255,144,130, 1,192,225
-, 9,249,206,115,138, 16,158,132, 57,206,115,191,242, 16,132,111,212,231, 14, 7
-, 8, 70,243,156,231, 57,206,121,207,200, 66, 16, 92,231,255,134, 0, 0, 0,127
-,244, 60, 60, 51,255,192, 3,195,207,252, 0, 0, 0, 29, 39,244, 60, 48, 3,255
-,195,219,177,171,179,181, 8,157,251,239,155,104,162, 80, 5,194, 16,165,199, 42
-,104,133, 19,109, 88, 96, 61,104,242,117,118, 94,135, 29, 53, 72, 67, 85, 11, 54
-, 59, 64,154,155,128,195, 23,148, 98, 43,186, 43,139, 64,218, 82, 68,160,197,168
-,125, 10, 50, 41, 16,240, 30, 6,228, 52,117, 0, 51,130,146,122,152,109,162,201
-, 45,154, 30, 11, 66, 30, 76, 73,145,224, 52,149, 17, 55,138,112,105, 51, 36,147
-, 22,130, 89, 20,138, 36,114,212,145, 3,199,107,101,213, 25, 21,222,196,209,162
-, 40,168,168,165,162,100,142,163,220,186,250, 72,106, 54, 75, 48,243, 79,153, 54
-,163, 93,179,171,204,144,232,190,115, 19,208, 90,172,244, 40, 98,126, 35,161,234
-,122,143,221, 39,250,159, 61, 35,111,250,213,216, 6,252, 9,138, 17, 64, 1, 13
-, 56, 80, 58,104,184, 37,255,251,114,196, 7,128, 17,250, 1, 97,189,152, 0, 10
-, 44,192, 41,253,151,169,185,237, 56, 3,131,220, 24,180,204,165,221,129,107,210
-,192, 50,130, 26, 22, 26,180, 77, 81, 85,221,146, 33,197,224,198,197,228,146, 89
-,162,210, 69,100,233, 13, 25,145, 61, 19,206,151,232,172,212, 58,162,149, 53, 70
-,234,234, 81,176,186, 28, 39,145,253, 87, 33,130,150, 43, 36,187,245,169,141,200
-, 41,178,191,230, 68,233,170,255,230, 37,227,101,183,237, 49, 56,109,255,115,134
-,232,223,247,156, 62,191,250, 43, 42,169,127,245, 26,160,255,234,151,157,191,215
-, 46,164,223,235, 98,137,118,223,238,112,189,111,247, 56, 94,106, 16, 1, 77, 8
-, 25, 4,204, 0, 0,134, 96, 41,151,170, 74,147,135, 11,136, 28,220, 96,102,179
-, 16,145, 89,202, 11,197,114, 72, 0,241, 77, 88,211, 70,174,171, 10, 11, 84,163
-, 5, 53,191,241,191,106,245,209,114, 21,240,208, 75,172,190,150,103,205,178,252
-, 78, 36,166,139,132,106,231, 86,253,130, 80,178,201,254,193, 68, 20,207,254,206
-, 49, 19, 78,127,253,159,255, 33, 37, 37, 95,238,112,188, 89, 37, 79,238,165, 5
-,163,151,249,168,130,215,255,169,223,249,231, 15,149,191,161,227,209,235, 63,232
-,166, 10,198,183,232,150, 34,119,255,213, 17,255,231, 17, 44, 8, 2, 96, 1,101
-,184,243,226,216, 18, 60,216,132,105,150,250,101,165, 64,237,172,186, 35,114,126
-,255,251,112,196, 12,128,144,142, 3, 44,140,180,241, 1,207, 47,217, 72,244, 10
-, 48, 29, 88, 20, 21,128, 36,231,157,173,100,202, 35,136,119,133,228,209, 55,186
-,218,198,197,208,217, 11,233,178,254,186,137,128, 8,110, 71,253,212,136,138, 45
-,118,253,216, 34, 7, 74, 99,255, 60, 22,144,101,111,209, 72,136,196,175,254, 58
-, 15, 76, 71,249,184,138, 45, 30,127,234,199, 21, 35,191,245, 17, 75, 63,252,120
-,108, 58,223,209,199, 74,141, 91,254,131, 98, 70,255,212, 69, 42, 71,254,172, 54
-,127,252,116,107,255,168,212,194, 64, 61,126, 46,224,170, 52, 71,208,229, 19,209
-,148, 64,203,225,206,126, 29,230, 1,134,123,159,138,246, 67,199, 93,127,253, 50
-,148, 81, 37, 13, 40,145, 8, 37, 12, 6, 4, 49, 67,204,186,186,255,255,213,149
-,149,137, 16,132,162, 8,128, 90, 58, 93, 95,255,121,138, 96,161,131, 3, 33,200
-,118,127,255,238, 83, 5, 10, 8,228, 58, 47,255,252,197, 48, 96,104,116, 84, 84
-, 69,255,251, 24, 40, 80, 74, 69, 69, 64, 96,193, 7,141, 1, 89,203, 5,113, 81
-, 70,255,245,139, 85, 76, 65, 77, 69, 51, 46, 57, 57, 46, 53, 85, 85, 85, 85, 85
-, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85
-, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85
-, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85
-};
-#endif /* SIMULATOR */
-#else
/* raw PCM */
static signed short tick_sound[] =
{
@@ -641,7 +504,6 @@ static signed short tock_sound[] =
,-3,2,-1,0,1,-1,0,0,1,-1,1
,-2,3
};
-#endif
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Utilities from pdbox plugin (Copyright (C) 2009 Wincent Balin) --- am I
@@ -941,51 +803,6 @@ static int bpm_step_counter = 0;
static bool sound_trigger = false;
-#if CONFIG_CODEC != SWCODEC
-
-#ifdef SIMULATOR
-
-/* No audio in HWCODEC simulator build. */
-#define MET_IS_PLAYING 0
-#define MET_PLAY_STOP do {} while(0)
-static void play_tick(void){ printf("tick\n"); }
-static void play_tock(void){ printf("tock\n"); }
-
-#else
-
-#define MET_IS_PLAYING rb->mp3_is_playing()
-#define MET_PLAY_STOP rb->mp3_play_stop()
-
-static void callback(const void** start, size_t* size)
-{
- (void)start; /* unused parameter, avoid warning */
- *size = 0; /* end of data */
- sound_active = false;
- rb->led(0);
-}
-
-/* Wondering: Should one prevent playing again while sound_active == true? */
-
-static void play_tick(void)
-{
- sound_active = true;
- rb->led(1);
- rb->mp3_play_data(tick_sound, sizeof(tick_sound), callback);
- rb->mp3_play_pause(true); /* kickoff audio */
-}
-
-static void play_tock(void)
-{
- sound_active = true;
- rb->led(1);
- rb->mp3_play_data(tock_sound, sizeof(tock_sound), callback);
- rb->mp3_play_pause(true); /* kickoff audio */
-}
-
-#endif /* SIMULATOR */
-
-#else /* CONFIG_CODEC == SWCODEC */
-
#define MET_IS_PLAYING rb->pcm_is_playing()
#define MET_PLAY_STOP rb->audio_stop()
@@ -1014,8 +831,6 @@ static void play_tock(void)
rb->pcm_play_data(NULL, NULL, tock_buf, sizeof(tock_buf));
}
-#endif /* CONFIG_CODEC != SWCODEC */
-
/* State: 0: blank/title, 1: tick, 2: tock 3: silent klick */
/* TODO: Could use more smart placement, using
lcd_getstringsize() and such. */
@@ -1446,9 +1261,7 @@ static void cleanup(void)
MET_PLAY_STOP; /* stop audio ISR */
tweak_volume(0);
rb->led(0);
-#if CONFIG_CODEC == SWCODEC
rb->pcm_set_frequency(HW_SAMPR_DEFAULT);
-#endif
}
/*
@@ -1786,12 +1599,6 @@ enum plugin_status plugin_start(const void* file)
if(MET_IS_PLAYING) MET_PLAY_STOP; /* stop audio IS */
-#if (CONFIG_CODEC != SWCODEC)
-#ifndef SIMULATOR
- rb->bitswap(tick_sound, sizeof(tick_sound));
- rb->bitswap(tock_sound, sizeof(tock_sound));
-#endif
-#else
prepare_buffers();
#if INPUT_SRC_CAPS != 0
/* Select playback */
@@ -1799,7 +1606,6 @@ enum plugin_status plugin_start(const void* file)
rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
#endif
rb->pcm_set_frequency(SAMPR_44);
-#endif /* CONFIG_CODEC != SWCODEC */
if(file)
{
diff --git a/apps/plugins/mpegplayer/mpeg_settings.c b/apps/plugins/mpegplayer/mpeg_settings.c
index d5d7c7c019..25eb313591 100644
--- a/apps/plugins/mpegplayer/mpeg_settings.c
+++ b/apps/plugins/mpegplayer/mpeg_settings.c
@@ -1245,7 +1245,6 @@ static void display_options(void)
}
}
-#if CONFIG_CODEC == SWCODEC
static void audio_options(void)
{
int selected = 0;
@@ -1307,7 +1306,6 @@ static void audio_options(void)
menu_quit = true;
}
}
-#endif
static void resume_options(void)
{
diff --git a/apps/plugins/oscilloscope.c b/apps/plugins/oscilloscope.c
index 8e14f26bd5..2af70204a1 100644
--- a/apps/plugins/oscilloscope.c
+++ b/apps/plugins/oscilloscope.c
@@ -902,19 +902,11 @@ static int last_right;
static void get_peaks(int *left, int *right)
{
-#if CONFIG_CODEC == SWCODEC
static struct pcm_peaks peaks;
rb->mixer_channel_calculate_peaks(PCM_MIXER_CHAN_PLAYBACK,
&peaks);
*left = peaks.left;
*right = peaks.right;
-#elif defined (SIMULATOR)
- *left = rand() % 0x8000;
- *right = rand() % 0x8000;
-#else
- *left = 0;
- *right = 0;
-#endif
}
static long get_next_delay(void)
diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c
index 686b4d6d1a..4c172ff108 100644
--- a/apps/plugins/properties.c
+++ b/apps/plugins/properties.c
@@ -112,13 +112,9 @@ static bool file_properties(const char* selected_file)
num_properties = 5;
-#if (CONFIG_CODEC == SWCODEC)
int fd = rb->open(selected_file, O_RDONLY);
if (fd >= 0 &&
rb->get_metadata(&id3, fd, selected_file))
-#else
- if (!rb->mp3info(&id3, selected_file))
-#endif
{
long dur = id3.length / 1000; /* seconds */
rb->snprintf(str_artist, sizeof str_artist,
@@ -145,9 +141,7 @@ static bool file_properties(const char* selected_file)
num_properties++;
}
}
-#if (CONFIG_CODEC == SWCODEC)
rb->close(fd);
-#endif
found = true;
break;
}
diff --git a/apps/plugins/rockboy/rbsound.c b/apps/plugins/rockboy/rbsound.c
index 628879b4b7..c36e24b578 100644
--- a/apps/plugins/rockboy/rbsound.c
+++ b/apps/plugins/rockboy/rbsound.c
@@ -7,8 +7,6 @@ struct pcm pcm IBSS_ATTR;
#define N_BUFS 2
#define BUF_SIZE 2048
-#if CONFIG_CODEC == SWCODEC
-
bool doneplay=1;
bool bufnum=0;
@@ -88,27 +86,3 @@ int rockboy_pcm_submit(void)
pcm.pos = 0;
return 1;
}
-
-#else
-
-void rockboy_pcm_init(void)
-{
- pcm.hz = 44100;
- pcm.stereo = 1;
- pcm.buf = NULL;
- pcm.len = 0;
- pcm.pos = 0;
-}
-
-void rockboy_pcm_close(void)
-{
- memset(&pcm, 0, sizeof pcm);
-}
-
-int rockboy_pcm_submit(void)
-{
- pcm.pos =0;
- return 0;
-}
-
-#endif
diff --git a/apps/plugins/splitedit.c b/apps/plugins/splitedit.c
deleted file mode 100644
index b698e2e18a..0000000000
--- a/apps/plugins/splitedit.c
+++ /dev/null
@@ -1,1231 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2002 Philipp Pertermann
- *
- * 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 "plugin.h"
-
-
-
-/* variable button definitions */
-#if CONFIG_KEYPAD == IRIVER_H100_PAD
-#define SPLITEDIT_QUIT BUTTON_OFF
-#define SPLITEDIT_PLAY BUTTON_ON
-#define SPLITEDIT_SAVE BUTTON_SELECT
-#define SPLITEDIT_LOOP_MODE BUTTON_MODE
-#define SPLITEDIT_SCALE (BUTTON_REC | BUTTON_UP)
-#define SPLITEDIT_SPEED50 (BUTTON_REC | BUTTON_LEFT)
-#define SPLITEDIT_SPEED100 (BUTTON_REC | BUTTON_DOWN)
-#define SPLITEDIT_SPEED150 (BUTTON_REC | BUTTON_RIGHT)
-#define SPLITEDIT_MENU_RUN BUTTON_RIGHT
-
-#elif (CONFIG_KEYPAD == SAMSUNG_YH820_PAD) || \
- (CONFIG_KEYPAD == SAMSUNG_YH92X_PAD)
-#define SPLITEDIT_QUIT (BUTTON_REC | BUTTON_REW)
-#define SPLITEDIT_PLAY (BUTTON_REC | BUTTON_FFWD)
-#define SPLITEDIT_SAVE BUTTON_FFWD
-#define SPLITEDIT_LOOP_MODE BUTTON_REW
-#define SPLITEDIT_SCALE BUTTON_UP
-#define SPLITEDIT_SPEED50 BUTTON_LEFT
-#define SPLITEDIT_SPEED100 BUTTON_DOWN
-#define SPLITEDIT_SPEED150 BUTTON_RIGHT
-#define SPLITEDIT_MENU_RUN BUTTON_PLAY
-
-#define SPLITEDIT_RC_QUIT BUTTON_RC_STOP
-#endif
-
-#define BMPHEIGHT 7
-#define BMPWIDTH 13
-unsigned char LOOP_BMP[][13] =
-{
- {0xfc,0x00,0x10,0x11,0x93,0x7f,0x13,0x11,0x7c,0x38,0x10,0x00,0x7c}, /*ALL */
- {0x81,0x03,0x7f,0x03,0x91,0x10,0x10,0x10,0x7c,0x38,0x10,0x00,0x7c}, /*FROM*/
- {0xfc,0x00,0x10,0x10,0x90,0x10,0x7c,0x38,0x11,0x03,0x7f,0x03,0x01}, /*TO */
- {0x80,0x10,0x10,0x11,0x93,0x7f,0x13,0x11,0x10,0x7c,0x38,0x10,0x00}, /*FREE*/
-};
-
-unsigned char CUT_BMP[] =
-{
- 0xc1,0x63,0x63,0x36,0xb6,0x1c,0x1c,0x36,0x77,0x55,0x55,0x55,0x32,
-};
-
-unsigned char SCALE_BMP[][13] =
-{
- {0x80,0x06,0x49,0x66,0xb0,0x18,0x0c,0x06,0x33,0x49,0x30,0x00,0x00}, /*lin*/
- {0x80,0x30,0x78,0x48,0xff,0x7f,0x00,0x7f,0x7f,0x48,0x78,0x30,0x00}, /*db*/
-};
-
-#define TIMEBAR_Y 9
-#define TIMEBAR_HEIGHT 4
-
-#define OSCI_X 0
-#define OSCI_Y (TIMEBAR_Y + TIMEBAR_HEIGHT + 1)
-#define OSCI_WIDTH LCD_WIDTH
-#define OSCI_HEIGHT (LCD_HEIGHT - BMPHEIGHT - OSCI_Y - 1)
-
-/* Indices of the menu items in the save editor, see save_editor */
-#define SE_PART1_SAVE 0
-#define SE_PART1_NAME 1
-#define SE_PART2_SAVE 2
-#define SE_PART2_NAME 3
-#define SE_SAVE 4
-#define SE_COUNT 5
-
-/* contains the file name of the song that is to be split */
-static char path_mp3[MAX_PATH];
-
-/* Exit code of this plugin */
-static enum plugin_status splitedit_exit_code = PLUGIN_OK;
-
-/* The range in time that the displayed aerea comprises */
-static unsigned int range_start = 0;
-static unsigned int range_end = 0;
-
-/* The range in time that is being looped */
-static unsigned int play_start = 0;
-static unsigned int play_end = 0;
-
-/* Point in time (pixel) at which the split mark is set */
-static int split_x = OSCI_X + (OSCI_WIDTH / 2);
-
-/* Contains the peak values */
-static unsigned char osci_buffer[OSCI_WIDTH];
-
-/* if true peak values from a previous loop are only overwritten
- if the new value is greater than the old value */
-static bool osci_valid = false;
-
-/**
- * point in time from which on the osci_buffer is invalid
- * if set to ~(unsigned int)0 the entire osci_buffer is invalid
- */
-static unsigned int validation_start = ~(unsigned int)0;
-
-/* all the visible aerea is looped */
-#define LOOP_MODE_ALL 0
-
-/* loop starts at split point, ends at right visible border */
-#define LOOP_MODE_FROM 1
-
-/* loop start at left visible border, ends at split point */
-#define LOOP_MODE_TO 2
-
-/* let the song play without looping */
-#define LOOP_MODE_FREE 3
-
-/* see LOOP_MODE_XXX constants vor valid values */
-static int loop_mode = LOOP_MODE_FREE;
-
-/* minimal allowed timespan (ms) of the visible (and looped) aerea*/
-#define MIN_RANGE_SIZE 1000
-
-/* Format time into buf.
- *
- * buf - buffer to format to.
- * buf_size - size of buffer.
- * time - time to format, in milliseconds.
- */
-static void format_time_ms(char* buf, int buf_size, int time)
-{
- rb->snprintf(buf, buf_size, "%d:%02d:%03d", time / 60000,
- time % 60000 / 1000, (time % 60000) % 1000);
-}
-
-/**
- * converts screen coordinate (pixel) to time (ms)
- */
-static int xpos_to_time(int xpos)
-{
- int retval = 0;
- int range = range_end - range_start;
- retval = range_start + (((xpos - OSCI_X) * range) / OSCI_WIDTH);
- return retval;
-}
-
-/**
- * Converts time (ms) to screen coordinates (pixel).
- */
-static int time_to_xpos(unsigned int time)
-{
- int retval = OSCI_X;
-
- /* clip the range */
- if (time < range_start)
- {
- retval = OSCI_X;
- }
- else
- if (time >= range_end)
- {
- retval = OSCI_X + OSCI_WIDTH;
- }
-
- /* do the calculation */
- else
- {
- int range = range_end - range_start;
- retval = OSCI_X + ((time - range_start) * OSCI_WIDTH) / range ;
- }
- return retval;
-}
-
-/**
- * Updates the display of the textual data only.
- */
-static void update_data(void)
-{
- char buf[20];
- char timebuf[10];
- int w, h;
-
- /* split point */
- format_time_ms(timebuf, sizeof timebuf, xpos_to_time(split_x));
- rb->snprintf(buf, sizeof buf, "Split at: %s", timebuf);
-
- rb->lcd_getstringsize(buf, &w, &h);
-
- rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- rb->lcd_fillrect(0, 0, LCD_WIDTH, h);
- rb->lcd_set_drawmode(DRMODE_SOLID);
- rb->lcd_puts(0, 0, buf);
- rb->lcd_update_rect(0, 0, LCD_WIDTH, h);
-}
-
-/**
- * Displays which part of the song is visible
- * in the osci.
- */
-static void update_timebar(struct mp3entry *mp3)
-{
- rb->gui_scrollbar_draw
- (
- rb->screens[SCREEN_MAIN],0, TIMEBAR_Y, LCD_WIDTH, TIMEBAR_HEIGHT,
- mp3->length, range_start, range_end,
- HORIZONTAL
- );
- rb->lcd_update_rect(0, TIMEBAR_Y, LCD_WIDTH, TIMEBAR_HEIGHT);
-}
-
-/**
- * Marks the entire area of the osci buffer invalid.
- * It will be drawn with new values in the next loop.
- */
-static void splitedit_invalidate_osci(void)
-{
- osci_valid = false;
- validation_start = ~(unsigned int)0;
-}
-
-/**
- * Returns the loop mode. See the LOOP_MODE_XXX constants above.
- */
-static int splitedit_get_loop_mode(void)
-{
- return loop_mode;
-}
-
-/**
- * Updates the icons that display the Fn key hints.
- */
-static void update_icons(void)
-{
- rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- rb->lcd_fillrect(0, LCD_HEIGHT - BMPHEIGHT, LCD_WIDTH, BMPHEIGHT);
- rb->lcd_set_drawmode(DRMODE_SOLID);
-
- /* The CUT icon */
- rb->lcd_mono_bitmap(CUT_BMP,
- LCD_WIDTH / 3 / 2 - BMPWIDTH / 2, LCD_HEIGHT - BMPHEIGHT,
- BMPWIDTH, BMPHEIGHT);
-
- /* The loop mode icon */
- rb->lcd_mono_bitmap(LOOP_BMP[splitedit_get_loop_mode()],
- LCD_WIDTH/3 + LCD_WIDTH/3 / 2 - BMPWIDTH/2, LCD_HEIGHT - BMPHEIGHT,
- BMPWIDTH, BMPHEIGHT);
-
- {
- static int idx;
- if (idx < 0 || idx > 1) idx = 0;
- idx = 1 - idx;
- rb->lcd_mono_bitmap(SCALE_BMP[idx],
- 2 *LCD_WIDTH/3 + LCD_WIDTH/3 / 2 - BMPWIDTH/2, LCD_HEIGHT - BMPHEIGHT,
- BMPWIDTH, BMPHEIGHT);
- }
-
- rb->lcd_update_rect(0, LCD_HEIGHT - BMPHEIGHT, LCD_WIDTH, BMPHEIGHT);
-}
-
-/**
- * Sets the loop mode. See the LOOP_MODE_XXX constants above.
- */
-static void splitedit_set_loop_mode(int mode)
-{
- int old_loop_mode = loop_mode;
- /* range restriction */
- loop_mode = mode % (LOOP_MODE_FREE + 1);
- switch (loop_mode)
- {
- case LOOP_MODE_ALL:
- play_start = range_start;
- play_end = range_end;
- break;
-
- case LOOP_MODE_FROM:
- play_start = xpos_to_time(split_x);
- play_end = range_end;
- break;
-
- case LOOP_MODE_TO:
- play_start = range_start;
- play_end = xpos_to_time(split_x);
- break;
-
- case LOOP_MODE_FREE:
- /* play_start is used when the song plays beyond its end */
- play_start = range_start;
- play_end = range_end;
- break;
- }
-
- if (loop_mode != old_loop_mode)
- {
- update_icons();
- }
-}
-
-/**
- * Readraws the osci without clear.
- */
-static void redraw_osci(void)
-{
- int x;
- for (x = 0; x < OSCI_WIDTH; x++)
- {
- if (osci_buffer[x] > 0)
- {
- rb->lcd_vline
- (
- OSCI_X + x, OSCI_Y + OSCI_HEIGHT - 1,
- OSCI_Y + OSCI_HEIGHT - osci_buffer[x] - 1
- );
- }
- }
-}
-
-/**
- * Sets the range of time in which the user can finetune the split
- * point. The split point is the center of the time range.
- */
-static void set_range_by_time(
- struct mp3entry *mp3,
- unsigned int split_time,
- unsigned int range)
-{
- if (mp3 != NULL)
- {
- if (range < MIN_RANGE_SIZE)
- {
- range = MIN_RANGE_SIZE;
- }
- range_start = (split_time > range / 2) ? (split_time - range / 2) : 0;
- range_end = MIN(range_start + range, mp3->length);
- split_x = time_to_xpos(split_time);
-
- splitedit_invalidate_osci();
-
- /* this sets the play_start / play_end */
- splitedit_set_loop_mode(splitedit_get_loop_mode());
-
- update_data();
- update_timebar(mp3);
- }
-}
-
-/**
- * Set the split point in screen coordinates
- */
-static void splitedit_set_split_x(int newx)
-{
- int minx = split_x - 2 > 0 ? split_x - 2: 0;
-
- /* remove old split point from screen, only if moved */
- if (split_x != newx)
- {
- rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
- rb->lcd_fillrect(minx, OSCI_Y, 5, 1);
- rb->lcd_fillrect(split_x-1 > 0 ? split_x - 1: 0, OSCI_Y + 1, 3, 1);
- rb->lcd_fillrect(split_x, OSCI_Y + 2, 1, OSCI_HEIGHT - 2);
- rb->lcd_set_drawmode(DRMODE_SOLID);
- rb->lcd_update_rect(minx, OSCI_Y, 5, OSCI_HEIGHT);
- }
-
- if (newx >= OSCI_X && newx < OSCI_X + OSCI_WIDTH)
- {
- split_x = newx;
- /* in LOOP_FROM / LOOP_TO modes play_start /play_end must be updated */
- splitedit_set_loop_mode(splitedit_get_loop_mode());
-
- /* display new split time */
- update_data();
- }
-
- /* display new split point */
- minx = split_x - 2 > 0 ? split_x - 2: 0;
- rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
- rb->lcd_fillrect(minx, OSCI_Y, 5, 1);
- rb->lcd_fillrect(split_x - 1 > 0 ? split_x - 1: 0, OSCI_Y + 1, 3, 1);
- rb->lcd_fillrect(split_x, OSCI_Y + 2, 1, OSCI_HEIGHT - 2);
- rb->lcd_set_drawmode(DRMODE_SOLID);
- rb->lcd_update_rect(minx, OSCI_Y, 5, OSCI_HEIGHT);
-}
-
-/**
- * returns the split point in screen coordinates
- */
-static int splitedit_get_split_x(void)
-{
- return split_x;
-}
-
-/**
- * Clears the osci area and redraws it
- */
-static void update_osci(void)
-{
- rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- rb->lcd_fillrect(OSCI_X, OSCI_Y, OSCI_WIDTH, OSCI_HEIGHT);
- rb->lcd_set_drawmode(DRMODE_SOLID);
- redraw_osci();
- splitedit_set_split_x(splitedit_get_split_x());
- rb->lcd_update_rect(OSCI_X, OSCI_Y, OSCI_WIDTH, OSCI_HEIGHT);
-}
-
-/**
- * Zooms the visable and loopable range by the factor
- * (counter / denominator). The split point is used as
- * center point of the new selected range.
- */
-static void zoom(struct mp3entry *mp3, int counter, int denominator)
-{
- unsigned char oldbuf[OSCI_WIDTH];
- int oldrange = range_end - range_start;
- int range = oldrange * counter / denominator;
- int i;
- int oldindex;
- int oldsplitx;
- int splitx;
- int split;
-
- /* for stretching / shrinking a second buffer is needed */
- rb->memcpy(&oldbuf, &osci_buffer, sizeof osci_buffer);
-
- /* recalculate the new range and split point */
- oldsplitx = split_x;
- split = xpos_to_time(split_x);
-
- set_range_by_time(mp3, split, range);
- range = range_end - range_start;
-
- splitx = time_to_xpos(split);
-
- /* strech / shrink the existing osci buffer */
- for (i = 0; i < OSCI_WIDTH; i++)
- {
- /* oldindex = (i + OSCI_X - splitx) * range / oldrange + oldsplitx ;*/
- oldindex = (i*range / oldrange) + oldsplitx - (splitx*range /oldrange);
- if (oldindex >= 0 && oldindex < OSCI_WIDTH)
- {
- osci_buffer[i] = oldbuf[oldindex];
- }
- else
- {
- osci_buffer[i] = 0;
- }
- }
-
- splitx = time_to_xpos(split);
- splitedit_set_split_x(splitx);
- splitedit_invalidate_osci();
-
-}
-
-static void scroll(struct mp3entry *mp3)
-{
- zoom(mp3, 1, 1);
- rb->lcd_update_rect(OSCI_X, OSCI_Y, LCD_WIDTH, OSCI_HEIGHT);
- update_osci();
- update_data();
-}
-
-/**
- * Zooms in by 3/4
- */
-static void splitedit_zoom_in(struct mp3entry *mp3)
-{
- rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- rb->lcd_fillrect(OSCI_X, OSCI_Y, OSCI_WIDTH, OSCI_HEIGHT);
- rb->lcd_set_drawmode(DRMODE_SOLID);
- zoom(mp3, 3, 4);
- rb->lcd_update_rect(OSCI_X, OSCI_Y, LCD_WIDTH, OSCI_HEIGHT);
- update_osci();
- update_data();
-}
-
-/**
- * Zooms out by 4/3
- */
-static void splitedit_zoom_out(struct mp3entry *mp3)
-{
- rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- rb->lcd_fillrect(OSCI_X, OSCI_Y, LCD_WIDTH, OSCI_HEIGHT);
- rb->lcd_set_drawmode(DRMODE_SOLID);
- zoom(mp3, 4, 3);
- rb->lcd_update_rect(OSCI_X, OSCI_Y, LCD_WIDTH, OSCI_HEIGHT);
- update_osci();
- update_data();
-}
-
-/**
- * Append part_no to the file name.
- */
-static void generateFileName(char* file_name, int part_no)
-{
- if (rb->strlen(file_name) <MAX_PATH)
- {
- int len = rb->strlen(file_name);
- int ext_len = rb->strlen(".mp3");
- if (rb->strcasecmp(
- &file_name[len - ext_len],
- ".mp3") == 0)
- {
- int i = 0;
- /* shift the extension one position to the right*/
- for (i = len; i > len - ext_len; i--)
- {
- file_name[i] = file_name[i - 1];
- }
- file_name[len - ext_len] = '0' + part_no;
- }
- else
- {
- rb->splash(0, "wrong extension");
- rb->button_get(true);
- rb->button_get(true);
- }
- }
- else
- {
- rb->splash(0, "name too long");
- rb->button_get(true);
- rb->button_get(true);
-
- }
-
-}
-
-/**
- * Copy bytes from src to dest while displaying a progressbar.
- * The files must be already open.
- */
-static int copy_file(
- int dest,
- int src,
- unsigned int bytes,
- int prg_y,
- int prg_h)
-{
- long button;
- unsigned char *buffer;
- unsigned int i = 0;
- ssize_t bytes_read = 1; /* ensure the for loop is executed */
- size_t buffer_size;
- buffer = rb->plugin_get_buffer(&buffer_size);
-
- for (i = 0; i < bytes && bytes_read > 0; i += bytes_read)
- {
- ssize_t bytes_written;
- unsigned int bytes_to_read =
- bytes - i > buffer_size ? buffer_size : bytes - i;
- bytes_read = rb->read(src, buffer, bytes_to_read);
- bytes_written = rb->write(dest, buffer, bytes_read);
-
- if (bytes_written < 0) {
- rb->splash(0, "Write failed in copy.");
- rb->button_get(true);
- rb->button_get(true);
- return -1;
- }
-
- button = rb->button_get(false);
-
- if (button == SPLITEDIT_QUIT
-#ifdef SPLITEDIT_RC_QUIT
- || button == SPLITEDIT_RC_QUIT:
-#endif
- ) {
- rb->splash(0, "Aborting copy.");
- rb->button_get(true);
- rb->button_get(true);
- return -1;
- }
-
- rb->gui_scrollbar_draw(rb->screens[SCREEN_MAIN],0, prg_y, LCD_WIDTH,
- prg_h, bytes, 0, i, HORIZONTAL);
- rb->lcd_update_rect(0, prg_y, LCD_WIDTH, prg_h);
- }
-
- return 0;
-}
-
-/**
- * Save the files, if the file_name is not NULL
- */
-static int save(
- struct mp3entry *mp3,
- char *file_name1,
- char *file_name2,
- int splittime)
-{
- int file1, file2, src_file;
- unsigned int end = 0;
- int retval = 0;
-
- /* Verify that file 1 doesn't exit yet */
- if (file_name1 != NULL)
- {
- file1 = rb->open(file_name1, O_RDONLY);
- if (file1 >= 0)
- {
- rb->close(file1);
- rb->splash(0, "File 1 exists. Please rename.");
- rb->button_get(true);
- rb->button_get(true);
- return -1;
- }
- }
-
- /* Verify that file 2 doesn't exit yet */
- if (file_name2 != NULL)
- {
- file2 = rb->open(file_name2, O_RDONLY);
- if (file2 >= 0)
- {
- rb->close(file2);
- rb->splash(0, "File 2 exists. Please rename.");
- rb->button_get(true);
- rb->button_get(true);
- return -2;
- }
- }
-
- /* find the file position of the split point */
- rb->audio_pause();
- rb->audio_ff_rewind(splittime);
- rb->yield();
- rb->yield();
- end = rb->audio_get_file_pos();
-
- /* open the source file */
- src_file = rb->open(mp3->path, O_RDONLY);
- if (src_file >= 0)
- {
- int close_stat = 0;
- int x, y;
- long offset;
- unsigned long last_header = rb->mpeg_get_last_header();
-
- rb->lcd_getstringsize("M", &x, &y);
-
- /* Find the next frame boundary */
- rb->lseek(src_file, end, SEEK_SET);
- rb->find_next_frame(src_file, &offset, 8000, last_header);
- rb->lseek(src_file, 0, SEEK_SET);
- end += offset;
-
- /* write the file 1 */
- if (file_name1 != NULL)
- {
- file1 = rb->open (file_name1, O_WRONLY | O_CREAT, 0666);
- if (file1 >= 0)
- {
- int rc = copy_file(file1, src_file, end, y*2 + 1, y -1);
- close_stat = rb->close(file1);
-
- if (close_stat != 0)
- {
- rb->splashf(0, "failed closing file1: error %d", close_stat);
- rb->button_get(true);
- rb->button_get(true);
- } else {
- /* If there was an error, cleanup */
- if (rc) {
- rb->remove(file_name1);
- }
- }
- }
- else
- {
- rb->splashf(0, "Can't write File1: error %d", file1);
- rb->button_get(true);
- rb->button_get(true);
- retval = -1;
- }
- }
- /* if file1 hasn't been written we're not at the split point yet */
- else
- {
- if (rb->lseek(src_file, end, SEEK_SET) < (off_t)end)
- {
- rb->splashf(0, "Src file to short: error %d", src_file);
- rb->button_get(true);
- rb->button_get(true);
- }
- }
-
- if (file_name2 != NULL)
- {
- /* write file 2 */
- file2 = rb->open (file_name2, O_WRONLY | O_CREAT, 0666);
- if (file2 >= 0)
- {
- end = mp3->filesize - end;
- int rc = copy_file(file2, src_file, end, y * 5 + 1, y -1);
- close_stat = rb->close(file2);
-
- if (close_stat != 0)
- {
- rb->splashf(0, "failed: closing file2: error %d",
- close_stat);
- rb->button_get(true);
- rb->button_get(true);
- } else {
- /* If there was an error, cleanup */
- if (rc) {
- rb->remove(file_name2);
- }
- }
- }
- else
- {
- rb->splashf(0, "Can't write File2: error %d", file2);
- rb->button_get(true);
- rb->button_get(true);
- retval = -2;
- }
- }
-
- close_stat = rb->close(src_file);
- if (close_stat != 0)
- {
- rb->splashf(0, "failed: closing src: error %d", close_stat);
- rb->button_get(true);
- rb->button_get(true);
- }
- }
- else
- {
- rb->splash(0, "Source file not found");
- rb->button_get(true);
- rb->button_get(true);
- retval = -3;
- }
-
- rb->audio_resume();
-
- return retval;
-}
-
-static void puts_wrapper(int x, int y, const char *str, bool scroll, bool selected)
-{
- struct line_desc line = LINE_DESC_DEFINIT;
- struct screen *lcd = rb->screens[SCREEN_MAIN];
- int w = lcd->getcharwidth();
- int h = lcd->getcharheight();
-
- line.scroll = scroll;
- line.style = selected ? STYLE_INVERT : STYLE_DEFAULT;
-
- rb->screens[0]->put_line(x * w, y * h, &line, str);
-}
-
-/**
- * Let the user choose which file to save with which name
- */
-static void save_editor(struct mp3entry *mp3, int splittime)
-{
- bool exit_request = false;
- int choice = 0;
- int button = BUTTON_NONE;
- char part1_name [MAX_PATH];
- char part2_name [MAX_PATH];
- bool part1_save = true;
- bool part2_save = true;
-
- /* file name for left part */
- rb->strlcpy(part1_name, mp3->path, MAX_PATH);
- generateFileName(part1_name, 1);
-
- /* file name for right part */
- rb->strlcpy(part2_name, mp3->path, MAX_PATH);
- generateFileName(part2_name, 2);
-
- while (!exit_request)
- {
- int pos;
- rb->lcd_clear_display();
-
- /* Save file1? */
- puts_wrapper(0, 0, "Save part 1?", false, choice == SE_PART1_SAVE);
- puts_wrapper(7, 0, part1_save?"yes":"no", false, false);
-
- /* trim to display the filename without path */
- for (pos = rb->strlen(part1_name); pos > 0; pos--)
- {
- if (part1_name[pos] == '/')
- break;
- }
- pos++;
-
- /* File name 1 */
- puts_wrapper(0, 1, &part1_name[pos], true, choice == SE_PART1_NAME);
-
- /* Save file2? */
- puts_wrapper(0, 3, "Save part 2?", false, choice == SE_PART2_SAVE);
- puts_wrapper(7, 3, part2_save?"yes":"no", false, false);
-
- /* trim to display the filename without path */
- for (pos = rb->strlen(part2_name); pos > 0; pos --)
- {
- if (part2_name[pos] == '/')
- break;
- }
- pos++;
-
- /* File name 2 */
- puts_wrapper(0, 4, &part2_name[pos], true, choice == SE_PART2_NAME);
-
- /* Save */
- puts_wrapper(0, 6, "Save", false, choice == SE_SAVE);
-
- rb->lcd_update();
-
-
- button = rb->button_get(true);
- switch (button)
- {
- case BUTTON_UP:
- choice = (choice + SE_COUNT - 1) % SE_COUNT;
- break;
-
- case BUTTON_DOWN:
- choice = (choice + 1) % SE_COUNT;
- break;
-
- case SPLITEDIT_MENU_RUN:
- switch (choice)
- {
- int saved;
-
- case SE_PART1_SAVE:
- part1_save = !part1_save;
- break;
-
- case SE_PART1_NAME:
- rb->kbd_input(part1_name, MAX_PATH, NULL);
- break;
-
- case SE_PART2_SAVE:
- part2_save = !part2_save;
- break;
-
- case SE_PART2_NAME:
- rb->kbd_input(part2_name, MAX_PATH, NULL);
- break;
-
- case SE_SAVE:
- rb->lcd_scroll_stop();
- rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- rb->lcd_fillrect(0, 6*8, LCD_WIDTH, LCD_HEIGHT);
- rb->lcd_set_drawmode(DRMODE_SOLID);
- saved = save
- (
- mp3,
- part1_save?part1_name:NULL,
- part2_save?part2_name:NULL,
- splittime
- );
-
- /* if something failed the user may go on choosing */
- if (saved >= 0)
- {
- exit_request = true;
- }
- break;
- }
- break;
-#ifdef SPLITEDIT_RC_QUIT
- case SPLITEDIT_RC_QUIT:
-#endif
- case SPLITEDIT_QUIT:
- exit_request = true;
- break;
-
- default:
- if (rb->default_event_handler(button) == SYS_USB_CONNECTED)
- {
- splitedit_exit_code = PLUGIN_USB_CONNECTED;
- exit_request = true;
- }
- break;
- }
- }
-}
-
-/**
- * The main loop of the editor
- */
-static unsigned long splitedit_editor(struct mp3entry * mp3_to_split,
- unsigned int split_time,
- unsigned int range)
-{
- int button = BUTTON_NONE;
- int lastbutton = BUTTON_NONE;
- struct mp3entry *mp3 = mp3_to_split;
- unsigned int last_elapsed = 0;
- int lastx = OSCI_X + (OSCI_WIDTH / 2);
- int retval = -1;
-
- if (mp3 != NULL)
- {
- /*unsigned short scheme = SCHEME_SPLIT_EDITOR;*/
- bool exit_request = false;
- set_range_by_time(mp3, split_time, range);
- splitedit_set_loop_mode(LOOP_MODE_ALL);
- update_icons();
-
- /*while (scheme != SCHEME_RETURN) {*/
- while (!exit_request)
- {
- unsigned int elapsed ;
- int x ;
-
- /* get position */
- elapsed = mp3->elapsed;
- x = time_to_xpos(elapsed);
-
- /* are we still in the zoomed range? */
- if (elapsed > play_start && elapsed < play_end)
- {
- /* read volume info */
- unsigned short volume;
- volume = OSCI_HEIGHT / 2;
-
- /* update osci_buffer */
- if (osci_valid || lastx == x)
- {
- int index = x - OSCI_X;
- osci_buffer[index] = MAX(osci_buffer[index], volume);
- }
- else
- {
- int i;
- osci_buffer[x - OSCI_X] = volume;
- for (i = lastx + 1; i < x; i++)
- {
- osci_buffer[i - OSCI_X] = 0;
- }
- }
-
- /* make room */
- rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- rb->lcd_fillrect(lastx + 1, OSCI_Y, x - lastx, OSCI_HEIGHT);
- rb->lcd_set_drawmode(DRMODE_SOLID);
- /* draw a value */
- if (osci_buffer[x - OSCI_X] > 0)
- {
- int i;
- for (i = lastx +1; i <= x; i++)
- {
- rb->lcd_vline
- (
- i, OSCI_Y + OSCI_HEIGHT - 1,
- OSCI_Y + OSCI_HEIGHT - osci_buffer[i - OSCI_X]-1
- );
- }
- }
-
- /* mark the current position */
- if (lastx != x)
- {
- rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
- rb->lcd_fillrect(lastx, OSCI_Y, 1, OSCI_HEIGHT);
- rb->lcd_fillrect(x, OSCI_Y, 1, OSCI_HEIGHT);
- rb->lcd_set_drawmode(DRMODE_SOLID);
- }
-
- /* mark the split point */
- if ((x > split_x - 2) && (lastx < split_x + 3))
- {
- if ((lastx < split_x) && (x >= split_x))
- {
- rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
- rb->lcd_fillrect
- (
- split_x, OSCI_Y + 2,
- 1, OSCI_HEIGHT - 2
- );
- rb->lcd_set_drawmode(DRMODE_SOLID);
- }
- rb->lcd_hline(split_x -2, split_x + 2, OSCI_Y);
- rb->lcd_hline(split_x-1, split_x +1,OSCI_Y+1);
- }
-
- /* make visible */
- if (lastx <= x)
- {
- rb->lcd_update_rect(lastx, OSCI_Y, x-lastx+1, OSCI_HEIGHT);
- }
- else
- {
- rb->lcd_update_rect
- (
- lastx, OSCI_Y,
- OSCI_X + OSCI_WIDTH - lastx, OSCI_HEIGHT
- );
- rb->lcd_update_rect(0, OSCI_Y, x + 1, OSCI_HEIGHT);
- }
-
- lastx = x;
- }
-
- /* we're not in the zoom range -> rewind */
- else
- {
- if (elapsed >= play_end)
- {
- switch (splitedit_get_loop_mode())
- {
- unsigned int range_width;
-
- case LOOP_MODE_ALL:
- case LOOP_MODE_TO:
- rb->audio_pause();
- rb->audio_ff_rewind(range_start);
-#if (CONFIG_STORAGE & STORAGE_MMC)
-/* MMC is slow - wait some time to allow track reload to finish */
- rb->sleep(HZ/20);
- if (mp3->elapsed > play_end) /* reload in progress */
- rb->splash(10*HZ, "Wait - reloading");
-#endif
- rb->audio_resume();
- break;
-
- case LOOP_MODE_FROM:
- rb->audio_pause();
- rb->audio_ff_rewind(xpos_to_time(split_x));
-#if (CONFIG_STORAGE & STORAGE_MMC)
-/* MMC is slow - wait some time to allow track reload to finish */
- rb->sleep(HZ/20);
- if (mp3->elapsed > play_end) /* reload in progress */
- rb->splash(10*HZ, "Wait - reloading");
-#endif
- rb->audio_resume();
- break;
-
- case LOOP_MODE_FREE:
- range_width = range_end - range_start;
- set_range_by_time(mp3,
- range_end + range_width / 2, range_width);
-
- /* play_end und play_start anpassen */
- splitedit_set_loop_mode(LOOP_MODE_FREE);
- rb->memset(osci_buffer, 0, sizeof osci_buffer);
- update_osci();
- rb->lcd_update();
- break;
- }
- }
- }
-
- button = rb->button_get(false);
- rb->yield();
-
- /* here the evaluation of the key scheme starts.
- All functions the user triggers are called from
- within execute_scheme */
- /* key_scheme_execute(button, &scheme); */
- switch (button)
- {
- case SPLITEDIT_PLAY:
-#ifdef SPLITEDIT_PLAY_PRE
- if (lastbutton != SPLITEDIT_PLAY_PRE)
- break;
-#endif
- rb->audio_pause();
- rb->audio_ff_rewind(xpos_to_time(split_x));
- rb->audio_resume();
- break;
-
- case BUTTON_UP:
- splitedit_zoom_in(mp3);
- lastx = time_to_xpos(mp3->elapsed);
- break;
-
- case BUTTON_DOWN:
- splitedit_zoom_out(mp3);
- lastx = time_to_xpos(mp3->elapsed);
- break;
-
- case BUTTON_LEFT:
- case BUTTON_LEFT | BUTTON_REPEAT:
- if (splitedit_get_split_x() > OSCI_X + 2)
- {
- splitedit_set_split_x(splitedit_get_split_x() - 1);
- }
- else
- {
- scroll(mp3);
- lastx = time_to_xpos(mp3->elapsed);
- }
- break;
-
- case BUTTON_RIGHT:
- case BUTTON_RIGHT | BUTTON_REPEAT:
- if (splitedit_get_split_x() < OSCI_X + OSCI_WIDTH-3)
- {
- splitedit_set_split_x(splitedit_get_split_x() + 1);
- }
- else
- {
- scroll(mp3);
- lastx = time_to_xpos(mp3->elapsed);
- }
- break;
-
- case SPLITEDIT_SAVE:
- save_editor(mp3, xpos_to_time(split_x));
- rb->lcd_clear_display();
- update_osci();
- update_timebar(mp3);
- update_icons();
- break;
-
- case SPLITEDIT_LOOP_MODE:
- splitedit_set_loop_mode(splitedit_get_loop_mode() + 1);
- update_icons();
- break;
-
- case SPLITEDIT_SCALE:
- splitedit_invalidate_osci();
- update_icons();
- break;
-
-#ifdef SPLITEDIT_RC_QUIT
- case SPLITEDIT_RC_QUIT:
-#endif
- case SPLITEDIT_QUIT:
- exit_request = true;
- break;
-
- default:
- if (rb->default_event_handler(button) == SYS_USB_CONNECTED)
- {
- splitedit_exit_code = PLUGIN_USB_CONNECTED;
- exit_request = true;
- }
- break;
-
- }
- if (button != BUTTON_NONE)
- lastbutton = button;
-
- if (validation_start == ~(unsigned int)0)
- {
- if (elapsed < range_end && elapsed > range_start)
- {
- validation_start = elapsed;
- }
- else
- {
- int endx = time_to_xpos(range_end);
- validation_start = xpos_to_time(endx - 2);
- }
- last_elapsed = elapsed + 1;
- }
- else
- {
- if ((last_elapsed <= validation_start) &&
- (elapsed > validation_start))
- {
- osci_valid = true;
- }
-
- last_elapsed = elapsed;
- }
- update_data();
-
- if (mp3 != rb->audio_current_track())
- {
- struct mp3entry *new_mp3 = rb->audio_current_track();
- if (rb->strncasecmp(path_mp3, new_mp3->path,
- sizeof (path_mp3)))
- {
- rb->splash(0, "Abort due to file change");
- rb->button_get(true);
- rb->button_get(true);
- exit_request = true;
- }
- else
- {
- mp3 = new_mp3;
- rb->audio_pause();
- rb->audio_flush_and_reload_tracks();
- rb->audio_ff_rewind(range_start);
- rb->audio_resume();
- }
- }
- }
- }
- return retval;
-}
-
-enum plugin_status plugin_start(const void* parameter)
-{
- struct mp3entry* mp3;
-
- (void)parameter;
- rb->lcd_clear_display();
- rb->lcd_update();
- mp3 = rb->audio_current_track();
- if (mp3 != NULL)
- {
- if (rb->audio_status() & AUDIO_STATUS_PAUSE)
- {
- rb->audio_resume();
- }
- splitedit_editor(mp3, mp3->elapsed, MIN_RANGE_SIZE * 8);
- }
- else
- {
- rb->splash(0, "Play or pause a mp3 file first.");
- rb->button_get(true);
- rb->button_get(true);
- }
- return splitedit_exit_code;
-}
diff --git a/apps/plugins/starfield.c b/apps/plugins/starfield.c
index dff3c4b4d1..24e2e4c085 100644
--- a/apps/plugins/starfield.c
+++ b/apps/plugins/starfield.c
@@ -220,7 +220,6 @@ static int plugin_main(void)
rb->sleep(1);
rb->lcd_clear_display();
-#if (CONFIG_CODEC == SWCODEC)
/* This will make the stars pulse to the music */
if(pulse){
@@ -255,7 +254,7 @@ static int plugin_main(void)
starfield.z_move = avg_peak;
} /* if pulse */
-#endif
+
starfield_move_and_draw(&starfield);
#ifdef HAVE_LCD_COLOR
diff --git a/apps/plugins/vu_meter.c b/apps/plugins/vu_meter.c
index a4d639ede6..d2ba8c992c 100644
--- a/apps/plugins/vu_meter.c
+++ b/apps/plugins/vu_meter.c
@@ -469,10 +469,6 @@
#endif
#endif
-#if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
-#define mas_codec_readreg(x) rand()%MAX_PEAK
-#endif
-
/* Defines x positions on a logarithmic (dBfs) scale. */
unsigned char analog_db_scale[LCD_WIDTH/2];
@@ -780,13 +776,11 @@ static void draw_digital_minimeters(void) {
static void analog_meter(void) {
-#if (CONFIG_CODEC == SWCODEC)
static struct pcm_peaks peaks;
rb->mixer_channel_calculate_peaks(PCM_MIXER_CHAN_PLAYBACK,
&peaks);
#define left_peak peaks.left
#define right_peak peaks.right
-#endif
if(vumeter_settings.analog_use_db_scale) {
left_needle_top_x = analog_db_scale[left_peak * half_width / MAX_PEAK];
@@ -837,13 +831,11 @@ static void analog_meter(void) {
}
static void digital_meter(void) {
-#if (CONFIG_CODEC == SWCODEC)
static struct pcm_peaks peaks;
rb->mixer_channel_calculate_peaks(PCM_MIXER_CHAN_PLAYBACK,
&peaks);
#define left_peak peaks.left
#define right_peak peaks.right
-#endif
if(vumeter_settings.digital_use_db_scale) {
num_left_leds = digital_db_scale[left_peak * 44 / MAX_PEAK];
diff --git a/apps/plugins/zxbox/spmain.c b/apps/plugins/zxbox/spmain.c
index e27770c70c..6c6b59c3fb 100644
--- a/apps/plugins/zxbox/spmain.c
+++ b/apps/plugins/zxbox/spmain.c
@@ -290,7 +290,7 @@ static void options_menu(void){
no_yes, 2, NULL);
if (new_setting != settings.sound )
settings.sound=new_setting;
-#if CONFIG_CODEC == SWCODEC && !defined SIMULATOR
+#if !defined SIMULATOR
rb->pcm_play_stop();
#endif
break;
@@ -318,7 +318,7 @@ static void options_menu(void){
/* menu */
static bool zxbox_menu(void)
{
-#if CONFIG_CODEC == SWCODEC && !defined SIMULATOR
+#if !defined SIMULATOR
rb->pcm_play_stop();
#endif
int selected=0;
diff --git a/apps/plugins/zxbox/zxbox.c b/apps/plugins/zxbox/zxbox.c
index d618243b92..4ebc0e0a9e 100644
--- a/apps/plugins/zxbox/zxbox.c
+++ b/apps/plugins/zxbox/zxbox.c
@@ -102,9 +102,9 @@ enum plugin_status plugin_start(const void* parameter)
#ifdef USE_GREY
grey_show(false);
grey_release();
-#endif
+#endif
-#if CONFIG_CODEC == SWCODEC && !defined SIMULATOR
+#if !defined SIMULATOR
rb->pcm_play_stop();
#endif
diff --git a/apps/plugins/zxbox/zxconfig.h b/apps/plugins/zxbox/zxconfig.h
index 590da99f15..fb93dc5081 100644
--- a/apps/plugins/zxbox/zxconfig.h
+++ b/apps/plugins/zxbox/zxconfig.h
@@ -29,7 +29,7 @@ extern int intkeys[5];
#define SPECT_MEM 1
/* Define if sound driver is available. */
-#if CONFIG_CODEC == SWCODEC && !defined SIMULATOR
+#if !defined SIMULATOR
#define HAVE_SOUND
#endif
diff --git a/apps/radio/radio.c b/apps/radio/radio.c
index 362d10f9a3..6038d600a9 100644
--- a/apps/radio/radio.c
+++ b/apps/radio/radio.c
@@ -54,9 +54,7 @@
#include "viewport.h"
#include "skin_engine/skin_engine.h"
#include "statusbar-skinned.h"
-#if CONFIG_CODEC == SWCODEC
#include "playback.h"
-#endif
#include "presets.h"
#if CONFIG_TUNER
@@ -353,14 +351,6 @@ void radio_screen(void)
int lastbutton = BUTTON_NONE;
unsigned long rec_lastclick = 0;
#endif
-#if CONFIG_CODEC != SWCODEC
- int timeout = current_tick + HZ/10;
-#if !defined(SIMULATOR)
- unsigned int last_seconds = 0;
- unsigned int seconds = 0;
- struct audio_recording_options rec_options;
-#endif /* SIMULATOR */
-#endif /* CONFIG_CODEC != SWCODEC */
#ifndef HAVE_NOISY_IDLE_MODE
int button_timeout = current_tick + (2*HZ);
#endif
@@ -383,29 +373,7 @@ void radio_screen(void)
fms_fix_displays(FMS_ENTER);
-#ifndef SIMULATOR
-
-#if CONFIG_CODEC != SWCODEC
- rec_create_directory();
- audio_init_recording();
-
- sound_settings_apply();
- /* Yes, we use the D/A for monitoring */
- peak_meter_playback(true);
-
- peak_meter_enable(true);
-
- rec_init_recording_options(&rec_options);
- rec_options.rec_source = AUDIO_SRC_LINEIN;
- rec_set_recording_options(&rec_options);
-
- audio_set_recording_gain(sound_default(SOUND_LEFT_GAIN),
- sound_default(SOUND_RIGHT_GAIN), AUDIO_GAIN_LINEIN);
-
-#endif /* CONFIG_CODEC != SWCODEC */
-#endif /* ndef SIMULATOR */
/* turn on radio */
-#if CONFIG_CODEC == SWCODEC
/* This should be done before touching audio settings */
while (!pcm_is_initialized())
sleep(0);
@@ -413,10 +381,6 @@ void radio_screen(void)
audio_set_input_source(AUDIO_SRC_FMRADIO,
(radio_status == FMRADIO_PAUSED) ?
SRCF_FMRADIO_PAUSED : SRCF_FMRADIO_PLAYING);
-#else
- if (radio_status == FMRADIO_OFF)
- radio_start();
-#endif
if(radio_preset_count() < 1 && yesno_pop(ID2P(LANG_FM_FIRST_AUTOSCAN)))
presets_scan(NULL);
@@ -468,13 +432,6 @@ void radio_screen(void)
switch(button)
{
case ACTION_FM_STOP:
-#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR)
- if(audio_status() == AUDIO_STATUS_RECORD)
- {
- audio_stop();
- }
- else
-#endif
{
done = true;
if(presets_have_changed())
@@ -513,18 +470,11 @@ void radio_screen(void)
rec_command(RECORDING_CMD_START);
update_type = SKIN_REFRESH_ALL;
}
-#if CONFIG_CODEC != SWCODEC
- last_seconds = 0;
-#endif
#endif /* SIMULATOR */
break;
#endif /* #ifdef FM_RECORD */
case ACTION_FM_EXIT:
-#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR)
- if(audio_status() == AUDIO_STATUS_RECORD)
- audio_stop();
-#endif
keep_playing = true;
done = true;
if(presets_have_changed())
@@ -629,10 +579,6 @@ void radio_screen(void)
#endif /* FM_FREEZE */
case SYS_USB_CONNECTED:
-#if CONFIG_CODEC != SWCODEC
- /* Only accept USB connection when not recording */
- if(audio_status() != AUDIO_STATUS_RECORD)
-#endif
{
default_event_handler(SYS_USB_CONNECTED);
screen_freeze = true; /* Cosmetic: makes sure the
@@ -688,10 +634,6 @@ void radio_screen(void)
default_event_handler(button);
if (!tuner_get(RADIO_PRESENT))
{
-#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR)
- if(audio_status() == AUDIO_STATUS_RECORD)
- audio_stop();
-#endif
keep_playing = false;
done = true;
if(presets_have_changed())
@@ -713,21 +655,10 @@ void radio_screen(void)
lastbutton = button;
#endif
-#if CONFIG_CODEC != SWCODEC
- peak_meter_peek();
-#endif
-
if(!screen_freeze)
{
/* Only display the peak meter when not recording */
-#if CONFIG_CODEC != SWCODEC
- if(TIME_AFTER(current_tick, timeout))
- {
- timeout = current_tick + HZ;
-#else /* SWCODEC */
{
-#endif /* CONFIG_CODEC == SWCODEC */
-
/* keep "mono" from always being displayed when paused */
if (radio_status != FMRADIO_PAUSED)
{
@@ -742,15 +673,8 @@ void radio_screen(void)
}
}
-#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR)
- seconds = audio_recorded_time() / HZ;
- if (update_type || seconds > last_seconds)
- {
- last_seconds = seconds;
-#else
if (update_type)
{
-#endif
FOR_NB_SCREENS(i)
skin_update(FM_SCREEN, i, update_type);
if (update_type == (int)SKIN_REFRESH_ALL)
@@ -774,13 +698,6 @@ void radio_screen(void)
enqueue);
}
-#if CONFIG_CODEC != SWCODEC
- if(audio_status() & AUDIO_STATUS_ERROR)
- {
- done = true;
- }
-#endif
-
#ifndef HAVE_NOISY_IDLE_MODE
if (TIME_AFTER(current_tick, button_timeout))
{
@@ -790,23 +707,6 @@ void radio_screen(void)
} /*while(!done)*/
#ifndef SIMULATOR
-#if CONFIG_CODEC != SWCODEC
- if(audio_status() & AUDIO_STATUS_ERROR)
- {
- splash(0, str(LANG_DISK_FULL));
- audio_error_clear();
-
- while(1)
- {
- button = get_action(CONTEXT_FM|ALLOW_SOFTLOCK, TIMEOUT_BLOCK);
- if(button == ACTION_FM_STOP)
- break;
- }
- }
-
- audio_init_playback();
-#endif /* CONFIG_CODEC != SWCODEC */
-
sound_settings_apply();
#endif /* SIMULATOR */
@@ -814,23 +714,12 @@ void radio_screen(void)
{
/* Catch FMRADIO_PLAYING status for the sim. */
#ifndef SIMULATOR
-#if CONFIG_CODEC != SWCODEC
- /* Enable the Left and right A/D Converter */
- audio_set_recording_gain(sound_default(SOUND_LEFT_GAIN),
- sound_default(SOUND_RIGHT_GAIN),
- AUDIO_GAIN_LINEIN);
- mas_codec_writereg(6, 0x4000);
-#endif
end_search();
#endif /* SIMULATOR */
}
else
{
-#if CONFIG_CODEC == SWCODEC
audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
-#else
- radio_stop();
-#endif
}
#ifndef HAVE_NOISY_IDLE_MODE
diff --git a/apps/radio/radio_skin.c b/apps/radio/radio_skin.c
index 90aa977e56..4d90c4e241 100644
--- a/apps/radio/radio_skin.c
+++ b/apps/radio/radio_skin.c
@@ -41,7 +41,7 @@
char* default_radio_skin(enum screen_type screen)
{
(void)screen;
- static char default_fms[] =
+ static char default_fms[] =
"%s%?Ti<%Ti. |>%?Tn<%Tn|%Tf>\n"
"%Sx(Station:) %tf MHz\n"
"%?St(force fm mono)<%Sx(Force Mono)|%?ts<%Sx(Stereo)|%Sx(Mono)>>\n"
@@ -49,9 +49,6 @@ char* default_radio_skin(enum screen_type screen)
#ifdef HAVE_RADIO_RSSI
"%Sx(Signal strength:) %tr dBuV\n"
#endif
-#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR)
- "%?Rr<%Sx(Time:) %Rh:%Rn:%Rs|%?St(prerecording time)<%pm|%Sx(Prerecord Time) %Rs>>\n"
-#endif
"%pb\n"
#ifdef HAVE_RDS_CAP
"\n%s%ty\n"
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c
index 03a88c9fdc..cc53716674 100644
--- a/apps/recorder/icons.c
+++ b/apps/recorder/icons.c
@@ -40,10 +40,6 @@ const unsigned char bitmap_icons_5x8[][5] =
{0x7f, 0x22, 0x1c, 0x22, 0x7f}, /* Stereo recording */
[Icon_Mono] =
{0x00, 0x1c, 0x22, 0x7f, 0x00}, /* Mono recording */
-#if CONFIG_CODEC != SWCODEC
- [Icon_q] =
- {0x1e, 0x21, 0x31, 0x21, 0x5e} /* Q icon */
-#endif
};
const unsigned char bitmap_icons_7x8[][7] =
@@ -68,7 +64,7 @@ const unsigned char bitmap_icons_7x8[][7] =
{0x7f,0x04,0x4e,0x5f,0x44,0x38,0x7f} /* Repeat-AB playmode */
};
-#if CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING)
+#if defined(HAVE_RECORDING)
const unsigned char bitmap_glyphs_4x8[][4] =
{
/* Keep digits together and first! */
@@ -116,7 +112,7 @@ const unsigned char bitmap_formats_18x8[Format_18x8Last][18]=
{0x00, 0x1e, 0x20, 0x18, 0x20, 0x1e, 0x00, 0x3c, 0x0a,
0x0a, 0x0a, 0x3c, 0x00, 0x0e, 0x10, 0x20, 0x10, 0x0e}, /* WAV */
};
-#endif /* CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING) */
+#endif /* defined(HAVE_RECORDING) */
/* Disk/MMC activity */
const unsigned char bitmap_icon_disk[12] =
diff --git a/apps/recorder/icons.h b/apps/recorder/icons.h
index 3c955ffe5b..4faa757184 100644
--- a/apps/recorder/icons.h
+++ b/apps/recorder/icons.h
@@ -42,9 +42,6 @@ enum icons_5x8 {
Icon_Lock_Remote,
Icon_Stereo,
Icon_Mono,
-#if CONFIG_CODEC != SWCODEC
- Icon_q,
-#endif
Icon5x8Last
};
@@ -70,7 +67,7 @@ enum icons_7x8 {
Icon7x8Last
};
-#if CONFIG_CODEC == SWCODEC && defined (HAVE_RECORDING)
+#if defined (HAVE_RECORDING)
#define BM_GLYPH_WIDTH 4
enum Glyphs_4x8 {
Glyph_4x8_0 = 0,
@@ -100,7 +97,7 @@ enum rec_format_18x8 {
};
extern const unsigned char bitmap_formats_18x8[Format_18x8Last][18];
-#endif /* CONFIG_CODEC == SWCODEC && defined (HAVE_RECORDING) */
+#endif /* defined (HAVE_RECORDING) */
extern const unsigned char bitmap_icons_5x8[Icon5x8Last][5];
extern const unsigned char bitmap_icons_7x8[Icon7x8Last][7];
diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c
index 4b19287b7f..f735afe84d 100644
--- a/apps/recorder/keyboard.c
+++ b/apps/recorder/keyboard.c
@@ -1218,16 +1218,12 @@ static void kbd_move_cursor(struct edit_state *state, int dir)
else if (state->editpos > state->len_utf8)
{
state->editpos = 0;
- #if CONFIG_CODEC == SWCODEC
if (global_settings.talk_menu) beep_play(1000, 150, 1500);
- #endif
}
else if (state->editpos < 0)
{
state->editpos = state->len_utf8;
- #if CONFIG_CODEC == SWCODEC
if (global_settings.talk_menu) beep_play(1000, 150, 1500);
- #endif
}
}
diff --git a/apps/recorder/peakmeter.c b/apps/recorder/peakmeter.c
index 5ff2f21215..5a03534040 100644
--- a/apps/recorder/peakmeter.c
+++ b/apps/recorder/peakmeter.c
@@ -19,9 +19,6 @@
*
****************************************************************************/
#include "config.h"
-#if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
-#include <stdlib.h> /* sim uses rand for peakmeter simulation */
-#endif
#include "thread.h"
#include "kernel.h"
#include "settings.h"
@@ -42,7 +39,6 @@
#endif
#include "action.h"
-#if CONFIG_CODEC == SWCODEC
#include "pcm.h"
#include "pcm_mixer.h"
@@ -50,17 +46,12 @@
#include "pcm_record.h"
#endif
+#if !(CONFIG_PLATFORM & PLATFORM_HOSTED)
static bool pm_playback = true; /* selects between playback and recording peaks */
#endif
static struct meter_scales scales[NB_SCREENS];
-#if !defined(SIMULATOR) && CONFIG_CODEC != SWCODEC
-/* Data source */
-static int pm_src_left = MAS_REG_DQPEAK_L;
-static int pm_src_right = MAS_REG_DQPEAK_R;
-#endif
-
/* Current values and cumulation */
static int pm_cur_left; /* current values (last peak_meter_peek) */
static int pm_cur_right;
@@ -554,16 +545,8 @@ void peak_meter_playback(bool playback)
{
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
(void)playback;
-#elif CONFIG_CODEC == SWCODEC
- pm_playback = playback;
#else
- if (playback) {
- pm_src_left = MAS_REG_DQPEAK_L;
- pm_src_right = MAS_REG_DQPEAK_R;
- } else {
- pm_src_left = MAS_REG_QPEAK_L;
- pm_src_right = MAS_REG_QPEAK_R;
- }
+ pm_playback = playback;
#endif
/* reset the scales just in case recording and playback
use different viewport sizes. Normally we should be checking viewport
@@ -599,7 +582,10 @@ void peak_meter_peek(void)
bool was_clipping = pm_clip_left || pm_clip_right;
#endif
/* read current values */
-#if CONFIG_CODEC == SWCODEC
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
+ pm_cur_left = left = 8000;
+ pm_cur_right = right = 9000;
+#else
if (pm_playback)
{
static struct pcm_peaks chan_peaks; /* *MUST* be static */
@@ -614,14 +600,6 @@ void peak_meter_peek(void)
#endif
left = pm_cur_left;
right = pm_cur_right;
-#else
-#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
- pm_cur_left = left = mas_codec_readreg(pm_src_left);
- pm_cur_right = right = mas_codec_readreg(pm_src_right);
-#else
- pm_cur_left = left = 8000;
- pm_cur_right = right = 9000;
-#endif
#endif
/* check for clips
@@ -632,22 +610,12 @@ void peak_meter_peek(void)
a real clip. For software codecs, the peak is already
the max of a bunch of samples, so use one max value
or you fail to detect clipping! */
-#if CONFIG_CODEC == SWCODEC
if (left == MAX_PEAK - 1) {
-#else
- if ((left == pm_max_left) &&
- (left == MAX_PEAK - 1)) {
-#endif
pm_clip_left = true;
pm_clip_timeout_l = current_tick + pm_clip_hold;
}
-#if CONFIG_CODEC == SWCODEC
if (right == MAX_PEAK - 1) {
-#else
- if ((right == pm_max_right) &&
- (right == MAX_PEAK - 1)) {
-#endif
pm_clip_right = true;
pm_clip_timeout_r = current_tick + pm_clip_hold;
}
@@ -668,14 +636,12 @@ void peak_meter_peek(void)
pm_max_right = MAX(pm_max_right, right);
#ifdef HAVE_RECORDING
-#if CONFIG_CODEC == SWCODEC
/* Ignore any unread peakmeter data */
#define MAX_DROP_TIME HZ/7 /* this value may need tweaking. Increase if you are
getting trig events when you shouldn't with
trig_stp_hold = 0 */
if (!trig_stp_hold)
trig_stp_hold = MAX_DROP_TIME;
-#endif
switch (trig_status) {
case TRIG_READY:
@@ -735,11 +701,7 @@ void peak_meter_peek(void)
|| (right > trig_stp_threshold)) {
/* restart hold time countdown */
trig_lowtime = current_tick;
-#if CONFIG_CODEC == SWCODEC
} else if (current_tick - trig_lowtime > MAX_DROP_TIME){
-#else
- } else {
-#endif
set_trig_status(TRIG_POSTREC);
trig_hightime = current_tick;
}
@@ -797,12 +759,10 @@ void peak_meter_peek(void)
}
break;
}
-#if CONFIG_CODEC == SWCODEC
/* restore stop hold value */
if (trig_stp_hold == MAX_DROP_TIME)
trig_stp_hold = 0;
#endif
-#endif
/* check levels next time peakmeter drawn */
level_check = true;
#ifdef PM_DEBUG
@@ -822,11 +782,6 @@ static int peak_meter_read_l(void)
by peak_meter_peek since the last call of peak_meter_read_l */
int retval;
-#if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
- srand(current_tick);
- pm_max_left = rand()%MAX_PEAK;
-#endif
-
retval = pm_max_left;
#if defined(HAVE_HISTOGRAM) || defined(HAVE_AGC)
@@ -855,11 +810,6 @@ static int peak_meter_read_r(void)
by peak_meter_peek since the last call of peak_meter_read_r */
int retval;
-#if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
- srand(current_tick);
- pm_max_right = rand()%MAX_PEAK;
-#endif
-
retval = pm_max_right;
#if defined(HAVE_HISTOGRAM) || defined(HAVE_AGC)
@@ -1128,11 +1078,7 @@ static void peak_meter_draw(struct screen *display, struct meter_scales *scales,
/* cliplight */
if ((pm_clip_left || pm_clip_right) &&
global_settings.cliplight &&
-#if CONFIG_CODEC == SWCODEC
!pm_playback)
-#else
- !(audio_status() & (AUDIO_STATUS_PLAY | AUDIO_STATUS_ERROR)))
-#endif
{
/* if clipping, cliplight setting on and in recording screen */
if (global_settings.cliplight <= 2)
@@ -1375,16 +1321,7 @@ int peak_meter_draw_get_btn(int action_context, int x[], int y[],
long next_refresh = current_tick;
long next_big_refresh = current_tick + HZ / 10;
int i;
-#if (CONFIG_CODEC == SWCODEC)
bool highperf = false;
-#else
- /* On MAS targets, we need to poll as often as possible in order to not
- * miss a peak, as the MAS does only provide a quasi-peak. When the disk
- * is active, it must not draw too much CPU power or a buffer overrun can
- * happen when saving a recording. As a compromise, poll only once per tick
- * when the disk is active, otherwise spin around as fast as possible. */
- bool highperf = !storage_disk_is_active();
-#endif
bool dopeek = true;
while (TIME_BEFORE(current_tick, next_big_refresh)) {
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index 553f815e52..36331a72f3 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -31,17 +31,14 @@
#include "lcd.h"
#include "led.h"
#include "audio.h"
-#if CONFIG_CODEC == SWCODEC
#include "thread.h"
#include "enc_config.h"
#include "playback.h"
#if defined(HAVE_SPDIF_IN) || defined(HAVE_SPDIF_OUT)
#include "spdif.h"
#endif
-#endif /* CONFIG_CODEC == SWCODEC */
#include "pcm_record.h"
#include "recording.h"
-#include "mp3_playback.h"
#include "button.h"
#include "kernel.h"
#include "settings.h"
@@ -166,19 +163,9 @@ static bool update_list = false; /* (GIU) list needs updating */
static int file_number = -1;
#endif /* CONFIG_RTC */
-#if CONFIG_CODEC == SWCODEC
-
#define REC_FILE_ENDING(rec_format) \
(audio_formats[rec_format_afmt[rec_format]].ext_list)
-#else /* CONFIG_CODEC != SWCODEC */
-
-/* default record file extension for HWCODEC */
-#define REC_FILE_ENDING(rec_format) \
- (audio_formats[AFMT_MPA_L3].ext_list)
-
-#endif /* CONFIG_CODEC == SWCODEC */
-
/* path for current file */
static char path_buffer[MAX_PATH];
@@ -607,18 +594,12 @@ void rec_init_recording_options(struct audio_recording_options *options)
options->rec_frequency = global_settings.rec_frequency;
options->rec_channels = global_settings.rec_channels;
options->rec_prerecord_time = global_settings.rec_prerecord_time;
-#if CONFIG_CODEC == SWCODEC
options->rec_mono_mode = global_settings.rec_mono_mode;
options->rec_source_flags = 0;
options->enc_config.rec_format = global_settings.rec_format;
global_to_encoder_config(&options->enc_config);
-#else
- options->rec_quality = global_settings.rec_quality;
- options->rec_editable = global_settings.rec_editable;
-#endif
}
-#if CONFIG_CODEC == SWCODEC
void rec_set_source(int source, unsigned flags)
{
/* Set audio input source, power up/down devices */
@@ -628,14 +609,11 @@ void rec_set_source(int source, unsigned flags)
peak_meter_playback((flags & SRCF_RECORDING) == 0);
peak_meter_enable(true);
}
-#endif /* CONFIG_CODEC == SWCODEC */
void rec_set_recording_options(struct audio_recording_options *options)
{
-#if CONFIG_CODEC == SWCODEC
rec_set_source(options->rec_source,
options->rec_source_flags | SRCF_RECORDING);
-#endif
audio_set_recording_options(options);
}
@@ -646,9 +624,7 @@ void rec_command(enum recording_command cmd)
case RECORDING_CMD_STOP_SHUTDOWN:
pm_activate_clipcount(false);
audio_stop_recording();
-#if CONFIG_CODEC == SWCODEC
audio_close_recording();
-#endif
sys_poweroff();
break;
case RECORDING_CMD_STOP:
@@ -695,12 +671,6 @@ static void trigger_listener(int trigger_status)
if(!(audio_status() & AUDIO_STATUS_RECORD))
{
rec_status |= RCSTAT_HAVE_RECORDED;
- rec_command(RECORDING_CMD_START);
-#if CONFIG_CODEC != SWCODEC
- /* give control to mpeg thread so that it can start
- recording */
- yield(); yield(); yield();
-#endif
}
/* if we're already recording this is a retrigger */
@@ -791,14 +761,9 @@ enum rec_list_items_mono {
#ifdef HAVE_SPDIF_REC
enum rec_list_items_spdif {
ITEM_VOLUME_D = 0,
-#if CONFIG_CODEC == SWCODEC
ITEM_SAMPLERATE_D = 6,
ITEM_FILENAME_D = 7,
ITEM_COUNT_D = 3,
-#else
- ITEM_FILENAME_D = 7,
- ITEM_COUNT_D = 2,
-#endif
};
#endif
@@ -892,14 +857,12 @@ static const char* reclist_get_name(int selected_item, void * data,
buf3, sizeof(buf3)));
break;
#endif
-#if CONFIG_CODEC == SWCODEC
#ifdef HAVE_SPDIF_REC
case ITEM_SAMPLERATE_D:
snprintf(buffer, buffer_len, "%s: %lu",
str(LANG_FREQUENCY), pcm_rec_sample_rate());
break;
#endif
-#endif
case ITEM_FILENAME:
{
if(audio_status() & AUDIO_STATUS_RECORD)
@@ -973,16 +936,12 @@ bool recording_screen(bool no_source)
const unsigned long split_seconds = (unsigned) global_settings.rec_timesplit * 60;
const unsigned long split_bytes = rec_sizesplit_bytes();
-#if CONFIG_CODEC == SWCODEC
int warning_counter = 0;
#define WARNING_PERIOD 7
-#endif
-#if CONFIG_CODEC == SWCODEC
#ifdef HAVE_SPDIF_REC
unsigned long prev_sample_rate = 0;
#endif
-#endif
#ifdef HAVE_FMRADIO_REC
/* Radio is left on if:
@@ -1030,7 +989,6 @@ bool recording_screen(bool no_source)
ata_set_led_enabled(false);
#endif
-#if CONFIG_CODEC == SWCODEC
/* hardware samplerate gets messed up so prevent mixer playing */
int keyclick = global_settings.keyclick;
global_settings.keyclick = 0;
@@ -1039,11 +997,6 @@ bool recording_screen(bool no_source)
talk_disable(true);
/* audio_init_recording stops anything playing when it takes the audio
buffer */
-#else
- /* Yes, we use the D/A for monitoring */
- peak_meter_enable(true);
- peak_meter_playback(true);
-#endif
#ifdef HAVE_AGC
peak_meter_get_peakhold(&peak_l, &peak_r);
@@ -1175,7 +1128,7 @@ bool recording_screen(bool no_source)
goto rec_abort;
}
-#if CONFIG_CODEC == SWCODEC && CONFIG_RTC == 0
+#if CONFIG_RTC == 0
/* If format changed, a new number is required */
rec_init_filename();
#endif
@@ -1202,12 +1155,8 @@ bool recording_screen(bool no_source)
if(global_settings.rec_source == AUDIO_SRC_SPDIF)
{
listid_to_enum[0] = ITEM_VOLUME_D;
-#if CONFIG_CODEC == SWCODEC
listid_to_enum[1] = ITEM_SAMPLERATE_D;
listid_to_enum[2] = ITEM_FILENAME_D;
-#else
- listid_to_enum[1] = ITEM_FILENAME_D;
-#endif
gui_synclist_set_nb_items(&lists, ITEM_COUNT_D); /* spdif */
}
@@ -1452,10 +1401,6 @@ bool recording_screen(bool no_source)
}
else
{
-#if CONFIG_CODEC != SWCODEC
- peak_meter_playback(true);
- peak_meter_enable(false);
-#endif
done = 1;
}
update_countdown = 0; /* Update immediately */
@@ -1543,11 +1488,7 @@ bool recording_screen(bool no_source)
update_countdown = 0; /* Update immediately */
break;
case ACTION_STD_MENU:
-#if CONFIG_CODEC == SWCODEC
if(!(audio_stat & AUDIO_STATUS_RECORD))
-#else
- if(audio_stat != AUDIO_STATUS_RECORD)
-#endif
{
#if (CONFIG_LED == LED_REAL)
/* led is restored at begin of loop / end of function */
@@ -1622,7 +1563,6 @@ bool recording_screen(bool no_source)
dsize = split_bytes;
num_recorded_bytes = audio_num_recorded_bytes();
-#if CONFIG_CODEC == SWCODEC
if ((audio_stat & AUDIO_STATUS_WARNING)
&& (warning_counter++ % WARNING_PERIOD) < WARNING_PERIOD/2)
{
@@ -1635,7 +1575,6 @@ bool recording_screen(bool no_source)
(unsigned long)pcm_rec_get_warnings());
}
else
-#endif /* CONFIG_CODEC == SWCODEC */
if ((global_settings.rec_sizesplit) &&
(global_settings.rec_split_method))
{
@@ -1657,16 +1596,11 @@ bool recording_screen(bool no_source)
if(audio_stat & AUDIO_STATUS_PRERECORD)
{
-#if CONFIG_CODEC == SWCODEC
/* Tracks amount of prerecorded data in buffer */
snprintf(buf, sizeof(buf), "%s (%lu/%ds)...",
str(LANG_RECORD_PRERECORD),
audio_prerecorded_time() / HZ,
global_settings.rec_prerecord_time);
-#else /* !SWCODEC */
- snprintf(buf, sizeof(buf), "%s...",
- str(LANG_RECORD_PRERECORD));
-#endif /* CONFIG_CODEC == SWCODEC */
}
else
{
@@ -1782,7 +1716,6 @@ bool recording_screen(bool no_source)
}
#endif /* HAVE_AGC */
-#if CONFIG_CODEC == SWCODEC
#ifdef HAVE_SPDIF_REC
if((global_settings.rec_source == AUDIO_SRC_SPDIF) &&
(prev_sample_rate != pcm_rec_sample_rate()))
@@ -1792,7 +1725,6 @@ bool recording_screen(bool no_source)
update_list = true;
}
#endif
-#endif
if(update_list)
{
@@ -1824,11 +1756,9 @@ bool recording_screen(bool no_source)
FOR_NB_SCREENS(i)
screens[i].update();
-#if CONFIG_CODEC == SWCODEC
/* stop recording first and try to finish saving whatever it can */
rec_command(RECORDING_CMD_STOP);
audio_close_recording();
-#endif
audio_error_clear();
@@ -1841,7 +1771,6 @@ bool recording_screen(bool no_source)
rec_abort:
-#if CONFIG_CODEC == SWCODEC
rec_command(RECORDING_CMD_STOP);
audio_close_recording();
@@ -1861,9 +1790,6 @@ rec_abort:
/* restore keyclick */
global_settings.keyclick = keyclick;
-#else /* !SWCODEC */
- audio_init_playback();
-#endif /* CONFIG_CODEC == SWCODEC */
#ifdef HAVE_SPEAKER
/* Re-enable speaker */
@@ -1895,12 +1821,10 @@ rec_abort:
return (rec_status & RCSTAT_BEEN_IN_USB_MODE) != 0;
} /* recording_screen */
-#if CONFIG_CODEC == SWCODEC
void audio_beep(int duration)
{
/* dummy */
(void)duration;
}
-#endif /* #ifdef CONFIG_CODEC == SWCODEC */
#endif /* HAVE_RECORDING */
diff --git a/apps/recorder/recording.h b/apps/recorder/recording.h
index 406986e8e0..12088f84f6 100644
--- a/apps/recorder/recording.h
+++ b/apps/recorder/recording.h
@@ -33,17 +33,14 @@ void settings_apply_trigger(void);
/* If true, start recording automatically when recording_sreen() is entered */
extern bool recording_start_automatic;
-#if CONFIG_CODEC == SWCODEC
/* handles device powerup, sets audio source and peakmeter mode */
void rec_set_source(int source, unsigned flags);
-#endif /* CONFIG_CODEC == SW_CODEC */
/* Initializes a recording_options structure with global settings.
pass returned data to audio_set_recording_options or
rec_set_recording_options */
void rec_init_recording_options(struct audio_recording_options *options);
/* steals mp3 buffer, sets source and then options */
-/* SRCF_RECORDING is implied for SWCODEC */
void rec_set_recording_options(struct audio_recording_options *options);
enum recording_command
diff --git a/apps/screens.c b/apps/screens.c
index ecd406037d..47f110efd9 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -30,7 +30,6 @@
#include "icons.h"
#include "font.h"
#include "audio.h"
-#include "mp3_playback.h"
#include "usb.h"
#include "settings.h"
#include "status.h"
@@ -380,10 +379,8 @@ static const int id3_headers[]=
LANG_ID3_PLAYLIST,
LANG_ID3_BITRATE,
LANG_ID3_FREQUENCY,
-#if CONFIG_CODEC == SWCODEC
LANG_ID3_TRACK_GAIN,
LANG_ID3_ALBUM_GAIN,
-#endif
LANG_FILESIZE,
LANG_ID3_PATH,
};
@@ -423,7 +420,6 @@ static void say_number_and_spell(char *buf, bool year_style)
}
}
-#if CONFIG_CODEC == SWCODEC
/* Say a replaygain ID3 value from its text form */
static void say_gain(char *buf)
{
@@ -479,7 +475,6 @@ static void say_gain(char *buf)
}else /* we didn't find a number, just spell everything */
talk_spell(buf, true);
}
-#endif
static const char * id3_get_or_speak_info(int selected_item, void* data,
char *buffer, size_t buffer_len,
@@ -619,7 +614,6 @@ static const char * id3_get_or_speak_info(int selected_item, void* data,
if(say_it)
talk_value(id3->frequency, UNIT_HERTZ, true);
break;
-#if CONFIG_CODEC == SWCODEC
case LANG_ID3_TRACK_GAIN:
replaygain_itoa(buffer, buffer_len, id3->track_level);
val=(id3->track_level) ? buffer : NULL; /* only show level!=0 */
@@ -632,12 +626,11 @@ static const char * id3_get_or_speak_info(int selected_item, void* data,
if(say_it && val)
say_gain(val);
break;
-#endif
case LANG_ID3_PATH:
val=id3->path;
if(say_it && val)
talk_fullpath(val, true);
- break;
+ break;
case LANG_ID3_COMPOSER:
val=id3->composer;
if(say_it && val)
diff --git a/apps/scrobbler.c b/apps/scrobbler.c
index 2793e70725..3622137a20 100644
--- a/apps/scrobbler.c
+++ b/apps/scrobbler.c
@@ -226,9 +226,7 @@ static void scrobbler_finish_event(unsigned short id, void *data)
/* add entry using the currently ending track */
if (pending && (te->flags & TEF_CURRENT)
-#if CONFIG_CODEC == SWCODEC
&& !(te->flags & TEF_REWIND)
-#endif
)
{
pending = false;
diff --git a/apps/settings.c b/apps/settings.c
index 185e2c3576..17e200812e 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -77,14 +77,12 @@
struct user_settings global_settings;
struct system_status global_status;
-#if CONFIG_CODEC == SWCODEC
#include "dsp_proc_settings.h"
#include "playback.h"
#ifdef HAVE_RECORDING
#include "enc_config.h"
#endif
#include "pcm_sampr.h"
-#endif /* CONFIG_CODEC == SWCODEC */
#define NVRAM_DATA_START 8
#ifdef HAVE_RTC_RAM
@@ -589,12 +587,10 @@ static bool settings_write_config(const char* filename, int options)
continue;
break;
#endif
-#if CONFIG_CODEC == SWCODEC
case SETTINGS_SAVE_EQPRESET:
if ((settings[i].flags&F_EQSETTING) == 0)
continue;
break;
-#endif
}
cfg_to_string(i, value, MAX_PATH);
@@ -675,12 +671,10 @@ bool settings_save_config(int options)
namebase = "recording";
break;
#endif
-#if CONFIG_CODEC == SWCODEC
case SETTINGS_SAVE_EQPRESET:
folder = EQS_DIR;
namebase = "eq";
break;
-#endif
case SETTINGS_SAVE_SOUND:
folder = ROCKBOX_DIR;
namebase = "sound";
@@ -982,7 +976,6 @@ void settings_apply(bool read_disk)
lcd_scroll_delay(global_settings.scroll_delay);
-#if CONFIG_CODEC == SWCODEC
#ifdef HAVE_PLAY_FREQ
/* before crossfade */
audio_set_playback_frequency(global_settings.play_frequency);
@@ -1016,7 +1009,6 @@ void settings_apply(bool read_disk)
dsp_timestretch_enable(global_settings.timestretch_enabled);
#endif
dsp_set_compressor(&global_settings.compressor_settings);
-#endif
#ifdef HAVE_SPDIF_POWER
spdif_power_enable(global_settings.spdif_enable);
@@ -1068,7 +1060,7 @@ void settings_apply(bool read_disk)
#endif
/* This should stay last */
-#if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC
+#if defined(HAVE_RECORDING)
enc_global_settings_apply();
#endif
#ifdef HAVE_LCD_BITMAP
@@ -1114,7 +1106,7 @@ void settings_reset(void)
{
for(int i=0; i<nb_settings; i++)
reset_setting(&settings[i], settings[i].setting);
-#if defined (HAVE_RECORDING) && CONFIG_CODEC == SWCODEC
+#if defined (HAVE_RECORDING)
enc_global_settings_reset();
#endif
#ifdef HAVE_LCD_BITMAP
diff --git a/apps/settings.h b/apps/settings.h
index 4661966ad2..3d3939695c 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -30,10 +30,8 @@
#include "statusbar.h" /* for the statusbar values */
#include "quickscreen.h"
#include "button.h"
-#if CONFIG_CODEC == SWCODEC
#include "audio.h"
#include "dsp_proc_settings.h"
-#endif
#include "rbpaths.h"
struct opt_items {
@@ -218,9 +216,7 @@ enum {
#ifdef HAVE_RECORDING
SETTINGS_SAVE_RECPRESETS,
#endif
-#if CONFIG_CODEC == SWCODEC
SETTINGS_SAVE_EQPRESET,
-#endif
};
bool settings_save_config(int options);
@@ -307,17 +303,6 @@ struct user_settings
int channel_config; /* Stereo, Mono, Custom, Mono left, Mono right, Karaoke */
int stereo_width; /* 0-255% */
-#if CONFIG_CODEC != SWCODEC
- int loudness; /* loudness eq: 0-100 0=off 100=max */
- int avc; /* auto volume correct: 0=off, 1=20ms, 2=2s 3=4s 4=8s */
- int mdb_strength; /* 0-127dB */
- int mdb_harmonics; /* 0-100% */
- int mdb_center; /* 20-300Hz */
- int mdb_shape; /* 50-300Hz */
- bool mdb_enable; /* true/false */
- bool superbass; /* true/false */
-#endif
-
#ifdef AUDIOHW_HAVE_BASS_CUTOFF
int bass_cutoff;
#endif
@@ -325,7 +310,6 @@ struct user_settings
int treble_cutoff;
#endif
-#if CONFIG_CODEC == SWCODEC
#ifdef HAVE_CROSSFADE
/* Crossfade */
int crossfade; /* Enable crossfade (0=off, 1=shuffle, 2=trackskip,
@@ -360,10 +344,8 @@ struct user_settings
#ifdef HAVE_PITCHCONTROL
bool timestretch_enabled;
#endif
-#endif /* CONFIG_CODEC == SWCODEC */
#ifdef HAVE_RECORDING
-#if CONFIG_CODEC == SWCODEC
int rec_format; /* record format index */
int rec_mono_mode; /* how to create mono: L, R, L+R */
@@ -377,9 +359,6 @@ struct user_settings
#endif
/* Encoder Settings End */
-#else
- int rec_quality; /* 0-7 */
-#endif /* CONFIG_CODEC == SWCODEC */
int rec_source; /* 0=mic, 1=line, 2=S/PDIF, 2 or 3=FM Radio */
int rec_frequency; /* 0 = 44.1kHz (depends on target)
1 = 48kHz
@@ -754,10 +733,8 @@ struct user_settings
#ifdef HAVE_PITCHCONTROL
/* pitch screen settings */
bool pitch_mode_semitone;
-#if CONFIG_CODEC == SWCODEC
bool pitch_mode_timestretch;
#endif
-#endif
/* If values are just added to the end, no need to bump plugin API
version. */
/* new stuff to be added at the end */
@@ -778,9 +755,7 @@ struct user_settings
#endif
#endif
-#if CONFIG_CODEC == SWCODEC
struct compressor_settings compressor_settings;
-#endif
int sleeptimer_duration; /* In minutes; 0=off */
bool sleeptimer_on_startup;
@@ -797,10 +772,8 @@ struct user_settings
int hotkey_tree;
#endif
-#if CONFIG_CODEC == SWCODEC
/* When resuming playback (after a stop), rewind this number of seconds */
int resume_rewind;
-#endif
#ifdef AUDIOHW_HAVE_DEPTH_3D
int depth_3d;
@@ -830,10 +803,8 @@ struct user_settings
#endif /* AUDIOHW_HAVE_EQ */
#ifdef HAVE_HARDWARE_CLICK
-#if CONFIG_CODEC == SWCODEC
bool keyclick_hardware; /* hardware piezo keyclick */
#endif
-#endif
char start_directory[MAX_PATHNAME+1];
/* Has the root been customized from the .cfg file? false = no, true = loaded from cfg */
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 348caec6e5..7f6f4fefc7 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -310,7 +310,6 @@ static const char graphic_numeric[] = "graphic,numeric";
#ifdef HAVE_RECORDING
/* these should be in the config.h files */
-#if CONFIG_CODEC == SWCODEC
# ifdef HAVE_UDA1380
# define DEFAULT_REC_MIC_GAIN 16
# define DEFAULT_REC_LEFT_GAIN 0
@@ -332,7 +331,6 @@ static const char graphic_numeric[] = "graphic,numeric";
# define DEFAULT_REC_LEFT_GAIN 0
# define DEFAULT_REC_RIGHT_GAIN 0
# endif
-#endif
#endif /* HAVE_RECORDING */
@@ -472,8 +470,6 @@ static const char* scanaccel_formatter(char *buffer, size_t buffer_size,
}
#endif
-#if CONFIG_CODEC == SWCODEC
-
static const char* formatter_unit_0_is_off(char *buffer, size_t buffer_size,
int val, const char *unit)
{
@@ -591,7 +587,6 @@ static void eq_set_default(void* setting, void* defaultval)
{
memcpy(setting, defaultval, sizeof(struct eq_band_setting));
}
-#endif
#ifdef HAVE_QUICKSCREEN
static int find_setting_by_name(char*name)
@@ -1213,15 +1208,11 @@ const struct settings_list settings[] = {
"seek acceleration", "very fast,fast,normal,slow,very slow", NULL, 5,
ID2P(LANG_VERY_FAST), ID2P(LANG_FAST), ID2P(LANG_NORMAL),
ID2P(LANG_SLOW) , ID2P(LANG_VERY_SLOW)),
-#if (CONFIG_CODEC == SWCODEC) && defined(HAVE_DISK_STORAGE)
+#if defined(HAVE_DISK_STORAGE)
TABLE_SETTING(F_TIME_SETTING | F_ALLOW_ARBITRARY_VALS, buffer_margin,
LANG_MP3BUFFER_MARGIN, 5, "antiskip", NULL, UNIT_SEC,
NULL, NULL,
NULL,8, 5,15,30,60,120,180,300,600),
-#elif defined(HAVE_DISK_STORAGE)
- INT_SETTING(F_TIME_SETTING, buffer_margin, LANG_MP3BUFFER_MARGIN, 0,
- "antiskip", UNIT_SEC, 0, 7, 1, formatter_time_unit_0_is_off,
- getlang_time_unit_0_is_off, audio_set_buffer_margin),
#endif
/* disk */
#ifdef HAVE_DISK_STORAGE
@@ -1348,10 +1339,8 @@ const struct settings_list settings[] = {
TALK_ID(1792, UNIT_MB)),
{F_T_INT|F_RECSETTING, &global_settings.rec_channels, LANG_CHANNELS, INT(0),
"rec channels","stereo,mono",UNUSED},
-#if CONFIG_CODEC == SWCODEC
{F_T_INT|F_RECSETTING, &global_settings.rec_mono_mode,
LANG_RECORDING_MONO_MODE, INT(0), "rec mono mode","L+R,L,R",UNUSED},
-#endif
CHOICE_SETTING(F_RECSETTING, rec_split_type, LANG_SPLIT_TYPE, 0,
"rec split type", "Split,Stop,Shutdown", NULL, 3,
ID2P(LANG_START_NEW_FILE), ID2P(LANG_STOP_RECORDING),ID2P(LANG_STOP_RECORDING_AND_SHUTDOWN)),
@@ -1398,7 +1387,6 @@ const struct settings_list settings[] = {
INT(DEFAULT_REC_RIGHT_GAIN),
"rec right gain",NULL,UNUSED},
#endif /* DEFAULT_REC_RIGHT_GAIN */
-#if CONFIG_CODEC == SWCODEC
{F_T_INT|F_RECSETTING,&global_settings.rec_frequency,
LANG_FREQUENCY,INT(REC_FREQ_DEFAULT),
"rec frequency",REC_FREQ_CFG_VAL_LIST,UNUSED},
@@ -1417,7 +1405,6 @@ const struct settings_list settings[] = {
/* wavpack_enc */
/* (no settings yet) */
/** Encoder settings end **/
-#endif /* CONFIG_CODEC == SWCODEC */
/* values for the trigger */
INT_SETTING(F_RECSETTING, rec_start_thres_db, LANG_RECORD_START_THRESHOLD, -35,
"trigger start threshold dB", UNIT_DB, -89, 0, 1, NULL, NULL, NULL),
@@ -1465,7 +1452,6 @@ const struct settings_list settings[] = {
LANG_SET_BOOL_YES, LANG_SET_BOOL_NO, NULL),
#ifdef HAVE_TAGCACHE
-#if CONFIG_CODEC == SWCODEC
BOOL_SETTING(0, autoresume_enable, LANG_AUTORESUME, false,
"autoresume enable", off_on,
LANG_SET_BOOL_YES, LANG_SET_BOOL_NO, NULL),
@@ -1478,7 +1464,6 @@ const struct settings_list settings[] = {
ID2P(LANG_AUTORESUME_CUSTOM)),
TEXT_SETTING(0, autoresume_paths, "autoresume next track paths",
"/podcast:/podcasts", NULL, NULL),
-#endif
OFFON_SETTING(0, runtimedb, LANG_RUNTIMEDB_ACTIVE, false,
"gather runtime data", NULL),
@@ -1486,7 +1471,6 @@ const struct settings_list settings[] = {
DEFAULT_TAGCACHE_SCAN_PATHS, NULL, NULL),
#endif
-#if CONFIG_CODEC == SWCODEC
/* replay gain */
CHOICE_SETTING(F_SOUNDSETTING, replaygain_settings.type,
LANG_REPLAYGAIN_MODE, REPLAYGAIN_SHUFFLE, "replaygain type",
@@ -1747,7 +1731,6 @@ const struct settings_list settings[] = {
LANG_COMPRESSOR_RELEASE, 500,
"compressor release time", UNIT_MS, 100, 1000,
100, NULL, NULL, compressor_set),
-#endif /* CONFIG_CODEC == SWCODEC */
#ifdef AUDIOHW_HAVE_BASS_CUTOFF
SOUND_SETTING(F_NO_WRAP, bass_cutoff, LANG_BASS_CUTOFF,
@@ -2023,7 +2006,6 @@ const struct settings_list settings[] = {
3, "list_accel_wait", UNIT_SEC, 1, 10, 1,
scanaccel_formatter, NULL, NULL),
#endif /* HAVE_WHEEL_ACCELERATION */
-#if CONFIG_CODEC == SWCODEC
/* keyclick */
#ifdef HAVE_HARDWARE_CLICK
CHOICE_SETTING(0, keyclick, LANG_KEYCLICK_SOFTWARE, 0,
@@ -2042,7 +2024,6 @@ const struct settings_list settings[] = {
OFFON_SETTING(0, keyclick_repeats, LANG_KEYCLICK_REPEATS, false,
"keyclick repeats", NULL),
#endif
-#endif /* CONFIG_CODEC == SWCODEC */
TEXT_SETTING(0, playlist_catalog_dir, "playlist catalog directory",
PLAYLIST_CATALOG_DEFAULT_DIR, NULL, NULL),
INT_SETTING(F_TIME_SETTING, sleeptimer_duration, LANG_SLEEP_TIMER_DURATION,
@@ -2117,11 +2098,9 @@ const struct settings_list settings[] = {
#ifdef HAVE_PITCHCONTROL
OFFON_SETTING(0, pitch_mode_semitone, LANG_SEMITONE, false,
"Semitone pitch change", NULL),
-#if CONFIG_CODEC == SWCODEC
OFFON_SETTING(0, pitch_mode_timestretch, LANG_TIMESTRETCH, false,
"Timestretch mode", NULL),
#endif
-#endif
#ifdef USB_ENABLE_HID
OFFON_SETTING(0, usb_hid, LANG_USB_HID, true, "usb hid", usb_set_hid),
@@ -2187,11 +2166,9 @@ const struct settings_list settings[] = {
HOTKEY_OPEN_WITH, HOTKEY_DELETE, HOTKEY_INSERT, HOTKEY_INSERT_SHUFFLED),
#endif
-#if CONFIG_CODEC == SWCODEC
INT_SETTING(F_TIME_SETTING, resume_rewind, LANG_RESUME_REWIND, 0,
"resume rewind", UNIT_SEC, 0, 60, 5,
formatter_time_unit_0_is_off, getlang_time_unit_0_is_off, NULL),
-#endif
CUSTOM_SETTING(0, root_menu_customized,
LANG_ROCKBOX_TITLE, /* lang string here is never actually used */
NULL, "root menu order",
diff --git a/apps/tagcache.c b/apps/tagcache.c
index 7265ce87b2..bff1550059 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -1779,7 +1779,6 @@ bool tagcache_fill_tags(struct mp3entry *id3, const char *filename)
if (id3->bitrate == 0)
id3->bitrate = 1;
-#if CONFIG_CODEC == SWCODEC
if (global_settings.autoresume_enable)
{
id3->elapsed = get_tag_numeric(entry, tag_lastelapsed, idx_id);
@@ -1790,8 +1789,7 @@ bool tagcache_fill_tags(struct mp3entry *id3, const char *filename)
logf("tagcache_fill_tags: Set offset for %s to %lX\n",
id3->title, id3->offset);
}
-#endif
-
+
return true;
}
#endif /* defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) */
diff --git a/apps/tagtree.c b/apps/tagtree.c
index 0625e860ab..f006baa581 100644
--- a/apps/tagtree.c
+++ b/apps/tagtree.c
@@ -879,7 +879,6 @@ static void tagtree_buffer_event(unsigned short id, void *ev_data)
logf("-> %ld/%ld", id3->playcount, id3->playtime);
}
- #if CONFIG_CODEC == SWCODEC
if (autoresume)
{
/* Load current file resume info if not already defined (by
@@ -900,7 +899,6 @@ static void tagtree_buffer_event(unsigned short id, void *ev_data)
str_or_empty(id3->title), id3->offset);
}
}
- #endif
/* Store our tagcache index pointer. */
id3->tagcache_idx = tcs.idx_id+1;
@@ -922,25 +920,20 @@ static void tagtree_track_finish_event(unsigned short id, void *ev_data)
}
tagcache_idx--;
-#if CONFIG_CODEC == SWCODEC /* HWCODEC doesn't have automatic_skip */
bool auto_skip = te->flags & TEF_AUTO_SKIP;
-#endif
bool runtimedb = global_settings.runtimedb;
bool autoresume = global_settings.autoresume_enable;
/* Don't process unplayed tracks, or tracks interrupted within the
first 15 seconds but always process autoresume point */
if (runtimedb && (id3->elapsed == 0
-#if CONFIG_CODEC == SWCODEC
|| (id3->elapsed < 15 * 1000 && !auto_skip)
-#endif
))
{
logf("not db logging unplayed or skipped track");
runtimedb = false;
}
-#if CONFIG_CODEC == SWCODEC
/* 3s because that is the threshold the WPS uses to rewind instead
of skip backwards */
if (autoresume && (id3->elapsed == 0
@@ -949,7 +942,6 @@ static void tagtree_track_finish_event(unsigned short id, void *ev_data)
logf("not logging autoresume");
autoresume = false;
}
-#endif
/* Do not gather data unless proper setting has been enabled and at least
one is still slated to be recorded */
@@ -987,7 +979,6 @@ static void tagtree_track_finish_event(unsigned short id, void *ev_data)
tagcache_update_numeric(tagcache_idx, tag_lastplayed, lastplayed);
}
-#if CONFIG_CODEC == SWCODEC
if (autoresume)
{
unsigned long elapsed = auto_skip ? 0 : id3->elapsed;
@@ -998,7 +989,6 @@ static void tagtree_track_finish_event(unsigned short id, void *ev_data)
logf("tagtree_track_finish_event: Save resume for %s: %lX %lX",
str_or_empty(id3->title), elapsed, offset);
}
-#endif
}
int tagtree_export(void)
diff --git a/apps/talk.c b/apps/talk.c
index 3aedaf34ec..4b65700a5d 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -32,11 +32,7 @@
#include "settings.h"
#include "settings_list.h"
#include "splash.h"
-#if CONFIG_CODEC == SWCODEC
#include "voice_thread.h"
-#else
-#include "mp3_playback.h"
-#endif
#include "audio.h"
#include "lang.h"
#include "talk.h"
@@ -107,7 +103,7 @@ struct voicefile_header /* file format of our voice file */
/***************** Globals *****************/
-#if (CONFIG_CODEC == SWCODEC && MEMORYSIZE <= 2)
+#if MEMORYSIZE <= 2
/* On low memory swcodec targets the entire voice file wouldn't fit in memory
* together with codecs, so we load clips each time they are accessed. */
#define TALK_PROGRESSIVE_LOAD
@@ -131,15 +127,10 @@ static bool force_enqueue_next; /* enqueue next utterance even if enqueue is fal
static int queue_write; /* write index of queue, by application */
static int queue_read; /* read index of queue, by ISR context */
static enum talk_status talk_status = TALK_STATUS_OK;
-#if CONFIG_CODEC == SWCODEC
/* protects queue_read, queue_write and thumbnail_buf_used */
static struct mutex queue_mutex SHAREDBSS_ATTR;
#define talk_queue_lock() ({ mutex_lock(&queue_mutex); })
#define talk_queue_unlock() ({ mutex_unlock(&queue_mutex); })
-#else
-#define talk_queue_lock() ({ })
-#define talk_queue_unlock() ({ })
-#endif /* CONFIG_CODEC */
static int sent; /* how many bytes handed over to playback, owned by ISR */
static unsigned char curr_hd[3]; /* current frame header, for re-sync */
static unsigned char last_lang[MAX_FILENAME+1]; /* name of last used lang file (in talk_init) */
@@ -186,16 +177,8 @@ static int move_callback(int handle, void *current, void *new)
static struct mutex read_buffer_mutex;
-
-/* on HWCODEC only voice xor audio can be active at a time */
-static bool check_audio_status(void)
+static inline bool check_audio_status(void)
{
-#if CONFIG_CODEC != SWCODEC
- if (audio_status()) /* busy, buffer in use */
- return false;
- /* ensure playback is given up on the buffer */
- audio_hard_stop();
-#endif
return true;
}
@@ -670,20 +653,16 @@ static bool load_voicefile_data(int fd)
return true;
}
-/* Use a static buffer to avoid difficulties with buflib during DMA
- * (hwcodec)/buffer passing to the voice_thread (swcodec). Clips
- * can be played in chunks so the size is not that important */
+/* Use a static buffer to avoid difficulties with buflib during
+ * buffer passing to the voice_thread (swcodec). Clips can be played
+ in chunks so the size is not that important */
static unsigned char commit_buffer[2<<10];
static void* commit_transfer(struct queue_entry *qe, size_t *size)
{
void *buf = NULL; /* shut up gcc */
static unsigned char *bufpos = commit_buffer;
-#if CONFIG_CODEC != SWCODEC
- sent = MIN(qe->remaining, 0xFFFF);
-#else
sent = qe->remaining;
-#endif
sent = MIN((size_t)sent, sizeof(commit_buffer));
buf = buflib_get_data(&clip_ctx, qe->handle);
/* adjust buffer position to what has been played already */
@@ -706,13 +685,11 @@ static inline bool is_silence(struct queue_entry *qe)
static void mp3_callback(const void** start, size_t* size)
{
struct queue_entry *qe = &queue[queue_read];
-#if CONFIG_CODEC == SWCODEC
/* voice_thread.c hints us how many of the buffer we provided it actually
* consumed. Because buffers have to be frame-aligned for speex
* it might be less than what we presented */
if (*size)
sent = *size;
-#endif
qe->remaining -= sent; /* we completed this */
if (qe->remaining > 0) /* current clip not finished? */
@@ -757,55 +734,7 @@ static void mp3_callback(const void** start, size_t* size)
/* stop the playback and the pending clips */
void talk_force_shutup(void)
{
- /* Most of this is MAS only */
-#if CONFIG_CODEC != SWCODEC
-#ifdef SIMULATOR
- return;
-#endif
- unsigned char* pos;
- unsigned char* search;
- unsigned char* end;
- int len;
- if (QUEUE_LEVEL == 0) /* has ended anyway */
- return;
-
- /* search next frame boundary and continue up to there */
- pos = search = mp3_get_pos();
- end = buflib_get_data(&clip_ctx, queue[queue_read].handle);
- len = queue[queue_read].length;
-
- if (pos >= end && pos <= (end+len)) /* really our clip? */
- { /* (for strange reasons this isn't nesessarily the case) */
- /* find the next frame boundary */
- while (search < (end+len)) /* search the remaining data */
- {
- if (*search++ != 0xFF) /* quick search for frame sync byte */
- continue; /* (this does the majority of the job) */
-
- /* look at the (bitswapped) rest of header candidate */
- if (search[0] == curr_hd[0] /* do the quicker checks first */
- && search[2] == curr_hd[2]
- && (search[1] & 0x30) == (curr_hd[1] & 0x30)) /* sample rate */
- {
- search--; /* back to the sync byte */
- break; /* From looking at it, this is our header. */
- }
- }
-
- if (search-pos)
- { /* play old data until the frame end, to keep the MAS in sync */
- sent = search-pos;
-
- queue_write = (queue_read + 1) & QUEUE_MASK; /* will be empty after next callback */
- queue[queue_read].length = sent; /* current one ends after this */
-
- thumbnail_buf_used = 0;
- return;
- }
- }
-#endif /* CONFIG_CODEC != SWCODEC */
-
- /* Either SWCODEC, or MAS had nothing to do (was frame boundary or not our clip) */
+ /* Had nothing to do (was frame boundary or not our clip) */
mp3_play_stop();
talk_queue_lock();
queue_write = queue_read = 0; /* reset the queue */
@@ -885,9 +814,7 @@ void talk_init(void)
if(!talk_initialized)
{
-#if CONFIG_CODEC == SWCODEC
mutex_init(&queue_mutex);
-#endif /* CONFIG_CODEC == SWCODEC */
mutex_init(&read_buffer_mutex);
}
@@ -957,11 +884,9 @@ void talk_init(void)
load_voicefile_data(filehandle);
-#if CONFIG_CODEC == SWCODEC
/* Initialize the actual voice clip playback engine as well */
if (talk_voice_required())
voice_thread_init();
-#endif
out:
close(filehandle); /* close again, this was just to detect presence */
@@ -1062,9 +987,6 @@ static int _talk_file(const char* filename,
int fd;
int size;
int handle, oldest = -1;
-#if CONFIG_CODEC != SWCODEC
- struct mp3entry info;
-#endif
/* reload needed? */
if (talk_temp_disable_count > 0)
@@ -1080,13 +1002,6 @@ static int _talk_file(const char* filename,
close(fd);
}
-#if CONFIG_CODEC != SWCODEC
- if(mp3info(&info, filename)) /* use this to find real start */
- {
- return 0; /* failed to open, or invalid */
- }
-#endif
-
if (!enqueue)
/* shutup now to free the thumbnail buffer */
talk_shutup();
@@ -1098,10 +1013,6 @@ static int _talk_file(const char* filename,
}
size = filesize(fd);
-#if CONFIG_CODEC != SWCODEC
- size -= lseek(fd, info.first_frame_offset, SEEK_SET); /* behind ID data */
-#endif
-
/* free clips from cache until this one succeeds to allocate */
while ((handle = buflib_alloc(&clip_ctx, size)) < 0)
oldest = free_oldest_clip();
@@ -1116,10 +1027,6 @@ static int _talk_file(const char* filename,
struct queue_entry clip;
clip.handle = handle;
clip.length = clip.remaining = size;
-#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR)
- /* bitswap doesnt yield() */
- bitswap(buflib_get_data(&clip_ctx, handle), size);
-#endif
if(prefix_ids)
/* prefix thumbnail by speaking these ids, but only now
that we know there's actually a thumbnail to be
diff --git a/apps/tree.c b/apps/tree.c
index fb0d0a3ac5..e159c3465f 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -650,9 +650,7 @@ static int dirbrowse(void)
if (tc.dirlevel < 0)
tc.dirlevel = 0; /* shouldnt be needed.. this code needs work! */
-#if CONFIG_CODEC == SWCODEC
keyclick_set_callback(gui_synclist_keyclick_callback, &tree_lists);
-#endif
button = get_action(CONTEXT_TREE,
list_do_action_timeout(&tree_lists, HZ/2));
#ifdef HAVE_LCD_BITMAP
@@ -1175,11 +1173,6 @@ static void say_filetype(int attr)
static int ft_play_dirname(char* name)
{
-#if CONFIG_CODEC != SWCODEC
- if (audio_status() & AUDIO_STATUS_PLAY)
- return 0;
-#endif
-
return talk_file(tc.currdir, name, dir_thumbnail_name, NULL,
global_settings.talk_filetype ?
TALK_IDARRAY(VOICE_DIR) : NULL,
@@ -1188,11 +1181,6 @@ static int ft_play_dirname(char* name)
static int ft_play_filename(char *dir, char *file, int attr)
{
-#if CONFIG_CODEC != SWCODEC
- if (audio_status() & AUDIO_STATUS_PLAY)
- return 0;
-#endif
-
if (strlen(file) >= strlen(file_thumbnail_ext)
&& strcasecmp(&file[strlen(file) - strlen(file_thumbnail_ext)],
file_thumbnail_ext))