summaryrefslogtreecommitdiff
path: root/apps/recorder
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-04-04 20:16:01 +0000
committerJens Arnold <amiconn@rockbox.org>2005-04-04 20:16:01 +0000
commitcf986e8d440015ca4d242e8e748576f779255d4a (patch)
treee26045b8adbd3d7dac09efa3073f04944b40f48a /apps/recorder
parente1f70587ce13100e8b1703c55fa497e55ee7a3d3 (diff)
downloadrockbox-cf986e8d440015ca4d242e8e748576f779255d4a.zip
rockbox-cf986e8d440015ca4d242e8e748576f779255d4a.tar.gz
rockbox-cf986e8d440015ca4d242e8e748576f779255d4a.tar.bz2
rockbox-cf986e8d440015ca4d242e8e748576f779255d4a.tar.xz
Triggered recording fixes: (1) Made it compile for Ondio FM recorder (no led, button assigment). (2) Disabled trigger settings and peakmeter trigger handling for devices without recording. Saves > 2 KB of code on Ondio SP. (3) Const policed, saves some more code size. (4) Some code cleanup.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6248 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/recorder')
-rw-r--r--apps/recorder/peakmeter.c28
-rw-r--r--apps/recorder/recording.c4
2 files changed, 13 insertions, 19 deletions
diff --git a/apps/recorder/peakmeter.c b/apps/recorder/peakmeter.c
index 0481e25..8bb771e 100644
--- a/apps/recorder/peakmeter.c
+++ b/apps/recorder/peakmeter.c
@@ -68,6 +68,7 @@ static unsigned short db_min = 0;
static unsigned short db_max = 9000;
static unsigned short db_range = 9000;
+#ifdef HAVE_RECORDING
static unsigned short trig_strt_threshold;
static long trig_strt_duration;
static long trig_strt_dropout;
@@ -81,10 +82,11 @@ static long trig_hightime;
/* point in time when the volume fell below the threshold*/
static long trig_lowtime;
-/* The output value of the trigger. See TRIG_XXX constants vor valid values */
+/* The output value of the trigger. See TRIG_XXX constants for valid values */
static int trig_status = TRIG_OFF;
static void (*trigger_listener)(int) = NULL;
+#endif
#if CONFIG_HWCODEC == MASNONE
#define MAS_REG_DQPEAK_L 0
@@ -176,21 +178,6 @@ static const int db_scale_src_values[DB_SCALE_SRC_VALUES_SIZE] = {
};
#endif
-const char* peak_meter_dbnames[DB_SCALE_SRC_VALUES_SIZE] = {
- "0 db",
- "-3 db",
- "-6 db",
- "-9 db",
- "-12 db",
- "-18 db",
- "-24 db",
- "-30 db",
- "-40 db",
- "-50 db",
- "-60 db",
- "-inf",
-};
-
static int db_scale_count = DB_SCALE_SRC_VALUES_SIZE;
/* if db_scale_valid is false the content of
@@ -540,6 +527,7 @@ void peak_meter_playback(bool playback)
#endif
}
+#ifdef HAVE_RECORDING
static void set_trig_status(int new_state) {
if (trig_status != new_state) {
trig_status = new_state;
@@ -548,6 +536,7 @@ static void set_trig_status(int new_state) {
}
}
}
+#endif
/**
* Reads peak values from the MAS, and detects clips. The
@@ -591,6 +580,7 @@ inline void peak_meter_peek(void)
current_tick + clip_time_out[peak_meter_clip_hold];
}
+#ifdef HAVE_RECORDING
switch (trig_status) {
case TRIG_READY:
/* no more changes, if trigger was activated as release trigger */
@@ -705,6 +695,7 @@ inline void peak_meter_peek(void)
}
break;
}
+#endif
/* peaks are searched -> we have to find the maximum. When
many calls of peak_meter_peek the maximum value will be
@@ -971,6 +962,7 @@ void peak_meter_draw(int x, int y, int width, int height) {
lcd_invertpixel(db_scale_lcd_coord[i], y + height / 2 - 1);
}
+#ifdef HAVE_RECORDING
if (trig_status != TRIG_OFF) {
int start_trigx, stop_trigx, ycenter;
@@ -984,8 +976,8 @@ void peak_meter_draw(int x, int y, int width, int height) {
stop_trigx = x + peak_meter_scale_value(trig_stp_threshold,meterwidth);
lcd_drawline(stop_trigx, ycenter - 2, stop_trigx, ycenter);
if (stop_trigx > 0) lcd_drawpixel(stop_trigx - 1, ycenter - 1);
-
}
+#endif
#ifdef PM_DEBUG
/* display a bar to show how many calls to peak_meter_peek
@@ -1011,6 +1003,7 @@ void peak_meter_draw(int x, int y, int width, int height) {
last_right = right;
}
+#ifdef HAVE_RECORDING
/**
* Defines the parameters of the trigger. After these parameters are defined
* the trigger can be started either by peak_meter_attack_trigger or by
@@ -1142,6 +1135,7 @@ void peak_meter_draw_trig(int xpos, int ypos) {
}
}
+#endif
int peak_meter_draw_get_btn(int x, int y, int width, int height)
{
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index 9ef6d4a..6885963 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -318,7 +318,7 @@ bool recording_screen(void)
};
cursor = 0;
-#ifndef SIMULATOR
+#if defined(HAVE_LED) && !defined(SIMULATOR)
ata_set_led_enabled(false);
#endif
mpeg_init_recording();
@@ -859,7 +859,7 @@ bool recording_screen(void)
if (have_recorded)
reload_directory();
-#ifndef SIMULATOR
+#if defined(HAVE_LED) && !defined(SIMULATOR)
ata_set_led_enabled(true);
#endif
return been_in_usb_mode;