Beast - Music Synthesizer and Composer  0.11.1+10.g2da35
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 
8 /* --- BSE MIDI structs --- */
9 typedef enum {
10  BSE_MIDI_DECODER_ZERO = 0,
11  /* read states as BSE_MIDI_DECODER_{needs_}...,
12  * i.e. states indicate what's nect to be parsed
13  */
14  BSE_MIDI_DECODER_DELTA_TIME,
15  BSE_MIDI_DECODER_EVENT,
16  BSE_MIDI_DECODER_VLENGTH,
17  BSE_MIDI_DECODER_DATA, /* left_bytes != 0 */
18  BSE_MIDI_DECODER_DONE,
19 } BseMidiDecoderState;
21  SfiRing *events; /* BseMidiEvent* */
22  /* configuration */
23  Bse::MusicalTuning musical_tuning;
24  uint auto_queue : 1;
25  uint smf_support : 1;
26  /*< private >*/
27  uint state_changed : 1;
28  BseMidiDecoderState state;
29  Bse::uint32 delta_time; /* valid after BSE_MIDI_DECODER_DELTA_TIME_LOW */
30  BseMidiEventType event_type; /* event after BSE_MIDI_DECODER_META_EVENT */
31  BseMidiEventType running_mode;
32  uint zchannel; /* current channel prefix (offset=-1) */
33  Bse::uint32 left_bytes; /* data to be read (BSE_MIDI_DECODER_DATA) */
34  /* data accu */
35  uint n_bytes;
36  Bse::uint8 *bytes;
37 };
38 
39 
40 /* --- API --- */
41 BseMidiDecoder* bse_midi_decoder_new (gboolean auto_queue,
42  gboolean smf_support,
43  Bse::MusicalTuning musical_tuning);
44 void bse_midi_decoder_destroy (BseMidiDecoder *self);
45 void bse_midi_decoder_push_data (BseMidiDecoder *self,
46  uint n_bytes,
47  Bse::uint8 *bytes,
48  Bse::uint64 usec_systime);
49 void bse_midi_decoder_push_smf_data (BseMidiDecoder *self,
50  uint n_bytes,
51  Bse::uint8 *bytes);
52 BseMidiEvent* bse_midi_decoder_pop_event (BseMidiDecoder *self);
53 SfiRing* bse_midi_decoder_pop_event_list (BseMidiDecoder *self);
54 
55 #endif /* __BSE_MIDI_DECODER_H__ */
Definition: bsemididecoder.hh:20
Definition: sfiring.hh:21
uint8_t uint8
uint64_t uint64
Definition: bsemidievent.hh:72
uint32_t uint32