aboutsummaryrefslogtreecommitdiffstats
path: root/sound/synth/emux/emux_synth.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 08:24:47 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:18:14 -0500
commit03da312ac080b4f5c9359c233b8812cc93a035fe (patch)
tree1a6767ca18964b53442ecfd538141b12e81b23be /sound/synth/emux/emux_synth.c
parentee42381e71c56328db9e9d64d19a4de7a2f09a93 (diff)
[ALSA] Remove xxx_t typedefs: Emu-X synth
Modules: Common EMU synth,SoundFont,Synth Remove xxx_t typedefs from the Emu-X synth support. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/synth/emux/emux_synth.c')
-rw-r--r--sound/synth/emux/emux_synth.c139
1 files changed, 72 insertions, 67 deletions
diff --git a/sound/synth/emux/emux_synth.c b/sound/synth/emux/emux_synth.c
index bd71b73be65..c387a83a655 100644
--- a/sound/synth/emux/emux_synth.c
+++ b/sound/synth/emux/emux_synth.c
@@ -36,30 +36,34 @@
36#define LIMITVALUE(x, a, b) do { if ((x) < (a)) (x) = (a); else if ((x) > (b)) (x) = (b); } while (0) 36#define LIMITVALUE(x, a, b) do { if ((x) < (a)) (x) = (a); else if ((x) > (b)) (x) = (b); } while (0)
37#define LIMITMAX(x, a) do {if ((x) > (a)) (x) = (a); } while (0) 37#define LIMITMAX(x, a) do {if ((x) > (a)) (x) = (a); } while (0)
38 38
39static int get_zone(snd_emux_t *emu, snd_emux_port_t *port, int *notep, int vel, snd_midi_channel_t *chan, snd_sf_zone_t **table); 39static int get_zone(struct snd_emux *emu, struct snd_emux_port *port,
40static int get_bank(snd_emux_port_t *port, snd_midi_channel_t *chan); 40 int *notep, int vel, struct snd_midi_channel *chan,
41static void terminate_note1(snd_emux_t *emu, int note, snd_midi_channel_t *chan, int free); 41 struct snd_sf_zone **table);
42static void exclusive_note_off(snd_emux_t *emu, snd_emux_port_t *port, int exclass); 42static int get_bank(struct snd_emux_port *port, struct snd_midi_channel *chan);
43static void terminate_voice(snd_emux_t *emu, snd_emux_voice_t *vp, int free); 43static void terminate_note1(struct snd_emux *emu, int note,
44static void update_voice(snd_emux_t *emu, snd_emux_voice_t *vp, int update); 44 struct snd_midi_channel *chan, int free);
45static void setup_voice(snd_emux_voice_t *vp); 45static void exclusive_note_off(struct snd_emux *emu, struct snd_emux_port *port,
46static int calc_pan(snd_emux_voice_t *vp); 46 int exclass);
47static int calc_volume(snd_emux_voice_t *vp); 47static void terminate_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int free);
48static int calc_pitch(snd_emux_voice_t *vp); 48static void update_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int update);
49static void setup_voice(struct snd_emux_voice *vp);
50static int calc_pan(struct snd_emux_voice *vp);
51static int calc_volume(struct snd_emux_voice *vp);
52static int calc_pitch(struct snd_emux_voice *vp);
49 53
50 54
51/* 55/*
52 * Start a note. 56 * Start a note.
53 */ 57 */
54void 58void
55snd_emux_note_on(void *p, int note, int vel, snd_midi_channel_t *chan) 59snd_emux_note_on(void *p, int note, int vel, struct snd_midi_channel *chan)
56{ 60{
57 snd_emux_t *emu; 61 struct snd_emux *emu;
58 int i, key, nvoices; 62 int i, key, nvoices;
59 snd_emux_voice_t *vp; 63 struct snd_emux_voice *vp;
60 snd_sf_zone_t *table[SNDRV_EMUX_MAX_MULTI_VOICES]; 64 struct snd_sf_zone *table[SNDRV_EMUX_MAX_MULTI_VOICES];
61 unsigned long flags; 65 unsigned long flags;
62 snd_emux_port_t *port; 66 struct snd_emux_port *port;
63 67
64 port = p; 68 port = p;
65 snd_assert(port != NULL && chan != NULL, return); 69 snd_assert(port != NULL && chan != NULL, return);
@@ -76,7 +80,7 @@ snd_emux_note_on(void *p, int note, int vel, snd_midi_channel_t *chan)
76 80
77 /* exclusive note off */ 81 /* exclusive note off */
78 for (i = 0; i < nvoices; i++) { 82 for (i = 0; i < nvoices; i++) {
79 snd_sf_zone_t *zp = table[i]; 83 struct snd_sf_zone *zp = table[i];
80 if (zp && zp->v.exclusiveClass) 84 if (zp && zp->v.exclusiveClass)
81 exclusive_note_off(emu, port, zp->v.exclusiveClass); 85 exclusive_note_off(emu, port, zp->v.exclusiveClass);
82 } 86 }
@@ -138,7 +142,7 @@ snd_emux_note_on(void *p, int note, int vel, snd_midi_channel_t *chan)
138#ifdef SNDRV_EMUX_USE_RAW_EFFECT 142#ifdef SNDRV_EMUX_USE_RAW_EFFECT
139 if (port->port_mode == SNDRV_EMUX_PORT_MODE_OSS_SYNTH) { 143 if (port->port_mode == SNDRV_EMUX_PORT_MODE_OSS_SYNTH) {
140 /* clear voice position for the next note on this channel */ 144 /* clear voice position for the next note on this channel */
141 snd_emux_effect_table_t *fx = chan->private; 145 struct snd_emux_effect_table *fx = chan->private;
142 if (fx) { 146 if (fx) {
143 fx->flag[EMUX_FX_SAMPLE_START] = 0; 147 fx->flag[EMUX_FX_SAMPLE_START] = 0;
144 fx->flag[EMUX_FX_COARSE_SAMPLE_START] = 0; 148 fx->flag[EMUX_FX_COARSE_SAMPLE_START] = 0;
@@ -151,13 +155,13 @@ snd_emux_note_on(void *p, int note, int vel, snd_midi_channel_t *chan)
151 * Release a note in response to a midi note off. 155 * Release a note in response to a midi note off.
152 */ 156 */
153void 157void
154snd_emux_note_off(void *p, int note, int vel, snd_midi_channel_t *chan) 158snd_emux_note_off(void *p, int note, int vel, struct snd_midi_channel *chan)
155{ 159{
156 int ch; 160 int ch;
157 snd_emux_t *emu; 161 struct snd_emux *emu;
158 snd_emux_voice_t *vp; 162 struct snd_emux_voice *vp;
159 unsigned long flags; 163 unsigned long flags;
160 snd_emux_port_t *port; 164 struct snd_emux_port *port;
161 165
162 port = p; 166 port = p;
163 snd_assert(port != NULL && chan != NULL, return); 167 snd_assert(port != NULL && chan != NULL, return);
@@ -199,8 +203,8 @@ snd_emux_note_off(void *p, int note, int vel, snd_midi_channel_t *chan)
199 */ 203 */
200void snd_emux_timer_callback(unsigned long data) 204void snd_emux_timer_callback(unsigned long data)
201{ 205{
202 snd_emux_t *emu = (snd_emux_t*) data; 206 struct snd_emux *emu = (struct snd_emux *) data;
203 snd_emux_voice_t *vp; 207 struct snd_emux_voice *vp;
204 int ch, do_again = 0; 208 int ch, do_again = 0;
205 209
206 spin_lock(&emu->voice_lock); 210 spin_lock(&emu->voice_lock);
@@ -228,13 +232,13 @@ void snd_emux_timer_callback(unsigned long data)
228 * key pressure change 232 * key pressure change
229 */ 233 */
230void 234void
231snd_emux_key_press(void *p, int note, int vel, snd_midi_channel_t *chan) 235snd_emux_key_press(void *p, int note, int vel, struct snd_midi_channel *chan)
232{ 236{
233 int ch; 237 int ch;
234 snd_emux_t *emu; 238 struct snd_emux *emu;
235 snd_emux_voice_t *vp; 239 struct snd_emux_voice *vp;
236 unsigned long flags; 240 unsigned long flags;
237 snd_emux_port_t *port; 241 struct snd_emux_port *port;
238 242
239 port = p; 243 port = p;
240 snd_assert(port != NULL && chan != NULL, return); 244 snd_assert(port != NULL && chan != NULL, return);
@@ -260,10 +264,10 @@ snd_emux_key_press(void *p, int note, int vel, snd_midi_channel_t *chan)
260 * Modulate the voices which belong to the channel 264 * Modulate the voices which belong to the channel
261 */ 265 */
262void 266void
263snd_emux_update_channel(snd_emux_port_t *port, snd_midi_channel_t *chan, int update) 267snd_emux_update_channel(struct snd_emux_port *port, struct snd_midi_channel *chan, int update)
264{ 268{
265 snd_emux_t *emu; 269 struct snd_emux *emu;
266 snd_emux_voice_t *vp; 270 struct snd_emux_voice *vp;
267 int i; 271 int i;
268 unsigned long flags; 272 unsigned long flags;
269 273
@@ -287,10 +291,10 @@ snd_emux_update_channel(snd_emux_port_t *port, snd_midi_channel_t *chan, int upd
287 * Modulate all the voices which belong to the port. 291 * Modulate all the voices which belong to the port.
288 */ 292 */
289void 293void
290snd_emux_update_port(snd_emux_port_t *port, int update) 294snd_emux_update_port(struct snd_emux_port *port, int update)
291{ 295{
292 snd_emux_t *emu; 296 struct snd_emux *emu;
293 snd_emux_voice_t *vp; 297 struct snd_emux_voice *vp;
294 int i; 298 int i;
295 unsigned long flags; 299 unsigned long flags;
296 300
@@ -316,9 +320,9 @@ snd_emux_update_port(snd_emux_port_t *port, int update)
316 * control events, not just the midi controllers 320 * control events, not just the midi controllers
317 */ 321 */
318void 322void
319snd_emux_control(void *p, int type, snd_midi_channel_t *chan) 323snd_emux_control(void *p, int type, struct snd_midi_channel *chan)
320{ 324{
321 snd_emux_port_t *port; 325 struct snd_emux_port *port;
322 326
323 port = p; 327 port = p;
324 snd_assert(port != NULL && chan != NULL, return); 328 snd_assert(port != NULL && chan != NULL, return);
@@ -364,10 +368,10 @@ snd_emux_control(void *p, int type, snd_midi_channel_t *chan)
364 * terminate note - if free flag is true, free the terminated voice 368 * terminate note - if free flag is true, free the terminated voice
365 */ 369 */
366static void 370static void
367terminate_note1(snd_emux_t *emu, int note, snd_midi_channel_t *chan, int free) 371terminate_note1(struct snd_emux *emu, int note, struct snd_midi_channel *chan, int free)
368{ 372{
369 int i; 373 int i;
370 snd_emux_voice_t *vp; 374 struct snd_emux_voice *vp;
371 unsigned long flags; 375 unsigned long flags;
372 376
373 spin_lock_irqsave(&emu->voice_lock, flags); 377 spin_lock_irqsave(&emu->voice_lock, flags);
@@ -385,10 +389,10 @@ terminate_note1(snd_emux_t *emu, int note, snd_midi_channel_t *chan, int free)
385 * terminate note - exported for midi emulation 389 * terminate note - exported for midi emulation
386 */ 390 */
387void 391void
388snd_emux_terminate_note(void *p, int note, snd_midi_channel_t *chan) 392snd_emux_terminate_note(void *p, int note, struct snd_midi_channel *chan)
389{ 393{
390 snd_emux_t *emu; 394 struct snd_emux *emu;
391 snd_emux_port_t *port; 395 struct snd_emux_port *port;
392 396
393 port = p; 397 port = p;
394 snd_assert(port != NULL && chan != NULL, return); 398 snd_assert(port != NULL && chan != NULL, return);
@@ -405,10 +409,10 @@ snd_emux_terminate_note(void *p, int note, snd_midi_channel_t *chan)
405 * Terminate all the notes 409 * Terminate all the notes
406 */ 410 */
407void 411void
408snd_emux_terminate_all(snd_emux_t *emu) 412snd_emux_terminate_all(struct snd_emux *emu)
409{ 413{
410 int i; 414 int i;
411 snd_emux_voice_t *vp; 415 struct snd_emux_voice *vp;
412 unsigned long flags; 416 unsigned long flags;
413 417
414 spin_lock_irqsave(&emu->voice_lock, flags); 418 spin_lock_irqsave(&emu->voice_lock, flags);
@@ -434,11 +438,11 @@ snd_emux_terminate_all(snd_emux_t *emu)
434 * Terminate all voices associated with the given port 438 * Terminate all voices associated with the given port
435 */ 439 */
436void 440void
437snd_emux_sounds_off_all(snd_emux_port_t *port) 441snd_emux_sounds_off_all(struct snd_emux_port *port)
438{ 442{
439 int i; 443 int i;
440 snd_emux_t *emu; 444 struct snd_emux *emu;
441 snd_emux_voice_t *vp; 445 struct snd_emux_voice *vp;
442 unsigned long flags; 446 unsigned long flags;
443 447
444 snd_assert(port != NULL, return); 448 snd_assert(port != NULL, return);
@@ -468,9 +472,9 @@ snd_emux_sounds_off_all(snd_emux_port_t *port)
468 * is mainly for drums. 472 * is mainly for drums.
469 */ 473 */
470static void 474static void
471exclusive_note_off(snd_emux_t *emu, snd_emux_port_t *port, int exclass) 475exclusive_note_off(struct snd_emux *emu, struct snd_emux_port *port, int exclass)
472{ 476{
473 snd_emux_voice_t *vp; 477 struct snd_emux_voice *vp;
474 int i; 478 int i;
475 unsigned long flags; 479 unsigned long flags;
476 480
@@ -490,7 +494,7 @@ exclusive_note_off(snd_emux_t *emu, snd_emux_port_t *port, int exclass)
490 * if free flag is true, call free_voice after termination 494 * if free flag is true, call free_voice after termination
491 */ 495 */
492static void 496static void
493terminate_voice(snd_emux_t *emu, snd_emux_voice_t *vp, int free) 497terminate_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int free)
494{ 498{
495 emu->ops.terminate(vp); 499 emu->ops.terminate(vp);
496 vp->time = emu->use_time++; 500 vp->time = emu->use_time++;
@@ -508,7 +512,7 @@ terminate_voice(snd_emux_t *emu, snd_emux_voice_t *vp, int free)
508 * Modulate the voice 512 * Modulate the voice
509 */ 513 */
510static void 514static void
511update_voice(snd_emux_t *emu, snd_emux_voice_t *vp, int update) 515update_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int update)
512{ 516{
513 if (!STATE_IS_PLAYING(vp->state)) 517 if (!STATE_IS_PLAYING(vp->state))
514 return; 518 return;
@@ -543,9 +547,9 @@ static unsigned short voltarget[16] = {
543 * will be needed later. 547 * will be needed later.
544 */ 548 */
545static void 549static void
546setup_voice(snd_emux_voice_t *vp) 550setup_voice(struct snd_emux_voice *vp)
547{ 551{
548 soundfont_voice_parm_t *parm; 552 struct soundfont_voice_parm *parm;
549 int pitch; 553 int pitch;
550 554
551 /* copy the original register values */ 555 /* copy the original register values */
@@ -636,9 +640,9 @@ static unsigned char pan_volumes[256] = {
636}; 640};
637 641
638static int 642static int
639calc_pan(snd_emux_voice_t *vp) 643calc_pan(struct snd_emux_voice *vp)
640{ 644{
641 snd_midi_channel_t *chan = vp->chan; 645 struct snd_midi_channel *chan = vp->chan;
642 int pan; 646 int pan;
643 647
644 /* pan & loop start (pan 8bit, MSB, 0:right, 0xff:left) */ 648 /* pan & loop start (pan 8bit, MSB, 0:right, 0xff:left) */
@@ -737,12 +741,12 @@ static unsigned char expressiontab[128] = {
737 * voice and channels parameters. 741 * voice and channels parameters.
738 */ 742 */
739static int 743static int
740calc_volume(snd_emux_voice_t *vp) 744calc_volume(struct snd_emux_voice *vp)
741{ 745{
742 int vol; 746 int vol;
743 int main_vol, expression_vol, master_vol; 747 int main_vol, expression_vol, master_vol;
744 snd_midi_channel_t *chan = vp->chan; 748 struct snd_midi_channel *chan = vp->chan;
745 snd_emux_port_t *port = vp->port; 749 struct snd_emux_port *port = vp->port;
746 750
747 expression_vol = chan->control[MIDI_CTL_MSB_EXPRESSION]; 751 expression_vol = chan->control[MIDI_CTL_MSB_EXPRESSION];
748 LIMITMAX(vp->velocity, 127); 752 LIMITMAX(vp->velocity, 127);
@@ -775,7 +779,7 @@ calc_volume(snd_emux_voice_t *vp)
775 779
776#ifdef SNDRV_EMUX_USE_RAW_EFFECT 780#ifdef SNDRV_EMUX_USE_RAW_EFFECT
777 if (chan->private) { 781 if (chan->private) {
778 snd_emux_effect_table_t *fx = chan->private; 782 struct snd_emux_effect_table *fx = chan->private;
779 vol += fx->val[EMUX_FX_ATTEN]; 783 vol += fx->val[EMUX_FX_ATTEN];
780 } 784 }
781#endif 785#endif
@@ -808,9 +812,9 @@ calc_volume(snd_emux_voice_t *vp)
808 */ 812 */
809 813
810static int 814static int
811calc_pitch(snd_emux_voice_t *vp) 815calc_pitch(struct snd_emux_voice *vp)
812{ 816{
813 snd_midi_channel_t *chan = vp->chan; 817 struct snd_midi_channel *chan = vp->chan;
814 int offset; 818 int offset;
815 819
816 /* calculate offset */ 820 /* calculate offset */
@@ -837,7 +841,7 @@ calc_pitch(snd_emux_voice_t *vp)
837#ifdef SNDRV_EMUX_USE_RAW_EFFECT 841#ifdef SNDRV_EMUX_USE_RAW_EFFECT
838 /* add initial pitch correction */ 842 /* add initial pitch correction */
839 if (chan->private) { 843 if (chan->private) {
840 snd_emux_effect_table_t *fx = chan->private; 844 struct snd_emux_effect_table *fx = chan->private;
841 if (fx->flag[EMUX_FX_INIT_PITCH]) 845 if (fx->flag[EMUX_FX_INIT_PITCH])
842 offset += fx->val[EMUX_FX_INIT_PITCH]; 846 offset += fx->val[EMUX_FX_INIT_PITCH];
843 } 847 }
@@ -857,7 +861,7 @@ calc_pitch(snd_emux_voice_t *vp)
857 * Get the bank number assigned to the channel 861 * Get the bank number assigned to the channel
858 */ 862 */
859static int 863static int
860get_bank(snd_emux_port_t *port, snd_midi_channel_t *chan) 864get_bank(struct snd_emux_port *port, struct snd_midi_channel *chan)
861{ 865{
862 int val; 866 int val;
863 867
@@ -886,8 +890,9 @@ get_bank(snd_emux_port_t *port, snd_midi_channel_t *chan)
886 * The resultant zones are stored on table. 890 * The resultant zones are stored on table.
887 */ 891 */
888static int 892static int
889get_zone(snd_emux_t *emu, snd_emux_port_t *port, 893get_zone(struct snd_emux *emu, struct snd_emux_port *port,
890 int *notep, int vel, snd_midi_channel_t *chan, snd_sf_zone_t **table) 894 int *notep, int vel, struct snd_midi_channel *chan,
895 struct snd_sf_zone **table)
891{ 896{
892 int preset, bank, def_preset, def_bank; 897 int preset, bank, def_preset, def_bank;
893 898
@@ -910,9 +915,9 @@ get_zone(snd_emux_t *emu, snd_emux_port_t *port,
910/* 915/*
911 */ 916 */
912void 917void
913snd_emux_init_voices(snd_emux_t *emu) 918snd_emux_init_voices(struct snd_emux *emu)
914{ 919{
915 snd_emux_voice_t *vp; 920 struct snd_emux_voice *vp;
916 int i; 921 int i;
917 unsigned long flags; 922 unsigned long flags;
918 923
@@ -932,7 +937,7 @@ snd_emux_init_voices(snd_emux_t *emu)
932 937
933/* 938/*
934 */ 939 */
935void snd_emux_lock_voice(snd_emux_t *emu, int voice) 940void snd_emux_lock_voice(struct snd_emux *emu, int voice)
936{ 941{
937 unsigned long flags; 942 unsigned long flags;
938 943
@@ -947,7 +952,7 @@ void snd_emux_lock_voice(snd_emux_t *emu, int voice)
947 952
948/* 953/*
949 */ 954 */
950void snd_emux_unlock_voice(snd_emux_t *emu, int voice) 955void snd_emux_unlock_voice(struct snd_emux *emu, int voice)
951{ 956{
952 unsigned long flags; 957 unsigned long flags;
953 958