-
Notifications
You must be signed in to change notification settings - Fork 0
/
trigger_type.h
95 lines (76 loc) · 2.54 KB
/
trigger_type.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/* -*- linux-c -*-
*
* Definition of a trigger
*
* This file is part of oblsc.
*
* Copyright (C) 2010-2011 Frej Drejhammar <[email protected]>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version
* 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
#ifndef _TRIGGER_TYPE_H_
#define _TRIGGER_TYPE_H_
#include <glib.h>
#include "state.h"
struct trigger_state {
gboolean success;
gint noof_available;
struct state *state;
};
struct trigger_pattern {
guint32 value;
guint32 mask;
};
struct trigger_timed_value {
struct trigger_timed_value *next;
gint delay;
guint32 value;
};
struct trigger {
gint delay; /* In samples */
gint noof_triggers;
struct sump_trigger **triggers;
};
struct trigger_pattern trigger_pattern_make(struct signal_def *signal,
guint32 value);
struct trigger_pattern trigger_pattern_merge(
struct trigger_pattern a,
struct trigger_pattern b);
struct trigger *trigger_make_pattern_trigger(
struct trigger_state *trigger_state,
struct trigger_pattern pattern);
struct trigger *trigger_add_time_delay(struct state *state,
struct trigger_state *trigger_state,
struct trigger *trigger,
gdouble delay);
struct trigger *trigger_add_sample_delay(struct trigger_state *trigger_state,
struct trigger *trigger,
gint delay);
struct trigger_timed_value *trigger_make_timed_value(
struct state *state,
guint32 value, gdouble delay);
struct trigger_timed_value *trigger_make_delayed_value(
guint32 value, gint delay);
struct trigger *trigger_make_timed_trigger(struct trigger_state *trigger_state,
struct signal_def *signal,
struct trigger_timed_value *values);
void trigger_state_init(struct state *state,
struct trigger_state *trigger_state);
struct trigger *trigger_activate(struct trigger *trigger,
gint level, gboolean start);
/* triggers is a list of struct trigger * */
void trigger_activate_sequential_list(GList *triggers);
void trigger_activate_parallel_list(GList *triggers);
#endif /* _TRIGGER_TYPE_H_ */