summaryrefslogtreecommitdiffstats
path: root/apps/recorder
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/recorder
parent0c4f89370d05056faa789aa9cabcccc4e509fb9f (diff)
downloadrockbox-8cb555460ff79e636a7907fb2589e16db98c8600.tar.gz
rockbox-8cb555460ff79e636a7907fb2589e16db98c8600.tar.bz2
rockbox-8cb555460ff79e636a7907fb2589e16db98c8600.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/recorder')
-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
6 files changed, 11 insertions, 164 deletions
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