BEAST - Free Software Audio Synthesizer and Tracker  0.9.2
bsemididecoder.hh
Go to the documentation of this file.
1  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
2 #ifndef __BSE_MIDI_DECODER_H__
3 #define __BSE_MIDI_DECODER_H__
4 
5 #include <bse/bsemidievent.hh>
6 
7 G_BEGIN_DECLS
8 
9 
10 /* --- BSE MIDI structs --- */
11 typedef enum {
12  BSE_MIDI_DECODER_ZERO = 0,
13  /* read states as BSE_MIDI_DECODER_{needs_}...,
14  * i.e. states indicate what's nect to be parsed
15  */
16  BSE_MIDI_DECODER_DELTA_TIME,
17  BSE_MIDI_DECODER_EVENT,
18  BSE_MIDI_DECODER_VLENGTH,
19  BSE_MIDI_DECODER_DATA, /* left_bytes != 0 */
20  BSE_MIDI_DECODER_DONE,
21 } BseMidiDecoderState;
23  SfiRing *events; /* BseMidiEvent* */
24  /* configuration */
25  BseMusicalTuningType musical_tuning;
26  uint auto_queue : 1;
27  uint smf_support : 1;
28  /*< private >*/
29  uint state_changed : 1;
30  BseMidiDecoderState state;
31  uint32 delta_time; /* valid after BSE_MIDI_DECODER_DELTA_TIME_LOW */
32  BseMidiEventType event_type; /* event after BSE_MIDI_DECODER_META_EVENT */
33  BseMidiEventType running_mode;
34  uint zchannel; /* current channel prefix (offset=-1) */
35  uint32 left_bytes; /* data to be read (BSE_MIDI_DECODER_DATA) */
36  /* data accu */
37  uint n_bytes;
38  uint8 *bytes;
39 };
40 
41 
42 /* --- API --- */
43 BseMidiDecoder* bse_midi_decoder_new (gboolean auto_queue,
44  gboolean smf_support,
45  BseMusicalTuningType musical_tuning);
46 void bse_midi_decoder_destroy (BseMidiDecoder *self);
47 void bse_midi_decoder_push_data (BseMidiDecoder *self,
48  uint n_bytes,
49  uint8 *bytes,
50  uint64 usec_systime);
51 void bse_midi_decoder_push_smf_data (BseMidiDecoder *self,
52  uint n_bytes,
53  uint8 *bytes);
54 BseMidiEvent* bse_midi_decoder_pop_event (BseMidiDecoder *self);
55 SfiRing* bse_midi_decoder_pop_event_list (BseMidiDecoder *self);
56 
57 G_END_DECLS
58 
59 #endif /* __BSE_MIDI_DECODER_H__ */
Definition: bsemididecoder.hh:22
Definition: sfiring.hh:23
Definition: bsemidievent.hh:74