linux/sound/drivers/opl3/opl3_midi.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  Copyright (c) by Uros Bizjak <[email protected]>
 *
 *  Midi synth routines for OPL2/OPL3/OPL4 FM
 */

#undef DEBUG_ALLOC
#undef DEBUG_MIDI

#include "opl3_voice.h"
#include <sound/asoundef.h>

#ifdef DEBUG_MIDI
#define opl3_dbg
#else
#define opl3_dbg(opl3, fmt, ...)
#endif

static void snd_opl3_note_off_unsafe(void *p, int note, int vel,
				     struct snd_midi_channel *chan);
/*
 * The next table looks magical, but it certainly is not. Its values have
 * been calculated as table[i]=8*log(i/64)/log(2) with an obvious exception
 * for i=0. This log-table converts a linear volume-scaling (0..127) to a
 * logarithmic scaling as present in the FM-synthesizer chips. so :    Volume
 * 64 =  0 db = relative volume  0 and:    Volume 32 = -6 db = relative
 * volume -8 it was implemented as a table because it is only 128 bytes and
 * it saves a lot of log() calculations. (Rob Hooft <[email protected]>)
 */

static const char opl3_volume_table[128] =;

void snd_opl3_calc_volume(unsigned char *volbyte, int vel,
			  struct snd_midi_channel *chan)
{}

/*
 * Converts the note frequency to block and fnum values for the FM chip
 */
static const short opl3_note_table[16] =;

static void snd_opl3_calc_pitch(unsigned char *fnum, unsigned char *blocknum,
				int note, struct snd_midi_channel *chan)
{}


#ifdef DEBUG_ALLOC
static void debug_alloc(struct snd_opl3 *opl3, char *s, int voice)
{
	int i;
	const char *str = "x.24";
	char buf[MAX_OPL3_VOICES + 1];

	for (i = 0; i < opl3->max_voices; i++)
		buf[i] = str[opl3->voices[i].state + 1];
	buf[i] = 0;
	dev_dbg(opl3->card->dev, "time %.5i: %s [%.2i]: %s\n",
		opl3->use_time, s, voice, buf);
}
#endif

/*
 * Get a FM voice (channel) to play a note on.
 */
static int opl3_get_voice(struct snd_opl3 *opl3, int instr_4op,
			  struct snd_midi_channel *chan) {}

/* ------------------------------ */

/*
 * System timer interrupt function
 */
void snd_opl3_timer_func(struct timer_list *t)
{}

/*
 * Start system timer
 */
static void snd_opl3_start_timer(struct snd_opl3 *opl3)
{}

/* ------------------------------ */


static const int snd_opl3_oss_map[MAX_OPL3_VOICES] =;

/*
 * Start a note.
 */
void snd_opl3_note_on(void *p, int note, int vel, struct snd_midi_channel *chan)
{}

static void snd_opl3_kill_voice(struct snd_opl3 *opl3, int voice)
{}

/*
 * Release a note in response to a midi note off.
 */
static void snd_opl3_note_off_unsafe(void *p, int note, int vel,
				     struct snd_midi_channel *chan)
{}

void snd_opl3_note_off(void *p, int note, int vel,
		       struct snd_midi_channel *chan)
{}

/*
 * key pressure change
 */
void snd_opl3_key_press(void *p, int note, int vel, struct snd_midi_channel *chan)
{}

/*
 * terminate note
 */
void snd_opl3_terminate_note(void *p, int note, struct snd_midi_channel *chan)
{}

static void snd_opl3_update_pitch(struct snd_opl3 *opl3, int voice)
{}

/*
 * Update voice pitch controller
 */
static void snd_opl3_pitch_ctrl(struct snd_opl3 *opl3, struct snd_midi_channel *chan)
{}

/*
 * Deal with a controller type event.  This includes all types of
 * control events, not just the midi controllers
 */
void snd_opl3_control(void *p, int type, struct snd_midi_channel *chan)
{}

/*
 * NRPN events
 */
void snd_opl3_nrpn(void *p, struct snd_midi_channel *chan,
		   struct snd_midi_channel_set *chset)
{}

/*
 * receive sysex
 */
void snd_opl3_sysex(void *p, unsigned char *buf, int len,
		    int parsed, struct snd_midi_channel_set *chset)
{}