mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2026-03-11 05:33:43 -04:00
ump_msg: Add a new helper snd_ump_get_byte()
For making it easier to extract a byte from the UMP packet no matter which endian is used, introduce a new helper function snd_ump_get_byte(). It'll be useful for retrieving SysEx byte or a name string. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
530e2f8131
commit
28948f2fcc
1 changed files with 12 additions and 0 deletions
|
|
@ -1001,6 +1001,18 @@ static inline uint8_t snd_ump_sysex_msg_length(const uint32_t *ump)
|
||||||
return (*ump >> 16) & 0xf;
|
return (*ump >> 16) & 0xf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief extract one byte from a UMP packet
|
||||||
|
*/
|
||||||
|
static inline uint8_t snd_ump_get_byte(const uint32_t *ump, unsigned int offset)
|
||||||
|
{
|
||||||
|
#ifdef SNDRV_BIG_ENDIAN
|
||||||
|
return ((const uint8_t *)ump)[offset];
|
||||||
|
#else
|
||||||
|
return ((const uint8_t *)ump)[(offset & ~3) | (3 - (offset & 3))];
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
int snd_ump_msg_sysex_expand(const uint32_t *ump, uint8_t *buf, size_t maxlen,
|
int snd_ump_msg_sysex_expand(const uint32_t *ump, uint8_t *buf, size_t maxlen,
|
||||||
size_t *filled);
|
size_t *filled);
|
||||||
int snd_ump_packet_length(unsigned int type);
|
int snd_ump_packet_length(unsigned int type);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue