1 /* internal procedures */
2 100 static int default_out_of_memory(void);
3 100 static void* default_malloc(size_t s);
4 100 static void default_free(void* z);
5 100 static void* qmalloc(size_t s);
6 100 static void qfree(void* z);
8 0 static void emergency_cutoff(void);
9 0 static void chan_cutoff(int chan);
10 0 static void selective_cutoff(int chan, int note);
12 100 static void init_buffer(struct ring_buffer* b);
13 100 static void write_buffer(struct ring_buffer* b, int type, int misc, int u, int v);
14 100 static int read_buffer(struct ring_buffer* b, int* type, int* misc, int* u, int* v);
16 100 static int rfind_track(track* tr);
18 0 static void move_seq_pointers(unsigned tick);
20 100 static undo_op mk_undo_op();
21 100 static void dummy_undo(undo_op* op);
22 100 static void undo_collect(void);
23 100 static void undo_push(undo_op* op);
25 100 static void redo_add_track(undo_op* op);
26 100 static void undo_add_track(undo_op* op);
27 100 static void collect_add_track(undo_op* op);
29 100 static void redo_delete_track(undo_op* op);
30 100 static void undo_delete_track(undo_op* op);
31 100 static void collect_delete_track(undo_op* op);
33 static void redo_insert_block(undo_op* op);
34 static void undo_insert_block(undo_op* op);
35 static void collect_insert_block(undo_op* op);
37 static void redo_move_block(undo_op* op);
38 static void undo_move_block(undo_op* op);
39 static void collect_move_block(undo_op* op);
41 static void redo_resize_block(undo_op* op);
42 static void undo_resize_block(undo_op* op);
43 static void collect_resize_block(undo_op* op);
45 static void redo_delete_block(undo_op* op);
46 static void undo_delete_block(undo_op* op);
47 static void collect_delete_block(undo_op* op);
49 static void redo_push_chunk(undo_op* op);
50 static void undo_push_chunk(undo_op* op);
51 static void collect_push_chunk(undo_op* op);
53 static void redo_rrotate_chunk(undo_op* op);
54 static void undo_rrotate_chunk(undo_op* op);
55 static void collect_rrotate_chunk(undo_op* op);
57 static void redo_lrotate_chunk(undo_op* op);
58 static void undo_lrotate_chunk(undo_op* op);
59 static void collect_lrotate_chunk(undo_op* op);
61 100 static void redo_insert_event(undo_op* op);
62 100 static void undo_insert_event(undo_op* op);
63 100 static void collect_insert_event(undo_op* op);
65 100 static void redo_delete_event(undo_op* op);
66 100 static void undo_delete_event(undo_op* op);
67 100 static void collect_delete_event(undo_op* op);
71 100 void seq_play(void);
72 100 void seq_pause(void);
73 100 int seq_poll(void);
74 100 void seq_seek(unsigned tick);
75 100 void seq_reset(void);
76 100 void seq_record(int on_off);
77 100 void seq_loop(int on_off);
78 100 void seq_loop_limits(unsigned tick1, unsigned tick2);
79 100 void seq_time_config(int sr, int tpb, unsigned bpw);
82 100 void seq_init(void* (*alloc)(size_t), void (*oom)(void));
83 100 int seq_undo(void);
84 100 int seq_redo(void);
85 100 void seq_commit(void);
86 10 void seq_clear_all(void);
87 100 void seq_instant(track* tr, int type, int u, int v);
88 100 chunk* seq_mk_chunk(void);
91 /* these operations can be undone */
92 100 void seq_add_track(void);
93 100 void seq_delete_track(track* tr);
94 100 void seq_insert_block(unsigned tick, chunk* ck);
95 100 void seq_move_block(block* bl, track* tr, unsigned tick);
96 100 void seq_resize_block(block* bl, unsigned length);
97 100 void seq_delete_block(block* bl);
98 100 void seq_push_chunk(block* bl, chunk* ck);
99 100 void seq_rrotate_chunk(block* bl);
100 100 void seq_lrotate_chunk(block* bl);
101 100 void seq_insert_event(chunk* ck, unsigned tick, int type, int u, int v);
102 100 void seq_delete_event(chunk* ck, event* ev);
103 100 void seq_accept_recording(void);
106 /* sequencer state reading */
107 100 int seq_layer_number(block* bl);
108 100 void seq_walk_tracks(void);
109 100 track* seq_next_track(void);
110 100 void seq_walk_blocks(track* tr);
111 100 block* seq_next_block(void);
112 100 void seq_walk_events(chunk* ck);
113 100 event* seq_next_event(void);
116 /* audio thread operations */
117 10 int seq_advance(int samples, int* type, int* chan, int* u, int* v, int* used);
118 100 void seq_record_event(track* tr, int type, int u, int v);