BEAST/BSE - Better Audio System and Sound Engine
0.8.2
|
00001 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html 00002 #ifndef __BSE_MIDI_DECODER_H__ 00003 #define __BSE_MIDI_DECODER_H__ 00004 00005 #include <bse/bsemidievent.hh> 00006 00007 G_BEGIN_DECLS 00008 00009 00010 /* --- BSE MIDI structs --- */ 00011 typedef enum { 00012 BSE_MIDI_DECODER_ZERO = 0, 00013 /* read states as BSE_MIDI_DECODER_{needs_}..., 00014 * i.e. states indicate what's nect to be parsed 00015 */ 00016 BSE_MIDI_DECODER_DELTA_TIME, 00017 BSE_MIDI_DECODER_EVENT, 00018 BSE_MIDI_DECODER_VLENGTH, 00019 BSE_MIDI_DECODER_DATA, /* left_bytes != 0 */ 00020 BSE_MIDI_DECODER_DONE, 00021 } BseMidiDecoderState; 00022 struct BseMidiDecoder { 00023 SfiRing *events; /* BseMidiEvent* */ 00024 /* configuration */ 00025 BseMusicalTuningType musical_tuning; 00026 uint auto_queue : 1; 00027 uint smf_support : 1; 00028 /*< private >*/ 00029 uint state_changed : 1; 00030 BseMidiDecoderState state; 00031 uint32 delta_time; /* valid after BSE_MIDI_DECODER_DELTA_TIME_LOW */ 00032 BseMidiEventType event_type; /* event after BSE_MIDI_DECODER_META_EVENT */ 00033 BseMidiEventType running_mode; 00034 uint zchannel; /* current channel prefix (offset=-1) */ 00035 uint32 left_bytes; /* data to be read (BSE_MIDI_DECODER_DATA) */ 00036 /* data accu */ 00037 uint n_bytes; 00038 uint8 *bytes; 00039 }; 00040 00041 00042 /* --- API --- */ 00043 BseMidiDecoder* bse_midi_decoder_new (gboolean auto_queue, 00044 gboolean smf_support, 00045 BseMusicalTuningType musical_tuning); 00046 void bse_midi_decoder_destroy (BseMidiDecoder *self); 00047 void bse_midi_decoder_push_data (BseMidiDecoder *self, 00048 uint n_bytes, 00049 uint8 *bytes, 00050 uint64 usec_systime); 00051 void bse_midi_decoder_push_smf_data (BseMidiDecoder *self, 00052 uint n_bytes, 00053 uint8 *bytes); 00054 BseMidiEvent* bse_midi_decoder_pop_event (BseMidiDecoder *self); 00055 SfiRing* bse_midi_decoder_pop_event_list (BseMidiDecoder *self); 00056 00057 G_END_DECLS 00058 00059 #endif /* __BSE_MIDI_DECODER_H__ */