10 jack_nframes_t clock_next_tick
;
17 int clock_denominator
;
25 qn_port_t
* port
; // NULL at parse time, set at init time
29 // Used to sort all the output events for a port
33 char data
[NBYTES_MIDI
];
41 /* int offset_from_tick; */
42 /* foo_t offset_type; */
44 char data
[NBYTES_MIDI
];
50 // When handling the prefix events of the next pattern
53 // When handling the main events of the current pattern
56 // When handling the suffix events of the previous pattern
69 int playhead
[NEVENTSETS
];
70 int playhead_tmp
[NEVENTSETS
];
80 qn_patternvoice_t
* patternvoices
;
83 int tbm_ticks_per_beat
;
84 float tbm_beats_per_bar
;
87 enum BpmRelation bpm_relation
;
88 qn_patternvoice_t
* longest_pv
;
91 typedef qn_pattern_t
* (*next_pattern_proto
)(void* ctx
);
92 qn_pattern_t
* loop_one(void* ctx
);
93 qn_pattern_t
* once_through(void* ctx
);
94 qn_pattern_t
* loop_all(void* ctx
);
98 qn_config_port_t
* outports
;
104 qn_pattern_t
* patterns
;
106 // Optional, can override the default
107 next_pattern_proto next_pattern_func
;
111 jack_client_t
* client
;
113 int base_beats_per_minute
; // current, user can change real-time
118 jack_nframes_t sample_rate
;
119 jack_nframes_t elapsed
;
120 jack_transport_state_t transtate
;
122 // We are the jack timebase master
126 double tbm_bar_start_tick
;
127 jack_nframes_t frame_in_tick
;
129 int awaiting_common_start_beat
;
136 // A pluggable function determines the next pattern.
137 // This paves the way for a live mode vs song mode, or
138 // various test patterns.
139 next_pattern_proto next_pattern_func
;
142 qn_config_t
* qn_get_fake_config();
143 void qn_init_config(qn_config_t
* config
);
144 qn_context_t
* qn_init_context(qn_config_t
* config
, jack_client_t
* client
);
145 void qn_reset_playhead(qn_context_t
* ctx
);
146 void qn_free_config(qn_config_t
* cfg
);
147 void qn_free_context(qn_context_t
* ctx
);
148 int cmp_outevent(const void* a
, const void* b
);
151 #endif /* __context_h__ */