summaryrefslogtreecommitdiffstats
path: root/include/xas/drone.h
blob: 338d53de42ad01d9e3162843506ad974dc6e55c4 (plain)
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
#ifndef _XAS_DRONE_H
#define _XAS_DRONE_H

#include <sys/time.h>

#include <xas/spatial.h>
#include <xas/seq.h>

#define XAS_DRONE_CHAMBER_BASS_FREQUENCY 20 /* Hz */
#define XAS_DRONE_CHAMBER_BASS_TYPE      XAS_SYNTH_SQUARE

typedef struct _xas_drone xas_drone;

struct _xas_drone {
    xas_bank *bank;
    xas_spatial_scene *scene;
    xas_spatial_object *obj;

    float speech_speed;
    const char **speech_lines;
};

typedef struct _xas_drone_chamber_interval {
    struct timeval duration;

    size_t freq_l,
           freq_r;

    enum xas_synth_type type_l,
                          type_r;
} xas_drone_chamber_interval;

typedef struct _xas_drone_chamber_speech {
    size_t drone_index,
           speech_line;
} xas_drone_chamber_speech;

typedef struct _xas_drone_chamber {
    xas_spatial_scene *scene;
    xas_drone **drones;
    size_t drone_count;

    xas_spatial_object *synth_bass,
                         *synth_l,
                         *synth_r;
} xas_drone_chamber;

xas_drone *xas_drone_new(xas_spatial_scene *scene,
                             xas_spatial_coord position,
                             float speech_speed,
                             size_t speech_sample_count,
                             size_t speech_line_count,
                             const char **speech_lines);

void xas_drone_destroy(xas_drone *drone);

xas_spatial_object *xas_drone_get_spatial_object(xas_drone *drone);

xas_drone_chamber *xas_drone_chamber_new(xas_spatial_scene *scene,
                                             xas_spatial_coord location,
                                             size_t drone_count);

void xas_drone_chamber_destroy(xas_drone_chamber *chamber);

void xas_drone_chamber_insert_drone(xas_drone_chamber *chamber,
                                      xas_drone *drone,
                                      size_t index);

int xas_drone_chamber_seq_intervals(xas_drone_chamber *chamber,
                                      xas_drone_chamber_interval *intervals,
                                      xas_seq *seq,
                                      size_t count,
                                      struct timeval *now);

int xas_drone_chamber_seq_speech(xas_drone_chamber *chamber,
                                   xas_drone *drone,
                                   xas_seq *seq,
                                   size_t speech_part,
                                   struct timeval *now);

int xas_drone_chamber_seq_chorus(xas_drone_chamber *chamber,
                                   xas_seq *seq,
                                   size_t speech_part,
                                   struct timeval *now);

#endif /* _XAS_DRONE_H */