diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2020-07-17 00:01:32 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-07-24 21:20:13 +0000 |
commit | 8cb555460ff79e636a7907fb2589e16db98c8600 (patch) | |
tree | 930a3878c7641c9ce045b24f0ade1309e36d5806 /apps/recorder/peakmeter.c | |
parent | 0c4f89370d05056faa789aa9cabcccc4e509fb9f (diff) |
[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/peakmeter.c')
-rw-r--r-- | apps/recorder/peakmeter.c | 75 |
1 files changed, 6 insertions, 69 deletions
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)) { |