-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlibchuck.h
62 lines (46 loc) · 1.52 KB
/
libchuck.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
//
// libchuck.h
// libchuck
//
// Created by Spencer Salazar on 2/24/15.
// Copyright (c) 2015 Spencer Salazar. All rights reserved.
//
#ifndef LIBCHUCK_H
#define LIBCHUCK_H
#ifdef __cplusplus
#define LIBCHUCK_FUNC_DECL extern "C"
#else
#define LIBCHUCK_FUNC_DECL
#endif // __cplusplus
typedef struct chuck_inst chuck_inst;
typedef struct chuck_options
{
int num_channels;
int sample_rate;
int buffer_size;
int adaptive_buffer_size;
bool slave;
} chuck_options;
typedef struct chuck_result
{
enum {
OK,
ERR_COMPILE,
ERR_NOSHRED,
ERR_BADINPUT,
ERR_FILE,
ERR_TIMEOUT,
} type;
int shred_id; // only valid if OK
} chuck_result;
LIBCHUCK_FUNC_DECL void libchuck_options_reset(chuck_options *options);
LIBCHUCK_FUNC_DECL chuck_inst *libchuck_create(chuck_options *options);
LIBCHUCK_FUNC_DECL void libchuck_destroy(chuck_inst *);
LIBCHUCK_FUNC_DECL int libchuck_vm_start(chuck_inst *);
LIBCHUCK_FUNC_DECL int libchuck_vm_stop(chuck_inst *);
LIBCHUCK_FUNC_DECL chuck_result libchuck_add_shred(chuck_inst *, const char *filepath, const char *code);
LIBCHUCK_FUNC_DECL chuck_result libchuck_replace_shred(chuck_inst *, int shred_id, const char *filepath, const char *code);
LIBCHUCK_FUNC_DECL chuck_result libchuck_remove_shred(chuck_inst *, int shred_id);
LIBCHUCK_FUNC_DECL int libchuck_slave_process(chuck_inst *, float *input, float *output, int numFrames);
LIBCHUCK_FUNC_DECL const char *libchuck_last_error_string(chuck_inst *);
#endif // LIBCHUCK_H