linux/sound/core/seq/seq_ump_convert.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * ALSA sequencer event conversion between UMP and legacy clients
 */

#include <linux/init.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <sound/core.h>
#include <sound/ump.h>
#include <sound/ump_msg.h>
#include "seq_ump_convert.h"

/*
 * Upgrade / downgrade value bits
 */
static u8 downscale_32_to_7bit(u32 src)
{}

static u16 downscale_32_to_14bit(u32 src)
{}

static u8 downscale_16_to_7bit(u16 src)
{}

static u16 upscale_7_to_16bit(u8 src)
{}

static u32 upscale_7_to_32bit(u8 src)
{}

static u32 upscale_14_to_32bit(u16 src)
{}

static unsigned char get_ump_group(struct snd_seq_client_port *port)
{}

/* create a UMP header */
#define make_raw_ump(port, type)

/*
 * UMP -> MIDI1 sequencer event
 */

/* MIDI 1.0 CVM */

/* encode note event */
static void ump_midi1_to_note_ev(const union snd_ump_midi1_msg *val,
				 struct snd_seq_event *ev)
{}

/* encode one parameter controls */
static void ump_midi1_to_ctrl_ev(const union snd_ump_midi1_msg *val,
				 struct snd_seq_event *ev)
{}

/* encode pitch wheel change */
static void ump_midi1_to_pitchbend_ev(const union snd_ump_midi1_msg *val,
				      struct snd_seq_event *ev)
{}

/* encode midi control change */
static void ump_midi1_to_cc_ev(const union snd_ump_midi1_msg *val,
			       struct snd_seq_event *ev)
{}

/* Encoding MIDI 1.0 UMP packet */
struct seq_ump_midi1_to_ev {};

/* Encoders for MIDI1 status 0x80-0xe0 */
static struct seq_ump_midi1_to_ev midi1_msg_encoders[] =;

static int cvt_ump_midi1_to_event(const union snd_ump_midi1_msg *val,
				  struct snd_seq_event *ev)
{}

/* MIDI System message */

/* encode one parameter value*/
static void ump_system_to_one_param_ev(const union snd_ump_midi1_msg *val,
				       struct snd_seq_event *ev)
{}

/* encode song position */
static void ump_system_to_songpos_ev(const union snd_ump_midi1_msg *val,
				     struct snd_seq_event *ev)
{}

/* Encoders for 0xf0 - 0xff */
static struct seq_ump_midi1_to_ev system_msg_encoders[] =;

static int cvt_ump_system_to_event(const union snd_ump_midi1_msg *val,
				   struct snd_seq_event *ev)
{}

/* MIDI 2.0 CVM */

/* encode note event */
static int ump_midi2_to_note_ev(const union snd_ump_midi2_msg *val,
				struct snd_seq_event *ev)
{}

/* encode pitch wheel change */
static int ump_midi2_to_pitchbend_ev(const union snd_ump_midi2_msg *val,
				     struct snd_seq_event *ev)
{}

/* encode midi control change */
static int ump_midi2_to_cc_ev(const union snd_ump_midi2_msg *val,
			      struct snd_seq_event *ev)
{}

/* encode midi program change */
static int ump_midi2_to_pgm_ev(const union snd_ump_midi2_msg *val,
			       struct snd_seq_event *ev)
{}

/* encode one parameter controls */
static int ump_midi2_to_ctrl_ev(const union snd_ump_midi2_msg *val,
				struct snd_seq_event *ev)
{}

/* encode RPN/NRPN */
static int ump_midi2_to_rpn_ev(const union snd_ump_midi2_msg *val,
			       struct snd_seq_event *ev)
{}

/* Encoding MIDI 2.0 UMP Packet */
struct seq_ump_midi2_to_ev {};

/* Encoders for MIDI2 status 0x00-0xf0 */
static struct seq_ump_midi2_to_ev midi2_msg_encoders[] =;

static int cvt_ump_midi2_to_event(const union snd_ump_midi2_msg *val,
				  struct snd_seq_event *ev)
{}

/* parse and compose for a sysex var-length event */
static int cvt_ump_sysex7_to_event(const u32 *data, unsigned char *buf,
				   struct snd_seq_event *ev)
{}

/* convert UMP packet from MIDI 1.0 to MIDI 2.0 and deliver it */
static int cvt_ump_midi1_to_midi2(struct snd_seq_client *dest,
				  struct snd_seq_client_port *dest_port,
				  struct snd_seq_event *__event,
				  int atomic, int hop)
{}

/* convert UMP packet from MIDI 2.0 to MIDI 1.0 and deliver it */
static int cvt_ump_midi2_to_midi1(struct snd_seq_client *dest,
				  struct snd_seq_client_port *dest_port,
				  struct snd_seq_event *__event,
				  int atomic, int hop)
{}

/* convert UMP to a legacy ALSA seq event and deliver it */
static int cvt_ump_to_any(struct snd_seq_client *dest,
			  struct snd_seq_client_port *dest_port,
			  struct snd_seq_event *event,
			  unsigned char type,
			  int atomic, int hop)
{}

/* Replace UMP group field with the destination and deliver */
static int deliver_with_group_convert(struct snd_seq_client *dest,
				      struct snd_seq_client_port *dest_port,
				      struct snd_seq_ump_event *ump_ev,
				      int atomic, int hop)
{}

/* apply the UMP event filter; return true to skip the event */
static bool ump_event_filtered(struct snd_seq_client *dest,
			       const struct snd_seq_ump_event *ev)
{}

/* Convert from UMP packet and deliver */
int snd_seq_deliver_from_ump(struct snd_seq_client *source,
			     struct snd_seq_client *dest,
			     struct snd_seq_client_port *dest_port,
			     struct snd_seq_event *event,
			     int atomic, int hop)
{}

/*
 * MIDI1 sequencer event -> UMP conversion
 */

/* Conversion to UMP MIDI 1.0 */

/* convert note on/off event to MIDI 1.0 UMP */
static int note_ev_to_ump_midi1(const struct snd_seq_event *event,
				struct snd_seq_client_port *dest_port,
				union snd_ump_midi1_msg *data,
				unsigned char status)
{}

/* convert CC event to MIDI 1.0 UMP */
static int cc_ev_to_ump_midi1(const struct snd_seq_event *event,
			      struct snd_seq_client_port *dest_port,
			      union snd_ump_midi1_msg *data,
			      unsigned char status)
{}

/* convert one-parameter control event to MIDI 1.0 UMP */
static int ctrl_ev_to_ump_midi1(const struct snd_seq_event *event,
				struct snd_seq_client_port *dest_port,
				union snd_ump_midi1_msg *data,
				unsigned char status)
{}

/* convert pitchbend event to MIDI 1.0 UMP */
static int pitchbend_ev_to_ump_midi1(const struct snd_seq_event *event,
				     struct snd_seq_client_port *dest_port,
				     union snd_ump_midi1_msg *data,
				     unsigned char status)
{}

/* convert 14bit control event to MIDI 1.0 UMP; split to two events */
static int ctrl14_ev_to_ump_midi1(const struct snd_seq_event *event,
				  struct snd_seq_client_port *dest_port,
				  union snd_ump_midi1_msg *data,
				  unsigned char status)
{}

/* convert RPN/NRPN event to MIDI 1.0 UMP; split to four events */
static int rpn_ev_to_ump_midi1(const struct snd_seq_event *event,
			       struct snd_seq_client_port *dest_port,
			       union snd_ump_midi1_msg *data,
			       unsigned char status)
{}

/* convert system / RT message to UMP */
static int system_ev_to_ump_midi1(const struct snd_seq_event *event,
				  struct snd_seq_client_port *dest_port,
				  union snd_ump_midi1_msg *data,
				  unsigned char status)
{}

/* convert system / RT message with 1 parameter to UMP */
static int system_1p_ev_to_ump_midi1(const struct snd_seq_event *event,
				     struct snd_seq_client_port *dest_port,
				     union snd_ump_midi1_msg *data,
				     unsigned char status)
{}

/* convert system / RT message with two parameters to UMP */
static int system_2p_ev_to_ump_midi1(const struct snd_seq_event *event,
				     struct snd_seq_client_port *dest_port,
				     union snd_ump_midi1_msg *data,
				     unsigned char status)
{}

/* Conversion to UMP MIDI 2.0 */

/* convert note on/off event to MIDI 2.0 UMP */
static int note_ev_to_ump_midi2(const struct snd_seq_event *event,
				struct snd_seq_client_port *dest_port,
				union snd_ump_midi2_msg *data,
				unsigned char status)
{}

/* convert PAF event to MIDI 2.0 UMP */
static int paf_ev_to_ump_midi2(const struct snd_seq_event *event,
			       struct snd_seq_client_port *dest_port,
			       union snd_ump_midi2_msg *data,
			       unsigned char status)
{}

static void reset_rpn(struct ump_cvt_to_ump_bank *cc)
{}

/* set up the MIDI2 RPN/NRPN packet data from the parsed info */
static int fill_rpn(struct ump_cvt_to_ump_bank *cc,
		    union snd_ump_midi2_msg *data,
		    unsigned char channel,
		    bool flush)
{}

/* convert CC event to MIDI 2.0 UMP */
static int cc_ev_to_ump_midi2(const struct snd_seq_event *event,
			      struct snd_seq_client_port *dest_port,
			      union snd_ump_midi2_msg *data,
			      unsigned char status)
{}

/* convert one-parameter control event to MIDI 2.0 UMP */
static int ctrl_ev_to_ump_midi2(const struct snd_seq_event *event,
				struct snd_seq_client_port *dest_port,
				union snd_ump_midi2_msg *data,
				unsigned char status)
{}

/* convert program change event to MIDI 2.0 UMP */
static int pgm_ev_to_ump_midi2(const struct snd_seq_event *event,
			       struct snd_seq_client_port *dest_port,
			       union snd_ump_midi2_msg *data,
			       unsigned char status)
{}

/* convert pitchbend event to MIDI 2.0 UMP */
static int pitchbend_ev_to_ump_midi2(const struct snd_seq_event *event,
				     struct snd_seq_client_port *dest_port,
				     union snd_ump_midi2_msg *data,
				     unsigned char status)
{}

/* convert 14bit control event to MIDI 2.0 UMP; split to two events */
static int ctrl14_ev_to_ump_midi2(const struct snd_seq_event *event,
				  struct snd_seq_client_port *dest_port,
				  union snd_ump_midi2_msg *data,
				  unsigned char status)
{}

/* convert RPN/NRPN event to MIDI 2.0 UMP */
static int rpn_ev_to_ump_midi2(const struct snd_seq_event *event,
			       struct snd_seq_client_port *dest_port,
			       union snd_ump_midi2_msg *data,
			       unsigned char status)
{}

/* convert system / RT message to UMP */
static int system_ev_to_ump_midi2(const struct snd_seq_event *event,
				  struct snd_seq_client_port *dest_port,
				  union snd_ump_midi2_msg *data,
				  unsigned char status)
{}

/* convert system / RT message with 1 parameter to UMP */
static int system_1p_ev_to_ump_midi2(const struct snd_seq_event *event,
				     struct snd_seq_client_port *dest_port,
				     union snd_ump_midi2_msg *data,
				     unsigned char status)
{}

/* convert system / RT message with two parameters to UMP */
static int system_2p_ev_to_ump_midi2(const struct snd_seq_event *event,
				     struct snd_seq_client_port *dest_port,
				     union snd_ump_midi2_msg *data,
				     unsigned char status)
{}

struct seq_ev_to_ump {};

static const struct seq_ev_to_ump seq_ev_ump_encoders[] =;

static const struct seq_ev_to_ump *find_ump_encoder(int type)
{}

static void setup_ump_event(struct snd_seq_ump_event *dest,
			    const struct snd_seq_event *src)
{}

/* Convert ALSA seq event to UMP MIDI 1.0 and deliver it */
static int cvt_to_ump_midi1(struct snd_seq_client *dest,
			    struct snd_seq_client_port *dest_port,
			    struct snd_seq_event *event,
			    int atomic, int hop)
{}

/* Convert ALSA seq event to UMP MIDI 2.0 and deliver it */
static int cvt_to_ump_midi2(struct snd_seq_client *dest,
			    struct snd_seq_client_port *dest_port,
			    struct snd_seq_event *event,
			    int atomic, int hop)
{}

/* Fill up a sysex7 UMP from the byte stream */
static void fill_sysex7_ump(struct snd_seq_client_port *dest_port,
			    u32 *val, u8 status, u8 *buf, int len)
{}

/* Convert sysex var event to UMP sysex7 packets and deliver them */
static int cvt_sysex_to_ump(struct snd_seq_client *dest,
			    struct snd_seq_client_port *dest_port,
			    struct snd_seq_event *event,
			    int atomic, int hop)
{}

/* Convert to UMP packet and deliver */
int snd_seq_deliver_to_ump(struct snd_seq_client *source,
			   struct snd_seq_client *dest,
			   struct snd_seq_client_port *dest_port,
			   struct snd_seq_event *event,
			   int atomic, int hop)
{}