/* * Definitions of the OPL-3 registers. * * Copyright (c) by Jaroslav Kysela <perex@perex.cz>, * Hannu Savolainen 1993-1996 * * The OPL-3 mode is switched on by writing 0x01, to the offset 5 * of the right side. * * Another special register at the right side is at offset 4. It contains * a bit mask defining which voices are used as 4 OP voices. * * The percussive mode is implemented in the left side only. * * With the above exceptions the both sides can be operated independently. * * A 4 OP voice can be created by setting the corresponding * bit at offset 4 of the right side. * * For example setting the rightmost bit (0x01) changes the * first voice on the right side to the 4 OP mode. The fourth * voice is made inaccessible. * * If a voice is set to the 2 OP mode, it works like 2 OP modes * of the original YM3812 (AdLib). In addition the voice can * be connected the left, right or both stereo channels. It can * even be left unconnected. This works with 4 OP voices also. * * The stereo connection bits are located in the FEEDBACK_CONNECTION * register of the voice (0xC0-0xC8). In 4 OP voices these bits are * in the second half of the voice.
*/
#define OPL3_REG_KBD_SPLIT 0x08 /* Left side */ #define OPL3_COMPOSITE_SINE_WAVE_MODE 0x80 /* Don't use with OPL-3? */ #define OPL3_KEYBOARD_SPLIT 0x40
/* * Offsets to the register banks for operators. To get the * register number just add the operator offset to the bank offset * * AM/VIB/EG/KSR/Multiple (0x20 to 0x35)
*/ #define OPL3_REG_AM_VIB 0x20 #define OPL3_TREMOLO_ON 0x80 #define OPL3_VIBRATO_ON 0x40 #define OPL3_SUSTAIN_ON 0x20 #define OPL3_KSR 0x10 /* Key scaling rate */ #define OPL3_MULTIPLE_MASK 0x0f /* Frequency multiplier */
/* * KSL/Total level (0x40 to 0x55)
*/ #define OPL3_REG_KSL_LEVEL 0x40 #define OPL3_KSL_MASK 0xc0 /* Envelope scaling bits */ #define OPL3_TOTAL_LEVEL_MASK 0x3f /* Strength (volume) of OP */
/* * Offsets to the register banks for voices. Just add to the * voice number to get the register number. * * F-Number low bits (0xA0 to 0xA8).
*/ #define OPL3_REG_FNUM_LOW 0xa0
/* * F-number high bits / Key on / Block (octave) (0xB0 to 0xB8)
*/ #define OPL3_REG_KEYON_BLOCK 0xb0 #define OPL3_KEYON_BIT 0x20 #define OPL3_BLOCKNUM_MASK 0x1c #define OPL3_FNUM_HIGH_MASK 0x03
/* * Feedback / Connection (0xc0 to 0xc8) * * These registers have two new bits when the OPL-3 mode * is selected. These bits controls connecting the voice * to the stereo channels. For 4 OP voices this bit is * defined in the second half of the voice (add 3 to the * register offset). * * For 4 OP voices the connection bit is used in the * both halves (gives 4 ways to connect the operators).
*/ #define OPL3_REG_FEEDBACK_CONNECTION 0xc0 #define OPL3_FEEDBACK_MASK 0x0e /* Valid just for 1st OP of a voice */ #define OPL3_CONNECTION_BIT 0x01 /* * In the 4 OP mode there is four possible configurations how the * operators can be connected together (in 2 OP modes there is just * AM or FM). The 4 OP connection mode is defined by the rightmost * bit of the FEEDBACK_CONNECTION (0xC0-0xC8) on the both halves. * * First half Second half Mode * * +---+ * v | * 0 0 >+-1-+--2--3--4--> * * * * +---+ * | | * 0 1 >+-1-+--2-+ * |-> * >--3----4-+ * * +---+ * | | * 1 0 >+-1-+-----+ * |-> * >--2--3--4-+ * * +---+ * | | * 1 1 >+-1-+--+ * | * >--2--3-+-> * | * >--4----+
*/ #define OPL3_STEREO_BITS 0x30 /* OPL-3 only */ #define OPL3_VOICE_TO_LEFT 0x10 #define OPL3_VOICE_TO_RIGHT 0x20
/* * A structure to keep track of each hardware voice
*/ struct snd_opl3_voice { int state; /* status */ #define SNDRV_OPL3_ST_OFF 0 /* Not playing */ #define SNDRV_OPL3_ST_ON_2OP 1 /* 2op voice is allocated */ #define SNDRV_OPL3_ST_ON_4OP 2 /* 4op voice is allocated */ #define SNDRV_OPL3_ST_NOT_AVAIL -1 /* voice is not available */
unsignedint time; /* An allocation time */ unsignedchar note; /* Note currently assigned to this voice */
unsignedlong note_off; /* note-off time */ int note_off_check; /* check note-off time */
unsignedchar keyon_reg; /* KON register shadow */
struct snd_midi_channel *chan; /* Midi channel for this note */
};
spinlock_t voice_lock; /* Lock for voice access */
struct timer_list tlist; /* timer for note-offs and effects */ int sys_timer_status; /* system timer run status */
spinlock_t sys_timer_lock; /* Lock for system timer access */ #endif
};
/* opl3.c */ void snd_opl3_interrupt(struct snd_hwdep * hw); int snd_opl3_new(struct snd_card *card, unsignedshort hardware, struct snd_opl3 **ropl3); int snd_opl3_init(struct snd_opl3 *opl3); int snd_opl3_create(struct snd_card *card, unsignedlong l_port, unsignedlong r_port, unsignedshort hardware, int integrated, struct snd_opl3 ** opl3); int snd_opl3_timer_new(struct snd_opl3 * opl3, int timer1_dev, int timer2_dev); int snd_opl3_hwdep_new(struct snd_opl3 * opl3, int device, int seq_device, struct snd_hwdep ** rhwdep);
#if IS_ENABLED(CONFIG_SND_SEQUENCER) long snd_opl3_write(struct snd_hwdep *hw, constchar __user *buf, long count,
loff_t *offset); int snd_opl3_load_patch(struct snd_opl3 *opl3, int prog, int bank, int type, constchar *name, constunsignedchar *ext, constunsignedchar *data); struct fm_patch *snd_opl3_find_patch(struct snd_opl3 *opl3, int prog, int bank, int create_patch); void snd_opl3_clear_patches(struct snd_opl3 *opl3); #else #define snd_opl3_write NULL staticinlinevoid snd_opl3_clear_patches(struct snd_opl3 *opl3) {} #endif
#endif/* __SOUND_OPL3_H */
Messung V0.5
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.