drumstick 2.9.0
C++ MIDI libraries using Qt objects, idioms, and style.

Auxiliary class to translate between raw MIDI streams and ALSA events. More...

#include <alsaevent.h>

Inheritance diagram for MidiCodec:

Public Member Functions

 MidiCodec (int bufsize, QObject *parent=nullptr)
 MidiCodec constructor. More...
 
 ~MidiCodec ()
 Destructor.
 
void init ()
 CODEC initialization.
 
long decode (unsigned char *buf, long count, const snd_seq_event_t *ev)
 Decode from event to bytes. More...
 
long encode (const unsigned char *buf, long count, snd_seq_event_t *ev)
 Encode from byte stream. More...
 
long encode (int c, snd_seq_event_t *ev)
 Read one byte and encode to sequencer event if finished. More...
 
void enableRunningStatus (bool enable)
 Enable MIDI running status (command merge) More...
 
void resetEncoder ()
 Reset MIDI encode parser.
 
void resetDecoder ()
 Reset MIDI decode parser.
 
void resizeBuffer (int bufsize)
 Resize the CODEC buffer. More...
 

Detailed Description

Auxiliary class to translate between raw MIDI streams and ALSA events.

Definition at line 787 of file alsaevent.h.

Constructor & Destructor Documentation

◆ MidiCodec()

MidiCodec ( int  bufsize,
QObject parent = nullptr 
)
explicit

MidiCodec constructor.

Parameters
bufsizeThe buffer size of the CODEC
parentThe optional parent object

Definition at line 1163 of file alsaevent.cpp.

References DRUMSTICK_ALSA_CHECK_ERROR.

Member Function Documentation

◆ decode()

long decode ( unsigned char *  buf,
long  count,
const snd_seq_event_t *  ev 
)

Decode from event to bytes.

Parameters
bufA buffer to get the results
countAvailable bytes in MIDI byte stream
evThe input event
Returns
The number of written bytes if success.

Definition at line 1193 of file alsaevent.cpp.

References DRUMSTICK_ALSA_CHECK_WARNING.

◆ enableRunningStatus()

void enableRunningStatus ( bool  enable)

Enable MIDI running status (command merge)

Parameters
enableTrue to enable, false to disable.

Definition at line 1233 of file alsaevent.cpp.

◆ encode() [1/2]

long encode ( const unsigned char *  buf,
long  count,
snd_seq_event_t *  ev 
)

Encode from byte stream.

Parameters
bufMIDI byte stream
countBytes of MIDI byte stream to encode
evResult - sequencer event
Returns
Number of written bytes if success.

Definition at line 1208 of file alsaevent.cpp.

References DRUMSTICK_ALSA_CHECK_WARNING.

◆ encode() [2/2]

long encode ( int  c,
snd_seq_event_t *  ev 
)

Read one byte and encode to sequencer event if finished.

Parameters
cA byte of MIDI stream
evResult - sequencer event
Returns
1 - sequencer event is completed, 0 - next byte is required for completion, otherwise a negative error code

Definition at line 1222 of file alsaevent.cpp.

References DRUMSTICK_ALSA_CHECK_WARNING.

◆ resizeBuffer()

void resizeBuffer ( int  bufsize)

Resize the CODEC buffer.

Parameters
bufsizeNew buffer size.

Definition at line 1261 of file alsaevent.cpp.

References DRUMSTICK_ALSA_CHECK_WARNING.


The documentation for this class was generated from the following files: