blob: 7fbb14973a7c2cbe378d7d1efca0bb11d169c1da [file] [log] [blame]
Linus Nielsen Feltzingf1170292002-09-27 09:44:51 +00001/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Philipp Pertermann
11 *
Daniel Stenberg2acc0ac2008-06-28 18:10:04 +000012 * 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 Feltzingf1170292002-09-27 09:44:51 +000016 *
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 Arnold99a05982005-08-29 20:07:17 +000024#define PEAK_METER_FPS 20
25
Linus Nielsen Feltzingfd0cc3b2002-10-29 12:09:15 +000026/*#define PM_DEBUG */
27#ifdef PM_DEBUG
Linus Nielsen Feltzinga02ffd52002-10-30 23:01:27 +000028extern bool peak_meter_histogram(void);
Linus Nielsen Feltzingfd0cc3b2002-10-29 12:09:15 +000029#endif
Linus Nielsen Feltzingf1170292002-09-27 09:44:51 +000030
Peter D'Hoye583f1862007-08-25 15:53:54 +000031extern int pm_get_clipcount(void);
32extern void pm_reset_clipcount(void);
33extern void pm_activate_clipcount(bool active);
34
Linus Nielsen Feltzingfd0cc3b2002-10-29 12:09:15 +000035extern bool peak_meter_enabled;
Linus Nielsen Feltzingfd0cc3b2002-10-29 12:09:15 +000036
Linus Nielsen Feltzingf1170292002-09-27 09:44:51 +000037extern void peak_meter_playback(bool playback);
Jonathan Gordonff469ab2008-05-28 10:55:39 +000038extern int peak_meter_draw_get_btn(int action_context, int x, int y[],
39 int height, int nb_screens);
Linus Nielsen Feltzingf1170292002-09-27 09:44:51 +000040extern void peak_meter_set_clip_hold(int time);
Linus Nielsen Feltzing69befb52002-09-27 12:16:48 +000041extern void peak_meter_peek(void);
Linus Nielsen Feltzingfd0cc3b2002-10-29 12:09:15 +000042extern void peak_meter_init_range( bool dbfs, int range_min, int range_max);
43extern void peak_meter_init_times(int release, int hold, int clip_hold);
Peter D'Hoye5fc66e52006-08-16 23:26:55 +000044#ifdef HAVE_AGC
45extern void peak_meter_get_peakhold(int *peak_left, int *peak_right);
46#endif
Linus Nielsen Feltzingfd0cc3b2002-10-29 12:09:15 +000047extern int peak_meter_get_min(void);
Linus Nielsen Feltzingfd0cc3b2002-10-29 12:09:15 +000048extern int peak_meter_get_max(void);
Jens Arnold99a05982005-08-29 20:07:17 +000049extern void peak_meter_set_use_dbfs(bool use);
50extern bool peak_meter_get_use_dbfs(void);
Linus Nielsen Feltzingfd0cc3b2002-10-29 12:09:15 +000051extern int calc_db (int isample);
Linus Nielsen Feltzing68482bb2005-04-04 09:12:12 +000052extern int peak_meter_db2sample(int db);
Linus Nielsen Feltzingfd0cc3b2002-10-29 12:09:15 +000053extern unsigned short peak_meter_scale_value(unsigned short val, int meterwidth);
54
Linus Nielsen Feltzing68482bb2005-04-04 09:12:12 +000055/* valid values for trigger_status */
56#define TRIG_OFF 0x00
57#define TRIG_READY 0x01
58#define TRIG_STEADY 0x02
59#define TRIG_GO 0x03
60#define TRIG_POSTREC 0x04
61#define TRIG_RETRIG 0x05
62#define TRIG_CONTINUE 0x06
63
64extern void peak_meter_define_trigger(
65 int start_threshold,
66 long start_duration,
67 long start_dropout,
68 int stop_threshold,
69 long stop_hold_time,
70 long restart_gap
71 );
72
73extern void peak_meter_trigger(bool on);
74extern int peak_meter_trigger_status(void);
75extern void peak_meter_set_trigger_listener(void (*listener)(int status));
76
Linus Nielsen Feltzing68482bb2005-04-04 09:12:12 +000077#define TRIG_HEIGHT 8
Linus Nielsen Feltzing68482bb2005-04-04 09:12:12 +000078
Martin Scarrattd8103f32006-11-09 12:27:56 +000079extern void peak_meter_draw_trig(int x[], int y[], int trig_width[],
80 int nb_screens);
Linus Nielsen Feltzing68482bb2005-04-04 09:12:12 +000081
Dan Evertonb66477a2006-03-25 13:35:31 +000082#define DB_SCALE_SRC_VALUES_SIZE 12
83struct meter_scales{
84 /* buffered peak values */
85 int pm_peak_left;
86 int pm_peak_right;
87 /* if db_scale_valid is false the content of
88 db_scale_lcd_coord needs recalculation */
89 bool db_scale_valid;
90 /* contains the lcd x coordinates of the magical
91 scale values in db_scale_src_values */
92 int db_scale_lcd_coord[DB_SCALE_SRC_VALUES_SIZE];
93 int last_left;
94 int last_right;
95 /* peak hold timeouts */
96 long pm_peak_timeout_l;
97 long pm_peak_timeout_r;
98};
Nils Wallméniusc70d9462007-09-20 16:44:28 +000099
Dan Evertonb66477a2006-03-25 13:35:31 +0000100extern void peak_meter_screen(struct screen *display, int x, int y, int height);
Linus Nielsen Feltzingf1170292002-09-27 09:44:51 +0000101#endif /* __PEAKMETER_H__ */