O2
2.0
A communication protocol for interactive music and media applications.
src
sharedmemclient.h
1
// sharedmemclient.h -- to be included by shared memory processes
2
// undefines a bunch of unsafe o2 functions,
3
// defines a bunch of functions to only use in a shared memory process
4
//
5
// Roger B. Dannenberg
6
// August 2020
7
8
#undef o2_send
9
#undef o2_send_cmd
10
#define o2_time_get() DO_NOT_CALL_THIS_EXCEPT_FROM_O2_PROCESS
11
#define o2_initialize() DO_NOT_CALL_THIS_EXCEPT_FROM_O2_PROCESS
12
#define o2_finish() DO_NOT_CALL_THIS_EXCEPT_FROM_O2_PROCESS
13
#define o2_service_new(s) DO_NOT_CALL_THIS_EXCEPT_FROM_O2_PROCESS
14
#define o2_method_new DO_NOT_CALL_THIS_EXCEPT_FROM_O2_PROCESS
15
16
// these are safe o2 function calls, but we'll define alternate o2sm_ names
17
#define o2sm_send_start o2_send_start
18
#define o2sm_add_float o2_add_float
19
#define o2sm_add_string_or_symbol o2_add_string_or_symbol
20
#define o2sm_add_symbol o2_add_symbol
21
#define o2sm_add_string o2_add_string
22
#define o2sm_add_blob o2_add_blob
23
#define o2sm_add_blob_data o2_add_blob_data
24
#define o2sm_add_int64 o2_add_int64
25
#define o2sm_add_double_or_time o2_add_double_or_time
26
#define o2sm_add_double o2_add_double
27
#define o2sm_add_time o2_add_time
28
#define o2sm_add_int32 o2_add_int32
29
#define o2sm_add_char o2_add_char
30
#define o2sm_add_midi o2_add_midi
31
#define o2sm_add_only_typecode o2_add_only_typecode
32
#define o2sm_add_true o2_add_true
33
#define o2sm_add_false o2_add_false
34
#define o2sm_add_tf o2_add_tf
35
#define o2sm_add_bool o2_add_bool
36
#define o2sm_add_nil o2_add_nil
37
#define o2sm_add_infinitum o2_add_infinitum
38
#define o2sm_add_start_array o2_add_start_array
39
#define o2sm_add_end_array o2_add_end_array
40
#define o2sm_add_vector o2_add_vector
41
42
#define o2sm_extract_start o2_extract_start
43
#define o2sm_get_next o2_get_next
44
45
#define o2sm_send(path, time, ...) \
46
o2sm_send_marker(path, time, false, \
47
__VA_ARGS__, O2_MARKER_A, O2_MARKER_B)
48
49
#define o2sm_send_cmd(path, time, ...) \
50
o2sm_send_marker(path, time, true, \
51
__VA_ARGS__, O2_MARKER_A, O2_MARKER_B)
52
53
O2err
o2sm_send_marker(
const
char
*path,
double
time,
int
tcp_flag,
54
const
char
*typestring, ...);
55
O2err
o2sm_send_finish(
O2time
time,
const
char
*address,
bool
tcp_flag);
56
O2err
o2sm_message_send(
O2message_ptr
msg);
57
58
int
o2sm_get_id();
59
void
o2sm_poll();
60
O2time
o2sm_time_get();
61
O2err
o2_shmem_inst_finish(
Bridge_info
*inst);
62
void
o2sm_initialize(O2_context *ctx,
Bridge_info
*inst);
63
O2err
o2_shmem_finish();
64
O2message_ptr
o2sm_get_message(
Bridge_info
*inst);
65
// o2sm_service_new announces services to the O2 process.
66
O2err
o2sm_service_new(
const
char
*service,
const
char
*properties);
67
68
// o2sm_method_new attaches a handler to a path. Unless O2SM_PATTERNS
69
// is defined, this function does not require a service to have been
70
// created, saving a check for the service when a message arrives.
71
// But without a call to o2sm_service_new, no messages will be sent to
72
// this path.
73
O2err
o2sm_method_new(
const
char
*path,
const
char
*typespec,
74
O2method_handler
h,
void
*user_data,
75
bool
coerce,
bool
parse);
76
void
o2sm_finish();
77
Bridge_info
Definition:
bridge.h:146
O2method_handler
void(* O2method_handler)(const o2_msg_data_ptr msg, const char *types, O2arg_ptr *argv, int argc, const void *user_data)
callback function to receive an O2 message
Definition:
o2.h:880
O2time
double O2time
O2 timestamps are doubles representing seconds since the approximate start time of the ensemble.
Definition:
o2.h:625
O2err
O2err
return values used generally by O2 functions
Definition:
o2.h:329
O2message
an O2 message container
Definition:
o2.h:690
Generated by
1.9.2