aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound/emux_synth.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/sound/emux_synth.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/sound/emux_synth.h')
-rw-r--r--include/sound/emux_synth.h243
1 files changed, 243 insertions, 0 deletions
diff --git a/include/sound/emux_synth.h b/include/sound/emux_synth.h
new file mode 100644
index 000000000000..c6970aac9bdc
--- /dev/null
+++ b/include/sound/emux_synth.h
@@ -0,0 +1,243 @@
1#ifndef __SOUND_EMUX_SYNTH_H
2#define __SOUND_EMUX_SYNTH_H
3
4/*
5 * Defines for the Emu-series WaveTable chip
6 *
7 * Copyright (C) 2000 Takashi Iwai <tiwai@suse.de>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#include "seq_kernel.h"
25#include "seq_device.h"
26#include "soundfont.h"
27#include "seq_midi_emul.h"
28#ifdef CONFIG_SND_SEQUENCER_OSS
29#include "seq_oss.h"
30#endif
31#include "emux_legacy.h"
32#include "seq_virmidi.h"
33
34/*
35 * compile flags
36 */
37#define SNDRV_EMUX_USE_RAW_EFFECT
38
39
40/*
41 * typedefs
42 */
43typedef struct snd_emux_effect_table snd_emux_effect_table_t;
44typedef struct snd_emux_port snd_emux_port_t;
45typedef struct snd_emux_voice snd_emux_voice_t;
46typedef struct snd_emux snd_emux_t;
47
48
49/*
50 * operators
51 */
52typedef struct snd_emux_operators {
53 struct module *owner;
54 snd_emux_voice_t *(*get_voice)(snd_emux_t *emu, snd_emux_port_t *port);
55 int (*prepare)(snd_emux_voice_t *vp);
56 void (*trigger)(snd_emux_voice_t *vp);
57 void (*release)(snd_emux_voice_t *vp);
58 void (*update)(snd_emux_voice_t *vp, int update);
59 void (*terminate)(snd_emux_voice_t *vp);
60 void (*free_voice)(snd_emux_voice_t *vp);
61 void (*reset)(snd_emux_t *emu, int ch);
62 /* the first parameters are snd_emux_t */
63 int (*sample_new)(snd_emux_t *emu, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr, const void __user *data, long count);
64 int (*sample_free)(snd_emux_t *emu, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr);
65 void (*sample_reset)(snd_emux_t *emu);
66 int (*load_fx)(snd_emux_t *emu, int type, int arg, const void __user *data, long count);
67 void (*sysex)(snd_emux_t *emu, char *buf, int len, int parsed, snd_midi_channel_set_t *chset);
68#ifdef CONFIG_SND_SEQUENCER_OSS
69 int (*oss_ioctl)(snd_emux_t *emu, int cmd, int p1, int p2);
70#endif
71} snd_emux_operators_t;
72
73
74/*
75 * constant values
76 */
77#define SNDRV_EMUX_MAX_PORTS 32 /* max # of sequencer ports */
78#define SNDRV_EMUX_MAX_VOICES 64 /* max # of voices */
79#define SNDRV_EMUX_MAX_MULTI_VOICES 16 /* max # of playable voices
80 * simultineously
81 */
82
83/*
84 * flags
85 */
86#define SNDRV_EMUX_ACCEPT_ROM (1<<0)
87
88/*
89 * emuX wavetable
90 */
91struct snd_emux {
92
93 snd_card_t *card; /* assigned card */
94
95 /* following should be initialized before registration */
96 int max_voices; /* Number of voices */
97 int mem_size; /* memory size (in byte) */
98 int num_ports; /* number of ports to be created */
99 int pitch_shift; /* pitch shift value (for Emu10k1) */
100 snd_emux_operators_t ops; /* operators */
101 void *hw; /* hardware */
102 unsigned long flags; /* other conditions */
103 int midi_ports; /* number of virtual midi devices */
104 int midi_devidx; /* device offset of virtual midi */
105 unsigned int linear_panning: 1; /* panning is linear (sbawe = 1, emu10k1 = 0) */
106 int hwdep_idx; /* hwdep device index */
107 snd_hwdep_t *hwdep; /* hwdep device */
108
109 /* private */
110 int num_voices; /* current number of voices */
111 snd_sf_list_t *sflist; /* root of SoundFont list */
112 snd_emux_voice_t *voices; /* Voices (EMU 'channel') */
113 int use_time; /* allocation counter */
114 spinlock_t voice_lock; /* Lock for voice access */
115 struct semaphore register_mutex;
116 int client; /* For the sequencer client */
117 int ports[SNDRV_EMUX_MAX_PORTS]; /* The ports for this device */
118 snd_emux_port_t *portptrs[SNDRV_EMUX_MAX_PORTS];
119 int used; /* use counter */
120 char *name; /* name of the device (internal) */
121 snd_rawmidi_t **vmidi;
122 struct timer_list tlist; /* for pending note-offs */
123 int timer_active;
124
125 snd_util_memhdr_t *memhdr; /* memory chunk information */
126
127#ifdef CONFIG_PROC_FS
128 snd_info_entry_t *proc;
129#endif
130
131#ifdef CONFIG_SND_SEQUENCER_OSS
132 snd_seq_device_t *oss_synth;
133#endif
134};
135
136
137/*
138 * sequencer port information
139 */
140struct snd_emux_port {
141
142 snd_midi_channel_set_t chset;
143 snd_emux_t *emu;
144
145 char port_mode; /* operation mode */
146 int volume_atten; /* emuX raw attenuation */
147 unsigned long drum_flags; /* drum bitmaps */
148 int ctrls[EMUX_MD_END]; /* control parameters */
149#ifdef SNDRV_EMUX_USE_RAW_EFFECT
150 snd_emux_effect_table_t *effect;
151#endif
152#ifdef CONFIG_SND_SEQUENCER_OSS
153 snd_seq_oss_arg_t *oss_arg;
154#endif
155};
156
157/* port_mode */
158#define SNDRV_EMUX_PORT_MODE_MIDI 0 /* normal MIDI port */
159#define SNDRV_EMUX_PORT_MODE_OSS_SYNTH 1 /* OSS synth port */
160#define SNDRV_EMUX_PORT_MODE_OSS_MIDI 2 /* OSS multi channel synth port */
161
162/*
163 * A structure to keep track of each hardware voice
164 */
165struct snd_emux_voice {
166 int ch; /* Hardware channel number */
167
168 int state; /* status */
169#define SNDRV_EMUX_ST_OFF 0x00 /* Not playing, and inactive */
170#define SNDRV_EMUX_ST_ON 0x01 /* Note on */
171#define SNDRV_EMUX_ST_RELEASED (0x02|SNDRV_EMUX_ST_ON) /* Note released */
172#define SNDRV_EMUX_ST_SUSTAINED (0x04|SNDRV_EMUX_ST_ON) /* Note sustained */
173#define SNDRV_EMUX_ST_STANDBY (0x08|SNDRV_EMUX_ST_ON) /* Waiting to be triggered */
174#define SNDRV_EMUX_ST_PENDING (0x10|SNDRV_EMUX_ST_ON) /* Note will be released */
175#define SNDRV_EMUX_ST_LOCKED 0x100 /* Not accessible */
176
177 unsigned int time; /* An allocation time */
178 unsigned char note; /* Note currently assigned to this voice */
179 unsigned char key;
180 unsigned char velocity; /* Velocity of current note */
181
182 snd_sf_zone_t *zone; /* Zone assigned to this note */
183 void *block; /* sample block pointer (optional) */
184 snd_midi_channel_t *chan; /* Midi channel for this note */
185 snd_emux_port_t *port; /* associated port */
186 snd_emux_t *emu; /* assigned root info */
187 void *hw; /* hardware pointer (emu8000_t or emu10k1_t) */
188 unsigned long ontime; /* jiffies at note triggered */
189
190 /* Emu8k/Emu10k1 registers */
191 soundfont_voice_info_t reg;
192
193 /* additional registers */
194 int avol; /* volume attenuation */
195 int acutoff; /* cutoff target */
196 int apitch; /* pitch offset */
197 int apan; /* pan/aux pair */
198 int aaux;
199 int ptarget; /* pitch target */
200 int vtarget; /* volume target */
201 int ftarget; /* filter target */
202
203};
204
205/*
206 * update flags (can be combined)
207 */
208#define SNDRV_EMUX_UPDATE_VOLUME (1<<0)
209#define SNDRV_EMUX_UPDATE_PITCH (1<<1)
210#define SNDRV_EMUX_UPDATE_PAN (1<<2)
211#define SNDRV_EMUX_UPDATE_FMMOD (1<<3)
212#define SNDRV_EMUX_UPDATE_TREMFREQ (1<<4)
213#define SNDRV_EMUX_UPDATE_FM2FRQ2 (1<<5)
214#define SNDRV_EMUX_UPDATE_Q (1<<6)
215
216
217#ifdef SNDRV_EMUX_USE_RAW_EFFECT
218/*
219 * effect table
220 */
221struct snd_emux_effect_table {
222 /* Emu8000 specific effects */
223 short val[EMUX_NUM_EFFECTS];
224 unsigned char flag[EMUX_NUM_EFFECTS];
225};
226#endif /* SNDRV_EMUX_USE_RAW_EFFECT */
227
228
229/*
230 * prototypes - interface to Emu10k1 and Emu8k routines
231 */
232int snd_emux_new(snd_emux_t **remu);
233int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name);
234int snd_emux_free(snd_emux_t *emu);
235
236/*
237 * exported functions
238 */
239void snd_emux_terminate_all(snd_emux_t *emu);
240void snd_emux_lock_voice(snd_emux_t *emu, int voice);
241void snd_emux_unlock_voice(snd_emux_t *emu, int voice);
242
243#endif /* __SOUND_EMUX_SYNTH_H */