Skip to content

Commit

Permalink
[ALSA] Remove xxx_t typedefs: OPL3
Browse files Browse the repository at this point in the history
Modules: OPL3,Raw OPL FM

Remove xxx_t typedefs from the OPL3 driver

Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Iwai authored and Jaroslav Kysela committed Jan 3, 2006
1 parent e1fad17 commit 5b1646a
Show file tree
Hide file tree
Showing 9 changed files with 235 additions and 231 deletions.
24 changes: 12 additions & 12 deletions include/sound/asound_fm.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@
#define SNDRV_DM_FM_MODE_OPL2 0x00
#define SNDRV_DM_FM_MODE_OPL3 0x01

typedef struct snd_dm_fm_info {
struct snd_dm_fm_info {
unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */
unsigned char rhythm; /* percussion mode flag */
} snd_dm_fm_info_t;
};

/*
* Data structure composing an FM "note" or sound event.
*/

typedef struct snd_dm_fm_voice {
struct snd_dm_fm_voice {
unsigned char op; /* operator cell (0 or 1) */
unsigned char voice; /* FM voice (0 to 17) */

Expand All @@ -60,25 +60,25 @@ typedef struct snd_dm_fm_voice {
unsigned char left; /* stereo left */
unsigned char right; /* stereo right */
unsigned char waveform; /* 3 bits: waveform shape */
} snd_dm_fm_voice_t;
};

/*
* This describes an FM note by its voice, octave, frequency number (10bit)
* and key on/off.
*/

typedef struct snd_dm_fm_note {
struct snd_dm_fm_note {
unsigned char voice; /* 0-17 voice channel */
unsigned char octave; /* 3 bits: what octave to play */
unsigned int fnum; /* 10 bits: frequency number */
unsigned char key_on; /* set for active, clear for silent */
} snd_dm_fm_note_t;
};

/*
* FM parameters that apply globally to all voices, and thus are not "notes"
*/

typedef struct snd_dm_fm_params {
struct snd_dm_fm_params {
unsigned char am_depth; /* amplitude modulation depth (1=hi) */
unsigned char vib_depth; /* vibrato depth (1=hi) */
unsigned char kbd_split; /* keyboard split */
Expand All @@ -90,17 +90,17 @@ typedef struct snd_dm_fm_params {
unsigned char tomtom;
unsigned char cymbal;
unsigned char hihat;
} snd_dm_fm_params_t;
};

/*
* FM mode ioctl settings
*/

#define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, snd_dm_fm_info_t)
#define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, struct snd_dm_fm_info)
#define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21)
#define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, snd_dm_fm_note_t)
#define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, snd_dm_fm_voice_t)
#define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, snd_dm_fm_params_t)
#define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, struct snd_dm_fm_note)
#define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, struct snd_dm_fm_voice)
#define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, struct snd_dm_fm_params)
#define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int)
/* for OPL3 only */
#define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int)
Expand Down
57 changes: 29 additions & 28 deletions include/sound/opl3.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,12 @@
#define MAX_OPL2_VOICES 9
#define MAX_OPL3_VOICES 18

typedef struct snd_opl3 opl3_t;
struct snd_opl3;

/*
* A structure to keep track of each hardware voice
*/
typedef struct snd_opl3_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 */
Expand All @@ -257,8 +257,8 @@ typedef struct snd_opl3_voice {

unsigned char keyon_reg; /* KON register shadow */

snd_midi_channel_t *chan; /* Midi channel for this note */
} snd_opl3_voice_t;
struct snd_midi_channel *chan; /* Midi channel for this note */
};

struct snd_opl3 {
unsigned long l_port;
Expand All @@ -267,18 +267,18 @@ struct snd_opl3 {
struct resource *res_r_port;
unsigned short hardware;
/* hardware access */
void (*command) (opl3_t * opl3, unsigned short cmd, unsigned char val);
void (*command) (struct snd_opl3 * opl3, unsigned short cmd, unsigned char val);
unsigned short timer_enable;
int seq_dev_num; /* sequencer device number */
snd_timer_t *timer1;
snd_timer_t *timer2;
struct snd_timer *timer1;
struct snd_timer *timer2;
spinlock_t timer_lock;

void *private_data;
void (*private_free)(opl3_t *);
void (*private_free)(struct snd_opl3 *);

spinlock_t reg_lock;
snd_card_t *card; /* The card that this belongs to */
struct snd_card *card; /* The card that this belongs to */
int used; /* usage flag - exclusive */
unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */
unsigned char rhythm; /* percussion mode flag */
Expand All @@ -289,18 +289,18 @@ struct snd_opl3 {
int synth_mode; /* synth mode */
int seq_client;

snd_seq_device_t *seq_dev; /* sequencer device */
snd_midi_channel_set_t * chset;
struct snd_seq_device *seq_dev; /* sequencer device */
struct snd_midi_channel_set * chset;

#ifdef CONFIG_SND_SEQUENCER_OSS
snd_seq_device_t *oss_seq_dev; /* OSS sequencer device */
snd_midi_channel_set_t * oss_chset;
struct snd_seq_device *oss_seq_dev; /* OSS sequencer device */
struct snd_midi_channel_set * oss_chset;
#endif

snd_seq_kinstr_ops_t fm_ops;
snd_seq_kinstr_list_t *ilist;
struct snd_seq_kinstr_ops fm_ops;
struct snd_seq_kinstr_list *ilist;

snd_opl3_voice_t voices[MAX_OPL3_VOICES]; /* Voices (OPL3 'channel') */
struct snd_opl3_voice voices[MAX_OPL3_VOICES]; /* Voices (OPL3 'channel') */
int use_time; /* allocation counter */

unsigned short connection_reg; /* connection reg shadow */
Expand All @@ -316,24 +316,25 @@ struct snd_opl3 {
};

/* opl3.c */
void snd_opl3_interrupt(snd_hwdep_t * hw);
int snd_opl3_new(snd_card_t *card, unsigned short hardware, opl3_t **ropl3);
int snd_opl3_init(opl3_t *opl3);
int snd_opl3_create(snd_card_t * card,
void snd_opl3_interrupt(struct snd_hwdep * hw);
int snd_opl3_new(struct snd_card *card, unsigned short hardware,
struct snd_opl3 **ropl3);
int snd_opl3_init(struct snd_opl3 *opl3);
int snd_opl3_create(struct snd_card *card,
unsigned long l_port, unsigned long r_port,
unsigned short hardware,
int integrated,
opl3_t ** opl3);
int snd_opl3_timer_new(opl3_t * opl3, int timer1_dev, int timer2_dev);
int snd_opl3_hwdep_new(opl3_t * opl3, int device, int seq_device,
snd_hwdep_t ** rhwdep);
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);

/* opl3_synth */
int snd_opl3_open(snd_hwdep_t * hw, struct file *file);
int snd_opl3_ioctl(snd_hwdep_t * hw, struct file *file,
int snd_opl3_open(struct snd_hwdep * hw, struct file *file);
int snd_opl3_ioctl(struct snd_hwdep * hw, struct file *file,
unsigned int cmd, unsigned long arg);
int snd_opl3_release(snd_hwdep_t * hw, struct file *file);
int snd_opl3_release(struct snd_hwdep * hw, struct file *file);

void snd_opl3_reset(opl3_t * opl3);
void snd_opl3_reset(struct snd_opl3 * opl3);

#endif /* __SOUND_OPL3_H */
45 changes: 24 additions & 21 deletions sound/drivers/opl3/opl3_drums.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static char snd_opl3_drum_table[47] =
OPL3_CYMBAL_ON, OPL3_CYMBAL_ON /* 80 - 81 */
};

typedef struct snd_opl3_drum_voice {
struct snd_opl3_drum_voice {
int voice;
int op;
unsigned char am_vib;
Expand All @@ -54,33 +54,34 @@ typedef struct snd_opl3_drum_voice {
unsigned char sustain_release;
unsigned char feedback_connection;
unsigned char wave_select;
} snd_opl3_drum_voice_t;
};

typedef struct snd_opl3_drum_note {
struct snd_opl3_drum_note {
int voice;
unsigned char fnum;
unsigned char octave_f;
unsigned char feedback_connection;
} snd_opl3_drum_note_t;
};

static snd_opl3_drum_voice_t bass_op0 = {6, 0, 0x00, 0x32, 0xf8, 0x66, 0x30, 0x00};
static snd_opl3_drum_voice_t bass_op1 = {6, 1, 0x00, 0x03, 0xf6, 0x57, 0x30, 0x00};
static snd_opl3_drum_note_t bass_note = {6, 0x90, 0x09};
static struct snd_opl3_drum_voice bass_op0 = {6, 0, 0x00, 0x32, 0xf8, 0x66, 0x30, 0x00};
static struct snd_opl3_drum_voice bass_op1 = {6, 1, 0x00, 0x03, 0xf6, 0x57, 0x30, 0x00};
static struct snd_opl3_drum_note bass_note = {6, 0x90, 0x09};

static snd_opl3_drum_voice_t hihat = {7, 0, 0x00, 0x03, 0xf0, 0x06, 0x20, 0x00};
static struct snd_opl3_drum_voice hihat = {7, 0, 0x00, 0x03, 0xf0, 0x06, 0x20, 0x00};

static snd_opl3_drum_voice_t snare = {7, 1, 0x00, 0x03, 0xf0, 0x07, 0x20, 0x02};
static snd_opl3_drum_note_t snare_note = {7, 0xf4, 0x0d};
static struct snd_opl3_drum_voice snare = {7, 1, 0x00, 0x03, 0xf0, 0x07, 0x20, 0x02};
static struct snd_opl3_drum_note snare_note = {7, 0xf4, 0x0d};

static snd_opl3_drum_voice_t tomtom = {8, 0, 0x02, 0x03, 0xf0, 0x06, 0x10, 0x00};
static snd_opl3_drum_note_t tomtom_note = {8, 0xf4, 0x09};
static struct snd_opl3_drum_voice tomtom = {8, 0, 0x02, 0x03, 0xf0, 0x06, 0x10, 0x00};
static struct snd_opl3_drum_note tomtom_note = {8, 0xf4, 0x09};

static snd_opl3_drum_voice_t cymbal = {8, 1, 0x04, 0x03, 0xf0, 0x06, 0x10, 0x00};
static struct snd_opl3_drum_voice cymbal = {8, 1, 0x04, 0x03, 0xf0, 0x06, 0x10, 0x00};

/*
* set drum voice characteristics
*/
static void snd_opl3_drum_voice_set(opl3_t *opl3, snd_opl3_drum_voice_t *data)
static void snd_opl3_drum_voice_set(struct snd_opl3 *opl3,
struct snd_opl3_drum_voice *data)
{
unsigned char op_offset = snd_opl3_regmap[data->voice][data->op];
unsigned char voice_offset = data->voice;
Expand Down Expand Up @@ -114,7 +115,8 @@ static void snd_opl3_drum_voice_set(opl3_t *opl3, snd_opl3_drum_voice_t *data)
/*
* Set drum voice pitch
*/
static void snd_opl3_drum_note_set(opl3_t *opl3, snd_opl3_drum_note_t *data)
static void snd_opl3_drum_note_set(struct snd_opl3 *opl3,
struct snd_opl3_drum_note *data)
{
unsigned char voice_offset = data->voice;
unsigned short opl3_reg;
Expand All @@ -131,8 +133,9 @@ static void snd_opl3_drum_note_set(opl3_t *opl3, snd_opl3_drum_note_t *data)
/*
* Set drum voice volume and position
*/
static void snd_opl3_drum_vol_set(opl3_t *opl3, snd_opl3_drum_voice_t *data,
int vel, snd_midi_channel_t *chan)
static void snd_opl3_drum_vol_set(struct snd_opl3 *opl3,
struct snd_opl3_drum_voice *data,
int vel, struct snd_midi_channel *chan)
{
unsigned char op_offset = snd_opl3_regmap[data->voice][data->op];
unsigned char voice_offset = data->voice;
Expand All @@ -159,7 +162,7 @@ static void snd_opl3_drum_vol_set(opl3_t *opl3, snd_opl3_drum_voice_t *data,
/*
* Loads drum voices at init time
*/
void snd_opl3_load_drums(opl3_t *opl3)
void snd_opl3_load_drums(struct snd_opl3 *opl3)
{
snd_opl3_drum_voice_set(opl3, &bass_op0);
snd_opl3_drum_voice_set(opl3, &bass_op1);
Expand All @@ -179,11 +182,11 @@ void snd_opl3_load_drums(opl3_t *opl3)
/*
* Switch drum voice on or off
*/
void snd_opl3_drum_switch(opl3_t *opl3, int note, int vel, int on_off,
snd_midi_channel_t *chan)
void snd_opl3_drum_switch(struct snd_opl3 *opl3, int note, int vel, int on_off,
struct snd_midi_channel *chan)
{
unsigned char drum_mask;
snd_opl3_drum_voice_t *drum_voice;
struct snd_opl3_drum_voice *drum_voice;

if (!(opl3->drum_reg & OPL3_PERCUSSION_ENABLE))
return;
Expand Down
Loading

0 comments on commit 5b1646a

Please sign in to comment.