~audio-recorder/audio-recorder/trunk

1 by Osmo Antero Maatta
Initial import 17.jan.2011
1
#ifndef _TIMER_H_
2
#define _TIMER_H_
3
4
#include <glib.h>
5
#include <gdk/gdk.h>
6
#include "log.h"
173 by Osmo Antero
Support new systems; Ubuntu 12.10, Fedora 18. Improved timer and VAD-modules. Better gst-pipeline.
7
#include <gst/gst.h>
62 by Osmo Antero
The recorder now obeys commands from Banshee Player.
8
9
// Uncomment this to show debug messages from timer.c and timer-parser.c
173 by Osmo Antero
Support new systems; Ubuntu 12.10, Fedora 18. Improved timer and VAD-modules. Better gst-pipeline.
10
//#define DEBUG_TIMER
62 by Osmo Antero
The recorder now obeys commands from Banshee Player.
11
12
#if defined(DEBUG_TIMER) || defined(DEBUG_ALL)
13
#define LOG_TIMER LOG_MSG
14
#else
15
#define LOG_TIMER(x, ...)
16
#endif
17
1 by Osmo Antero Maatta
Initial import 17.jan.2011
18
void parser_module_init();
19
void parser_module_exit();
20
21
void timer_module_init();
22
void timer_module_exit();
23
49 by Osmo Antero Maatta
Employ listener (in gst-listener.c) ONLY when needed. Also listener process was created 2 times (was unstoppable)
24
void timer_set_debug_flag(gboolean on_off);
25
1 by Osmo Antero Maatta
Initial import 17.jan.2011
26
void timer_func_start();
27
void timer_func_stop();
28
173 by Osmo Antero
Support new systems; Ubuntu 12.10, Fedora 18. Improved timer and VAD-modules. Better gst-pipeline.
29
void timer_evaluate_triggers(GstClockTimeDiff time_diff, gdouble rms);
30
40 by Osmo Antero Maatta
Added ability to record from multiple devices. Major changes in all modules.
31
void timer_module_reset(gint for_state);
1 by Osmo Antero Maatta
Initial import 17.jan.2011
32
33
typedef struct {
34
    gchar action;      // recording action: 'S' = start, 'T' = stop, 'P' = pause
35
    gchar action_prep; // action preposition: 'a' = after
36
    gchar data_type;   // data type: 't' = time data, 'f' = file size, 'l' = label
173 by Osmo Antero
Support new systems; Ubuntu 12.10, Fedora 18. Improved timer and VAD-modules. Better gst-pipeline.
37
    gdouble val[3];     // data: hh, mm, ss | file size | silence/voice/audio/sound duration
1 by Osmo Antero Maatta
Initial import 17.jan.2011
38
    gchar label[12];   // textual action: "silence" | ("sound" | "voice" | "audio") | ("bytes" | "kb" | "mb" | "gb" | "tb")
39
173 by Osmo Antero
Support new systems; Ubuntu 12.10, Fedora 18. Improved timer and VAD-modules. Better gst-pipeline.
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
1 by Osmo Antero Maatta
Initial import 17.jan.2011
52
} TimerRec;
53
54
GList *parser_parse_actions(gchar *txt);
55
56
void parser_print_rec(TimerRec *tr);
57
void parser_print_list(GList *list);
58
void parser_free_list();
59
60
void timer_settings_changed();
61
173 by Osmo Antero
Support new systems; Ubuntu 12.10, Fedora 18. Improved timer and VAD-modules. Better gst-pipeline.
62
const gchar *parser_get_action_name(gchar action);
63
1 by Osmo Antero Maatta
Initial import 17.jan.2011
64
#endif
65