aboutsummaryrefslogtreecommitdiff
path: root/sound/pci/trident/trident_synth.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/trident/trident_synth.c')
-rw-r--r--sound/pci/trident/trident_synth.c175
1 files changed, 83 insertions, 92 deletions
diff --git a/sound/pci/trident/trident_synth.c b/sound/pci/trident/trident_synth.c
index 5d5a719b058..cc7af8bc55a 100644
--- a/sound/pci/trident/trident_synth.c
+++ b/sound/pci/trident/trident_synth.c
@@ -192,15 +192,15 @@ static unsigned short log_from_linear( unsigned short value )
* Sample handling operations
*/
-static void sample_start(trident_t * trident, snd_trident_voice_t * voice, snd_seq_position_t position);
-static void sample_stop(trident_t * trident, snd_trident_voice_t * voice, snd_seq_stop_mode_t mode);
-static void sample_freq(trident_t * trident, snd_trident_voice_t * voice, snd_seq_frequency_t freq);
-static void sample_volume(trident_t * trident, snd_trident_voice_t * voice, snd_seq_ev_volume_t * volume);
-static void sample_loop(trident_t * trident, snd_trident_voice_t * voice, snd_seq_ev_loop_t * loop);
-static void sample_pos(trident_t * trident, snd_trident_voice_t * voice, snd_seq_position_t position);
-static void sample_private1(trident_t * trident, snd_trident_voice_t * voice, unsigned char *data);
-
-static snd_trident_sample_ops_t sample_ops =
+static void sample_start(struct snd_trident * trident, struct snd_trident_voice * voice, snd_seq_position_t position);
+static void sample_stop(struct snd_trident * trident, struct snd_trident_voice * voice, int mode);
+static void sample_freq(struct snd_trident * trident, struct snd_trident_voice * voice, snd_seq_frequency_t freq);
+static void sample_volume(struct snd_trident * trident, struct snd_trident_voice * voice, struct snd_seq_ev_volume * volume);
+static void sample_loop(struct snd_trident * trident, struct snd_trident_voice * voice, struct snd_seq_ev_loop * loop);
+static void sample_pos(struct snd_trident * trident, struct snd_trident_voice * voice, snd_seq_position_t position);
+static void sample_private1(struct snd_trident * trident, struct snd_trident_voice * voice, unsigned char *data);
+
+static struct snd_trident_sample_ops sample_ops =
{
sample_start,
sample_stop,
@@ -211,7 +211,7 @@ static snd_trident_sample_ops_t sample_ops =
sample_private1
};
-static void snd_trident_simple_init(snd_trident_voice_t * voice)
+static void snd_trident_simple_init(struct snd_trident_voice * voice)
{
//voice->handler_wave = interrupt_wave;
//voice->handler_volume = interrupt_volume;
@@ -220,10 +220,10 @@ static void snd_trident_simple_init(snd_trident_voice_t * voice)
voice->sample_ops = &sample_ops;
}
-static void sample_start(trident_t * trident, snd_trident_voice_t * voice, snd_seq_position_t position)
+static void sample_start(struct snd_trident * trident, struct snd_trident_voice * voice, snd_seq_position_t position)
{
- simple_instrument_t *simple;
- snd_seq_kinstr_t *instr;
+ struct simple_instrument *simple;
+ struct snd_seq_kinstr *instr;
unsigned long flags;
unsigned int loop_start, loop_end, sample_start, sample_end, start_offset;
unsigned int value;
@@ -305,7 +305,7 @@ static void sample_start(trident_t * trident, snd_trident_voice_t * voice, snd_s
snd_seq_instr_free_use(trident->synth.ilist, instr);
}
-static void sample_stop(trident_t * trident, snd_trident_voice_t * voice, snd_seq_stop_mode_t mode)
+static void sample_stop(struct snd_trident * trident, struct snd_trident_voice * voice, int mode)
{
unsigned long flags;
@@ -329,7 +329,7 @@ static void sample_stop(trident_t * trident, snd_trident_voice_t * voice, snd_se
}
}
-static void sample_freq(trident_t * trident, snd_trident_voice_t * voice, snd_seq_frequency_t freq)
+static void sample_freq(struct snd_trident * trident, struct snd_trident_voice * voice, snd_seq_frequency_t freq)
{
unsigned long flags;
freq >>= 4;
@@ -355,7 +355,7 @@ static void sample_freq(trident_t * trident, snd_trident_voice_t * voice, snd_se
spin_unlock_irqrestore(&trident->reg_lock, flags);
}
-static void sample_volume(trident_t * trident, snd_trident_voice_t * voice, snd_seq_ev_volume_t * volume)
+static void sample_volume(struct snd_trident * trident, struct snd_trident_voice * voice, struct snd_seq_ev_volume * volume)
{
unsigned long flags;
unsigned short value;
@@ -407,11 +407,11 @@ static void sample_volume(trident_t * trident, snd_trident_voice_t * voice, snd_
spin_unlock_irqrestore(&trident->reg_lock, flags);
}
-static void sample_loop(trident_t * trident, snd_trident_voice_t * voice, snd_seq_ev_loop_t * loop)
+static void sample_loop(struct snd_trident * trident, struct snd_trident_voice * voice, struct snd_seq_ev_loop * loop)
{
unsigned long flags;
- simple_instrument_t *simple;
- snd_seq_kinstr_t *instr;
+ struct simple_instrument *simple;
+ struct snd_seq_kinstr *instr;
unsigned int loop_start, loop_end;
instr = snd_seq_instr_find(trident->synth.ilist, &voice->instr, 0, 1);
@@ -446,11 +446,11 @@ static void sample_loop(trident_t * trident, snd_trident_voice_t * voice, snd_se
snd_seq_instr_free_use(trident->synth.ilist, instr);
}
-static void sample_pos(trident_t * trident, snd_trident_voice_t * voice, snd_seq_position_t position)
+static void sample_pos(struct snd_trident * trident, struct snd_trident_voice * voice, snd_seq_position_t position)
{
unsigned long flags;
- simple_instrument_t *simple;
- snd_seq_kinstr_t *instr;
+ struct simple_instrument *simple;
+ struct snd_seq_kinstr *instr;
unsigned int value;
instr = snd_seq_instr_find(trident->synth.ilist, &voice->instr, 0, 1);
@@ -496,7 +496,7 @@ static void sample_pos(trident_t * trident, snd_trident_voice_t * voice, snd_seq
snd_seq_instr_free_use(trident->synth.ilist, instr);
}
-static void sample_private1(trident_t * trident, snd_trident_voice_t * voice, unsigned char *data)
+static void sample_private1(struct snd_trident * trident, struct snd_trident_voice * voice, unsigned char *data)
{
}
@@ -504,10 +504,11 @@ static void sample_private1(trident_t * trident, snd_trident_voice_t * voice, un
* Memory management / sample loading
*/
-static int snd_trident_simple_put_sample(void *private_data, simple_instrument_t * instr,
+static int snd_trident_simple_put_sample(void *private_data,
+ struct simple_instrument * instr,
char __user *data, long len, int atomic)
{
- trident_t *trident = private_data;
+ struct snd_trident *trident = private_data;
int size = instr->size;
int shift = 0;
@@ -529,7 +530,7 @@ static int snd_trident_simple_put_sample(void *private_data, simple_instrument_t
return -EFAULT;
if (trident->tlb.entries) {
- snd_util_memblk_t *memblk;
+ struct snd_util_memblk *memblk;
memblk = snd_trident_synth_alloc(trident, size);
if (memblk == NULL)
return -ENOMEM;
@@ -557,10 +558,11 @@ static int snd_trident_simple_put_sample(void *private_data, simple_instrument_t
return 0;
}
-static int snd_trident_simple_get_sample(void *private_data, simple_instrument_t * instr,
+static int snd_trident_simple_get_sample(void *private_data,
+ struct simple_instrument * instr,
char __user *data, long len, int atomic)
{
- //trident_t *trident = private_data;
+ //struct snd_trident *trident = private_data;
int size = instr->size;
int shift = 0;
@@ -578,10 +580,11 @@ static int snd_trident_simple_get_sample(void *private_data, simple_instrument_t
return -EBUSY;
}
-static int snd_trident_simple_remove_sample(void *private_data, simple_instrument_t * instr,
+static int snd_trident_simple_remove_sample(void *private_data,
+ struct simple_instrument * instr,
int atomic)
{
- trident_t *trident = private_data;
+ struct snd_trident *trident = private_data;
int size = instr->size;
if (instr->format & SIMPLE_WAVE_16BIT)
@@ -590,7 +593,7 @@ static int snd_trident_simple_remove_sample(void *private_data, simple_instrumen
size <<= 1;
if (trident->tlb.entries) {
- snd_util_memblk_t *memblk = (snd_util_memblk_t*)instr->address.ptr;
+ struct snd_util_memblk *memblk = (struct snd_util_memblk *)instr->address.ptr;
if (memblk)
snd_trident_synth_free(trident, memblk);
else
@@ -612,9 +615,9 @@ static int snd_trident_simple_remove_sample(void *private_data, simple_instrumen
return 0;
}
-static void select_instrument(trident_t * trident, snd_trident_voice_t * v)
+static void select_instrument(struct snd_trident * trident, struct snd_trident_voice * v)
{
- snd_seq_kinstr_t *instr;
+ struct snd_seq_kinstr *instr;
instr = snd_seq_instr_find(trident->synth.ilist, &v->instr, 0, 1);
if (instr != NULL) {
if (instr->ops) {
@@ -629,7 +632,7 @@ static void select_instrument(trident_t * trident, snd_trident_voice_t * v)
*/
-static void event_sample(snd_seq_event_t * ev, snd_trident_port_t * p, snd_trident_voice_t * v)
+static void event_sample(struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v)
{
if (v->sample_ops && v->sample_ops->sample_stop)
v->sample_ops->sample_stop(p->trident, v, SAMPLE_STOP_IMMEDIATELY);
@@ -643,7 +646,7 @@ static void event_sample(snd_seq_event_t * ev, snd_trident_port_t * p, snd_tride
select_instrument(p->trident, v);
}
-static void event_cluster(snd_seq_event_t * ev, snd_trident_port_t * p, snd_trident_voice_t * v)
+static void event_cluster(struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v)
{
if (v->sample_ops && v->sample_ops->sample_stop)
v->sample_ops->sample_stop(p->trident, v, SAMPLE_STOP_IMMEDIATELY);
@@ -651,49 +654,49 @@ static void event_cluster(snd_seq_event_t * ev, snd_trident_port_t * p, snd_trid
select_instrument(p->trident, v);
}
-static void event_start(snd_seq_event_t * ev, snd_trident_port_t * p, snd_trident_voice_t * v)
+static void event_start(struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v)
{
if (v->sample_ops && v->sample_ops->sample_start)
v->sample_ops->sample_start(p->trident, v, ev->data.sample.param.position);
}
-static void event_stop(snd_seq_event_t * ev, snd_trident_port_t * p, snd_trident_voice_t * v)
+static void event_stop(struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v)
{
if (v->sample_ops && v->sample_ops->sample_stop)
v->sample_ops->sample_stop(p->trident, v, ev->data.sample.param.stop_mode);
}
-static void event_freq(snd_seq_event_t * ev, snd_trident_port_t * p, snd_trident_voice_t * v)
+static void event_freq(struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v)
{
if (v->sample_ops && v->sample_ops->sample_freq)
v->sample_ops->sample_freq(p->trident, v, ev->data.sample.param.frequency);
}
-static void event_volume(snd_seq_event_t * ev, snd_trident_port_t * p, snd_trident_voice_t * v)
+static void event_volume(struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v)
{
if (v->sample_ops && v->sample_ops->sample_volume)
v->sample_ops->sample_volume(p->trident, v, &ev->data.sample.param.volume);
}
-static void event_loop(snd_seq_event_t * ev, snd_trident_port_t * p, snd_trident_voice_t * v)
+static void event_loop(struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v)
{
if (v->sample_ops && v->sample_ops->sample_loop)
v->sample_ops->sample_loop(p->trident, v, &ev->data.sample.param.loop);
}
-static void event_position(snd_seq_event_t * ev, snd_trident_port_t * p, snd_trident_voice_t * v)
+static void event_position(struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v)
{
if (v->sample_ops && v->sample_ops->sample_pos)
v->sample_ops->sample_pos(p->trident, v, ev->data.sample.param.position);
}
-static void event_private1(snd_seq_event_t * ev, snd_trident_port_t * p, snd_trident_voice_t * v)
+static void event_private1(struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v)
{
if (v->sample_ops && v->sample_ops->sample_private1)
v->sample_ops->sample_private1(p->trident, v, (unsigned char *) &ev->data.sample.param.raw8);
}
-typedef void (trident_sample_event_handler_t) (snd_seq_event_t * ev, snd_trident_port_t * p, snd_trident_voice_t * v);
+typedef void (trident_sample_event_handler_t) (struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v);
static trident_sample_event_handler_t *trident_sample_event_handlers[9] =
{
@@ -708,11 +711,11 @@ static trident_sample_event_handler_t *trident_sample_event_handlers[9] =
event_private1
};
-static void snd_trident_sample_event(snd_seq_event_t * ev, snd_trident_port_t * p)
+static void snd_trident_sample_event(struct snd_seq_event * ev, struct snd_trident_port * p)
{
int idx, voice;
- trident_t *trident = p->trident;
- snd_trident_voice_t *v;
+ struct snd_trident *trident = p->trident;
+ struct snd_trident_voice *v;
unsigned long flags;
idx = ev->type - SNDRV_SEQ_EVENT_SAMPLE;
@@ -735,10 +738,10 @@ static void snd_trident_sample_event(snd_seq_event_t * ev, snd_trident_port_t *
*/
-static void snd_trident_synth_free_voices(trident_t * trident, int client, int port)
+static void snd_trident_synth_free_voices(struct snd_trident * trident, int client, int port)
{
int idx;
- snd_trident_voice_t *voice;
+ struct snd_trident_voice *voice;
for (idx = 0; idx < 32; idx++) {
voice = &trident->synth.voices[idx];
@@ -747,11 +750,11 @@ static void snd_trident_synth_free_voices(trident_t * trident, int client, int p
}
}
-static int snd_trident_synth_use(void *private_data, snd_seq_port_subscribe_t * info)
+static int snd_trident_synth_use(void *private_data, struct snd_seq_port_subscribe * info)
{
- snd_trident_port_t *port = (snd_trident_port_t *) private_data;
- trident_t *trident = port->trident;
- snd_trident_voice_t *voice;
+ struct snd_trident_port *port = private_data;
+ struct snd_trident *trident = port->trident;
+ struct snd_trident_voice *voice;
unsigned int idx;
unsigned long flags;
@@ -786,10 +789,10 @@ static int snd_trident_synth_use(void *private_data, snd_seq_port_subscribe_t *
return 0;
}
-static int snd_trident_synth_unuse(void *private_data, snd_seq_port_subscribe_t * info)
+static int snd_trident_synth_unuse(void *private_data, struct snd_seq_port_subscribe * info)
{
- snd_trident_port_t *port = (snd_trident_port_t *) private_data;
- trident_t *trident = port->trident;
+ struct snd_trident_port *port = private_data;
+ struct snd_trident *trident = port->trident;
unsigned long flags;
spin_lock_irqsave(&trident->reg_lock, flags);
@@ -802,18 +805,18 @@ static int snd_trident_synth_unuse(void *private_data, snd_seq_port_subscribe_t
*/
-static void snd_trident_synth_free_private_instruments(snd_trident_port_t * p, int client)
+static void snd_trident_synth_free_private_instruments(struct snd_trident_port * p, int client)
{
- snd_seq_instr_header_t ifree;
+ struct snd_seq_instr_header ifree;
memset(&ifree, 0, sizeof(ifree));
ifree.cmd = SNDRV_SEQ_INSTR_FREE_CMD_PRIVATE;
snd_seq_instr_list_free_cond(p->trident->synth.ilist, &ifree, client, 0);
}
-static int snd_trident_synth_event_input(snd_seq_event_t * ev, int direct, void *private_data, int atomic, int hop)
+static int snd_trident_synth_event_input(struct snd_seq_event * ev, int direct, void *private_data, int atomic, int hop)
{
- snd_trident_port_t *p = (snd_trident_port_t *) private_data;
+ struct snd_trident_port *p = (struct snd_trident_port *) private_data;
if (p == NULL)
return -EINVAL;
@@ -841,12 +844,12 @@ static int snd_trident_synth_event_input(snd_seq_event_t * ev, int direct, void
}
static void snd_trident_synth_instr_notify(void *private_data,
- snd_seq_kinstr_t * instr,
+ struct snd_seq_kinstr * instr,
int what)
{
int idx;
- trident_t *trident = private_data;
- snd_trident_voice_t *pvoice;
+ struct snd_trident *trident = private_data;
+ struct snd_trident_voice *pvoice;
unsigned long flags;
spin_lock_irqsave(&trident->event_lock, flags);
@@ -870,16 +873,16 @@ static void snd_trident_synth_instr_notify(void *private_data,
static void snd_trident_synth_free_port(void *private_data)
{
- snd_trident_port_t *p = (snd_trident_port_t *) private_data;
+ struct snd_trident_port *p = (struct snd_trident_port *) private_data;
if (p)
snd_midi_channel_free_set(p->chset);
}
-static int snd_trident_synth_create_port(trident_t * trident, int idx)
+static int snd_trident_synth_create_port(struct snd_trident * trident, int idx)
{
- snd_trident_port_t *p;
- snd_seq_port_callback_t callbacks;
+ struct snd_trident_port *p;
+ struct snd_seq_port_callback callbacks;
char name[32];
char *str;
int result;
@@ -927,43 +930,31 @@ static int snd_trident_synth_create_port(trident_t * trident, int idx)
*/
-static int snd_trident_synth_new_device(snd_seq_device_t *dev)
+static int snd_trident_synth_new_device(struct snd_seq_device *dev)
{
- trident_t *trident;
+ struct snd_trident *trident;
int client, i;
- snd_seq_client_callback_t callbacks;
- snd_seq_client_info_t cinfo;
- snd_seq_port_subscribe_t sub;
- snd_simple_ops_t *simpleops;
+ struct snd_seq_port_subscribe sub;
+ struct snd_simple_ops *simpleops;
char *str;
- trident = *(trident_t **)SNDRV_SEQ_DEVICE_ARGPTR(dev);
+ trident = *(struct snd_trident **)SNDRV_SEQ_DEVICE_ARGPTR(dev);
if (trident == NULL)
return -EINVAL;
trident->synth.seq_client = -1;
/* allocate new client */
- memset(&callbacks, 0, sizeof(callbacks));
- callbacks.private_data = trident;
- callbacks.allow_output = callbacks.allow_input = 1;
- client = trident->synth.seq_client =
- snd_seq_create_kernel_client(trident->card, 1, &callbacks);
- if (client < 0)
- return client;
-
- /* change name of client */
- memset(&cinfo, 0, sizeof(cinfo));
- cinfo.client = client;
- cinfo.type = KERNEL_CLIENT;
str = "???";
switch (trident->device) {
case TRIDENT_DEVICE_ID_DX: str = "Trident 4DWave-DX"; break;
case TRIDENT_DEVICE_ID_NX: str = "Trident 4DWave-NX"; break;
case TRIDENT_DEVICE_ID_SI7018: str = "SiS 7018"; break;
}
- sprintf(cinfo.name, str);
- snd_seq_kernel_client_ctl(client, SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, &cinfo);
+ client = trident->synth.seq_client =
+ snd_seq_create_kernel_client(trident->card, 1, str);
+ if (client < 0)
+ return client;
for (i = 0; i < 4; i++)
snd_trident_synth_create_port(trident, i);
@@ -993,11 +984,11 @@ static int snd_trident_synth_new_device(snd_seq_device_t *dev)
return 0;
}
-static int snd_trident_synth_delete_device(snd_seq_device_t *dev)
+static int snd_trident_synth_delete_device(struct snd_seq_device *dev)
{
- trident_t *trident;
+ struct snd_trident *trident;
- trident = *(trident_t **)SNDRV_SEQ_DEVICE_ARGPTR(dev);
+ trident = *(struct snd_trident **)SNDRV_SEQ_DEVICE_ARGPTR(dev);
if (trident == NULL)
return -EINVAL;
@@ -1012,14 +1003,14 @@ static int snd_trident_synth_delete_device(snd_seq_device_t *dev)
static int __init alsa_trident_synth_init(void)
{
- static snd_seq_dev_ops_t ops =
+ static struct snd_seq_dev_ops ops =
{
snd_trident_synth_new_device,
snd_trident_synth_delete_device
};
return snd_seq_device_register_driver(SNDRV_SEQ_DEV_ID_TRIDENT, &ops,
- sizeof(trident_t*));
+ sizeof(struct snd_trident *));
}
static void __exit alsa_trident_synth_exit(void)