~audio-recorder/audio-recorder/trunk

« back to all changes in this revision

Viewing changes to src/timer.h

  • Committer: Osmo Antero
  • Date: 2012-09-29 18:12:44 UTC
  • Revision ID: osmoma@gmail.com-20120929181244-gmrxd5xww9pua60a
Support new systems; Ubuntu 12.10, Fedora 18. Improved timer and VAD-modules. Better gst-pipeline.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
#include <glib.h>
5
5
#include <gdk/gdk.h>
6
6
#include "log.h"
7
 
 
 
7
#include <gst/gst.h>
8
8
 
9
9
// Uncomment this to show debug messages from timer.c and timer-parser.c
10
 
// #define DEBUG_TIMER
 
10
//#define DEBUG_TIMER
11
11
 
12
12
#if defined(DEBUG_TIMER) || defined(DEBUG_ALL)
13
13
#define LOG_TIMER LOG_MSG
26
26
void timer_func_start();
27
27
void timer_func_stop();
28
28
 
 
29
void timer_evaluate_triggers(GstClockTimeDiff time_diff, gdouble rms);
 
30
 
29
31
void timer_module_reset(gint for_state);
30
32
 
31
33
typedef struct {
32
34
    gchar action;      // recording action: 'S' = start, 'T' = stop, 'P' = pause
33
35
    gchar action_prep; // action preposition: 'a' = after
34
36
    gchar data_type;   // data type: 't' = time data, 'f' = file size, 'l' = label
35
 
    double val[3];     // data: hh, mm, ss | file size | silence/voice/audio/sound duration
 
37
    gdouble val[3];     // data: hh, mm, ss | file size | silence/voice/audio/sound duration
36
38
    gchar label[12];   // textual action: "silence" | ("sound" | "voice" | "audio") | ("bytes" | "kb" | "mb" | "gb" | "tb")
37
39
 
38
 
    gchar level_unit[10]; // level unit: "dB" (decibel) | "%"
39
 
    double level;         // level value in dB or %
40
 
 
41
 
    gint day_of_year; // Internal flag. Used to check if the clock has gone around to next day.
42
 
    gint64 seconds;   // Internal value. Count seconds for this command.
43
 
 
44
 
    gint64 seconds_x; // Internal value. Count seconds to resume recording after "silence" command.
45
 
    // Or count seconds to pause recording if started with "sound", "voice" or "audio" commands.
46
 
 
47
 
    gboolean done;    // Internal value. TRUE when this timer command has been executed.
 
40
    gchar threshold_unit[10]; // level/threshold unit: "dB" (decibel) | "%" or empty
 
41
    gdouble threshold;      // level/threshold value in dB, % or plain value [0 - 1.0]
 
42
 
 
43
    gint day_of_year; // Internal flag. Used to check if the clock has gone around to next day
 
44
 
 
45
    gdouble norm_secs; // = tr->val[0]*3600 + tr->val[1]*60 + tr->val[2] seconds
 
46
    gdouble norm_threshold; // = threshold converted to [0 - 1.0] from threshold_unit
 
47
 
 
48
    gdouble time_above; // Internal value. Count seconds when above threshold limit
 
49
    gdouble time_below; // Internal value. Count seconds when under threshold limit
 
50
 
 
51
    gboolean done;    // Internal value. TRUE when timer command has been executed
48
52
} TimerRec;
49
53
 
50
54
GList *parser_parse_actions(gchar *txt);
55
59
 
56
60
void timer_settings_changed();
57
61
 
 
62
const gchar *parser_get_action_name(gchar action);
 
63
 
58
64
#endif
59
65