Linus Nielsen Feltzing | f117029 | 2002-09-27 09:44:51 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
| 10 | * Copyright (C) 2002 by Philipp Pertermann |
| 11 | * |
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame] | 12 | * This program is free software; you can redistribute it and/or |
| 13 | * modify it under the terms of the GNU General Public License |
| 14 | * as published by the Free Software Foundation; either version 2 |
| 15 | * of the License, or (at your option) any later version. |
Linus Nielsen Feltzing | f117029 | 2002-09-27 09:44:51 +0000 | [diff] [blame] | 16 | * |
| 17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 18 | * KIND, either express or implied. |
| 19 | * |
| 20 | ****************************************************************************/ |
| 21 | #ifndef __PEAKMETER_H__ |
| 22 | #define __PEAKMETER_H__ |
| 23 | |
Jens Arnold | 99a0598 | 2005-08-29 20:07:17 +0000 | [diff] [blame] | 24 | #define PEAK_METER_FPS 20 |
Marcin Bukat | 56c4e9f | 2010-10-31 21:09:34 +0000 | [diff] [blame] | 25 | #define MAX_PEAK 0x8000 |
Jens Arnold | 99a0598 | 2005-08-29 20:07:17 +0000 | [diff] [blame] | 26 | |
Linus Nielsen Feltzing | fd0cc3b | 2002-10-29 12:09:15 +0000 | [diff] [blame] | 27 | /*#define PM_DEBUG */ |
| 28 | #ifdef PM_DEBUG |
Linus Nielsen Feltzing | a02ffd5 | 2002-10-30 23:01:27 +0000 | [diff] [blame] | 29 | extern bool peak_meter_histogram(void); |
Linus Nielsen Feltzing | fd0cc3b | 2002-10-29 12:09:15 +0000 | [diff] [blame] | 30 | #endif |
Linus Nielsen Feltzing | f117029 | 2002-09-27 09:44:51 +0000 | [diff] [blame] | 31 | |
Peter D'Hoye | 583f186 | 2007-08-25 15:53:54 +0000 | [diff] [blame] | 32 | extern int pm_get_clipcount(void); |
| 33 | extern void pm_reset_clipcount(void); |
| 34 | extern void pm_activate_clipcount(bool active); |
| 35 | |
Jonathan Gordon | 38ef849 | 2010-05-09 13:01:59 +0000 | [diff] [blame] | 36 | extern void peak_meter_enable(bool enable); |
Jonathan Gordon | 261c56b | 2011-01-13 06:48:39 +0000 | [diff] [blame] | 37 | /* sets *left and *right to the current *unscaled* values */ |
| 38 | extern void peak_meter_current_vals(int *left, int *right); |
Linus Nielsen Feltzing | fd0cc3b | 2002-10-29 12:09:15 +0000 | [diff] [blame] | 39 | |
Linus Nielsen Feltzing | f117029 | 2002-09-27 09:44:51 +0000 | [diff] [blame] | 40 | extern void peak_meter_playback(bool playback); |
Peter D'Hoye | 496e1f7 | 2008-08-06 20:12:44 +0000 | [diff] [blame] | 41 | extern int peak_meter_draw_get_btn(int action_context, int x[], int y[], |
Jonathan Gordon | 701a593 | 2009-02-02 03:14:51 +0000 | [diff] [blame] | 42 | int height[], int nb_screens, |
| 43 | struct viewport vps[]); |
Linus Nielsen Feltzing | f117029 | 2002-09-27 09:44:51 +0000 | [diff] [blame] | 44 | extern void peak_meter_set_clip_hold(int time); |
Linus Nielsen Feltzing | 69befb5 | 2002-09-27 12:16:48 +0000 | [diff] [blame] | 45 | extern void peak_meter_peek(void); |
Linus Nielsen Feltzing | fd0cc3b | 2002-10-29 12:09:15 +0000 | [diff] [blame] | 46 | extern void peak_meter_init_range( bool dbfs, int range_min, int range_max); |
William Wilgus | a06d9c8 | 2018-12-17 22:27:55 -0600 | [diff] [blame] | 47 | extern void peak_meter_init_times(int release, int hold_ms, int clip_hold_sec); |
Peter D'Hoye | 5fc66e5 | 2006-08-16 23:26:55 +0000 | [diff] [blame] | 48 | #ifdef HAVE_AGC |
| 49 | extern void peak_meter_get_peakhold(int *peak_left, int *peak_right); |
| 50 | #endif |
Linus Nielsen Feltzing | fd0cc3b | 2002-10-29 12:09:15 +0000 | [diff] [blame] | 51 | extern int peak_meter_get_min(void); |
Linus Nielsen Feltzing | fd0cc3b | 2002-10-29 12:09:15 +0000 | [diff] [blame] | 52 | extern int peak_meter_get_max(void); |
Jens Arnold | 99a0598 | 2005-08-29 20:07:17 +0000 | [diff] [blame] | 53 | extern void peak_meter_set_use_dbfs(bool use); |
| 54 | extern bool peak_meter_get_use_dbfs(void); |
Linus Nielsen Feltzing | 68482bb | 2005-04-04 09:12:12 +0000 | [diff] [blame] | 55 | extern int peak_meter_db2sample(int db); |
Linus Nielsen Feltzing | fd0cc3b | 2002-10-29 12:09:15 +0000 | [diff] [blame] | 56 | extern unsigned short peak_meter_scale_value(unsigned short val, int meterwidth); |
| 57 | |
Peter D'Hoye | 82f4c60 | 2011-06-05 12:36:27 +0000 | [diff] [blame] | 58 | #ifdef HAVE_HISTOGRAM |
| 59 | extern void histogram_init(void); |
| 60 | extern void histogram_draw(int x1, int x2, int y1, int y2, int width, int height); |
| 61 | #endif |
| 62 | |
Linus Nielsen Feltzing | 68482bb | 2005-04-04 09:12:12 +0000 | [diff] [blame] | 63 | /* valid values for trigger_status */ |
| 64 | #define TRIG_OFF 0x00 |
| 65 | #define TRIG_READY 0x01 |
| 66 | #define TRIG_STEADY 0x02 |
| 67 | #define TRIG_GO 0x03 |
| 68 | #define TRIG_POSTREC 0x04 |
| 69 | #define TRIG_RETRIG 0x05 |
| 70 | #define TRIG_CONTINUE 0x06 |
| 71 | |
| 72 | extern void peak_meter_define_trigger( |
| 73 | int start_threshold, |
| 74 | long start_duration, |
| 75 | long start_dropout, |
| 76 | int stop_threshold, |
| 77 | long stop_hold_time, |
| 78 | long restart_gap |
| 79 | ); |
| 80 | |
| 81 | extern void peak_meter_trigger(bool on); |
| 82 | extern int peak_meter_trigger_status(void); |
| 83 | extern void peak_meter_set_trigger_listener(void (*listener)(int status)); |
| 84 | |
Linus Nielsen Feltzing | 68482bb | 2005-04-04 09:12:12 +0000 | [diff] [blame] | 85 | #define TRIG_HEIGHT 8 |
Linus Nielsen Feltzing | 68482bb | 2005-04-04 09:12:12 +0000 | [diff] [blame] | 86 | |
Martin Scarratt | d8103f3 | 2006-11-09 12:27:56 +0000 | [diff] [blame] | 87 | extern void peak_meter_draw_trig(int x[], int y[], int trig_width[], |
| 88 | int nb_screens); |
Linus Nielsen Feltzing | 68482bb | 2005-04-04 09:12:12 +0000 | [diff] [blame] | 89 | |
Dan Everton | b66477a | 2006-03-25 13:35:31 +0000 | [diff] [blame] | 90 | #define DB_SCALE_SRC_VALUES_SIZE 12 |
| 91 | struct meter_scales{ |
| 92 | /* buffered peak values */ |
| 93 | int pm_peak_left; |
| 94 | int pm_peak_right; |
| 95 | /* if db_scale_valid is false the content of |
| 96 | db_scale_lcd_coord needs recalculation */ |
| 97 | bool db_scale_valid; |
| 98 | /* contains the lcd x coordinates of the magical |
| 99 | scale values in db_scale_src_values */ |
| 100 | int db_scale_lcd_coord[DB_SCALE_SRC_VALUES_SIZE]; |
| 101 | int last_left; |
| 102 | int last_right; |
| 103 | /* peak hold timeouts */ |
| 104 | long pm_peak_timeout_l; |
| 105 | long pm_peak_timeout_r; |
| 106 | }; |
Nils Wallménius | c70d946 | 2007-09-20 16:44:28 +0000 | [diff] [blame] | 107 | |
Dan Everton | b66477a | 2006-03-25 13:35:31 +0000 | [diff] [blame] | 108 | extern void peak_meter_screen(struct screen *display, int x, int y, int height); |
Linus Nielsen Feltzing | f117029 | 2002-09-27 09:44:51 +0000 | [diff] [blame] | 109 | #endif /* __PEAKMETER_H__ */ |
Peter D'Hoye | 82f4c60 | 2011-06-05 12:36:27 +0000 | [diff] [blame] | 110 | |