Loading include/sound/emux_synth.h +53 −52 Original line number Diff line number Diff line Loading @@ -36,39 +36,40 @@ */ #define SNDRV_EMUX_USE_RAW_EFFECT /* * typedefs */ typedef struct snd_emux_effect_table snd_emux_effect_table_t; typedef struct snd_emux_port snd_emux_port_t; typedef struct snd_emux_voice snd_emux_voice_t; typedef struct snd_emux snd_emux_t; struct snd_emux; struct snd_emux_port; struct snd_emux_voice; struct snd_emux_effect_table; /* * operators */ typedef struct snd_emux_operators { struct snd_emux_operators { struct module *owner; snd_emux_voice_t *(*get_voice)(snd_emux_t *emu, snd_emux_port_t *port); int (*prepare)(snd_emux_voice_t *vp); void (*trigger)(snd_emux_voice_t *vp); void (*release)(snd_emux_voice_t *vp); void (*update)(snd_emux_voice_t *vp, int update); void (*terminate)(snd_emux_voice_t *vp); void (*free_voice)(snd_emux_voice_t *vp); void (*reset)(snd_emux_t *emu, int ch); /* the first parameters are snd_emux_t */ int (*sample_new)(snd_emux_t *emu, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr, const void __user *data, long count); int (*sample_free)(snd_emux_t *emu, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr); void (*sample_reset)(snd_emux_t *emu); int (*load_fx)(snd_emux_t *emu, int type, int arg, const void __user *data, long count); void (*sysex)(snd_emux_t *emu, char *buf, int len, int parsed, snd_midi_channel_set_t *chset); struct snd_emux_voice *(*get_voice)(struct snd_emux *emu, struct snd_emux_port *port); int (*prepare)(struct snd_emux_voice *vp); void (*trigger)(struct snd_emux_voice *vp); void (*release)(struct snd_emux_voice *vp); void (*update)(struct snd_emux_voice *vp, int update); void (*terminate)(struct snd_emux_voice *vp); void (*free_voice)(struct snd_emux_voice *vp); void (*reset)(struct snd_emux *emu, int ch); /* the first parameters are struct snd_emux */ int (*sample_new)(struct snd_emux *emu, struct snd_sf_sample *sp, struct snd_util_memhdr *hdr, const void __user *data, long count); int (*sample_free)(struct snd_emux *emu, struct snd_sf_sample *sp, struct snd_util_memhdr *hdr); void (*sample_reset)(struct snd_emux *emu); int (*load_fx)(struct snd_emux *emu, int type, int arg, const void __user *data, long count); void (*sysex)(struct snd_emux *emu, char *buf, int len, int parsed, struct snd_midi_channel_set *chset); #ifdef CONFIG_SND_SEQUENCER_OSS int (*oss_ioctl)(snd_emux_t *emu, int cmd, int p1, int p2); int (*oss_ioctl)(struct snd_emux *emu, int cmd, int p1, int p2); #endif } snd_emux_operators_t; }; /* Loading @@ -90,46 +91,46 @@ typedef struct snd_emux_operators { */ struct snd_emux { snd_card_t *card; /* assigned card */ struct snd_card *card; /* assigned card */ /* following should be initialized before registration */ int max_voices; /* Number of voices */ int mem_size; /* memory size (in byte) */ int num_ports; /* number of ports to be created */ int pitch_shift; /* pitch shift value (for Emu10k1) */ snd_emux_operators_t ops; /* operators */ struct snd_emux_operators ops; /* operators */ void *hw; /* hardware */ unsigned long flags; /* other conditions */ int midi_ports; /* number of virtual midi devices */ int midi_devidx; /* device offset of virtual midi */ unsigned int linear_panning: 1; /* panning is linear (sbawe = 1, emu10k1 = 0) */ int hwdep_idx; /* hwdep device index */ snd_hwdep_t *hwdep; /* hwdep device */ struct snd_hwdep *hwdep; /* hwdep device */ /* private */ int num_voices; /* current number of voices */ snd_sf_list_t *sflist; /* root of SoundFont list */ snd_emux_voice_t *voices; /* Voices (EMU 'channel') */ struct snd_sf_list *sflist; /* root of SoundFont list */ struct snd_emux_voice *voices; /* Voices (EMU 'channel') */ int use_time; /* allocation counter */ spinlock_t voice_lock; /* Lock for voice access */ struct semaphore register_mutex; int client; /* For the sequencer client */ int ports[SNDRV_EMUX_MAX_PORTS]; /* The ports for this device */ snd_emux_port_t *portptrs[SNDRV_EMUX_MAX_PORTS]; struct snd_emux_port *portptrs[SNDRV_EMUX_MAX_PORTS]; int used; /* use counter */ char *name; /* name of the device (internal) */ snd_rawmidi_t **vmidi; struct snd_rawmidi **vmidi; struct timer_list tlist; /* for pending note-offs */ int timer_active; snd_util_memhdr_t *memhdr; /* memory chunk information */ struct snd_util_memhdr *memhdr; /* memory chunk information */ #ifdef CONFIG_PROC_FS snd_info_entry_t *proc; struct snd_info_entry *proc; #endif #ifdef CONFIG_SND_SEQUENCER_OSS snd_seq_device_t *oss_synth; struct snd_seq_device *oss_synth; #endif }; Loading @@ -139,18 +140,18 @@ struct snd_emux { */ struct snd_emux_port { snd_midi_channel_set_t chset; snd_emux_t *emu; struct snd_midi_channel_set chset; struct snd_emux *emu; char port_mode; /* operation mode */ int volume_atten; /* emuX raw attenuation */ unsigned long drum_flags; /* drum bitmaps */ int ctrls[EMUX_MD_END]; /* control parameters */ #ifdef SNDRV_EMUX_USE_RAW_EFFECT snd_emux_effect_table_t *effect; struct snd_emux_effect_table *effect; #endif #ifdef CONFIG_SND_SEQUENCER_OSS snd_seq_oss_arg_t *oss_arg; struct snd_seq_oss_arg *oss_arg; #endif }; Loading Loading @@ -179,16 +180,16 @@ struct snd_emux_voice { unsigned char key; unsigned char velocity; /* Velocity of current note */ snd_sf_zone_t *zone; /* Zone assigned to this note */ struct snd_sf_zone *zone; /* Zone assigned to this note */ void *block; /* sample block pointer (optional) */ snd_midi_channel_t *chan; /* Midi channel for this note */ snd_emux_port_t *port; /* associated port */ snd_emux_t *emu; /* assigned root info */ void *hw; /* hardware pointer (emu8000_t or emu10k1_t) */ struct snd_midi_channel *chan; /* Midi channel for this note */ struct snd_emux_port *port; /* associated port */ struct snd_emux *emu; /* assigned root info */ void *hw; /* hardware pointer (emu8000 or emu10k1) */ unsigned long ontime; /* jiffies at note triggered */ /* Emu8k/Emu10k1 registers */ soundfont_voice_info_t reg; struct soundfont_voice_info reg; /* additional registers */ int avol; /* volume attenuation */ Loading Loading @@ -229,15 +230,15 @@ struct snd_emux_effect_table { /* * prototypes - interface to Emu10k1 and Emu8k routines */ int snd_emux_new(snd_emux_t **remu); int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name); int snd_emux_free(snd_emux_t *emu); int snd_emux_new(struct snd_emux **remu); int snd_emux_register(struct snd_emux *emu, struct snd_card *card, int index, char *name); int snd_emux_free(struct snd_emux *emu); /* * exported functions */ void snd_emux_terminate_all(snd_emux_t *emu); void snd_emux_lock_voice(snd_emux_t *emu, int voice); void snd_emux_unlock_voice(snd_emux_t *emu, int voice); void snd_emux_terminate_all(struct snd_emux *emu); void snd_emux_lock_voice(struct snd_emux *emu, int voice); void snd_emux_unlock_voice(struct snd_emux *emu, int voice); #endif /* __SOUND_EMUX_SYNTH_H */ include/sound/sfnt_info.h +18 −18 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ #endif /* patch interface header: 16 bytes */ typedef struct soundfont_patch_info_t { struct soundfont_patch_info { unsigned short key; /* use the key below */ #define SNDRV_OSS_SOUNDFONT_PATCH SNDRV_OSS_PATCHKEY(0x07) Loading @@ -59,7 +59,7 @@ typedef struct soundfont_patch_info_t { short reserved; /* word alignment data */ /* the actual patch data begins after this */ } soundfont_patch_info_t; }; /* Loading @@ -68,7 +68,7 @@ typedef struct soundfont_patch_info_t { #define SNDRV_SFNT_PATCH_NAME_LEN 32 typedef struct soundfont_open_parm_t { struct soundfont_open_parm { unsigned short type; /* sample type */ #define SNDRV_SFNT_PAT_TYPE_MISC 0 #define SNDRV_SFNT_PAT_TYPE_GUS 6 Loading @@ -78,7 +78,7 @@ typedef struct soundfont_open_parm_t { short reserved; char name[SNDRV_SFNT_PATCH_NAME_LEN]; } soundfont_open_parm_t; }; /* Loading @@ -86,7 +86,7 @@ typedef struct soundfont_open_parm_t { */ /* wave table envelope & effect parameters to control EMU8000 */ typedef struct soundfont_voice_parm_t { struct soundfont_voice_parm { unsigned short moddelay; /* modulation delay (0x8000) */ unsigned short modatkhld; /* modulation attack & hold time (0x7f7f) */ unsigned short moddcysus; /* modulation decay & sustain (0x7f7f) */ Loading @@ -108,11 +108,11 @@ typedef struct soundfont_voice_parm_t { unsigned char chorus; /* chorus send (0x00) */ unsigned char reverb; /* reverb send (0x00) */ unsigned short reserved[4]; /* not used */ } soundfont_voice_parm_t; }; /* wave table parameters: 92 bytes */ typedef struct soundfont_voice_info_t { struct soundfont_voice_info { unsigned short sf_id; /* file id (should be zero) */ unsigned short sample; /* sample id */ int start, end; /* sample offset correction */ Loading @@ -135,13 +135,13 @@ typedef struct soundfont_voice_info_t { unsigned char amplitude; /* sample volume (127 max) */ unsigned char attenuation; /* attenuation (0.375dB) */ short scaleTuning; /* pitch scale tuning(%), normally 100 */ soundfont_voice_parm_t parm; /* voice envelope parameters */ struct soundfont_voice_parm parm; /* voice envelope parameters */ unsigned short sample_mode; /* sample mode_flag (set by driver) */ } soundfont_voice_info_t; }; /* instrument info header: 4 bytes */ typedef struct soundfont_voice_rec_hdr_t { struct soundfont_voice_rec_hdr { unsigned char bank; /* midi bank number */ unsigned char instr; /* midi preset number */ char nvoices; /* number of voices */ Loading @@ -149,7 +149,7 @@ typedef struct soundfont_voice_rec_hdr_t { #define SNDRV_SFNT_WR_APPEND 0 /* append anyway */ #define SNDRV_SFNT_WR_EXCLUSIVE 1 /* skip if already exists */ #define SNDRV_SFNT_WR_REPLACE 2 /* replace if already exists */ } soundfont_voice_rec_hdr_t; }; /* Loading @@ -157,7 +157,7 @@ typedef struct soundfont_voice_rec_hdr_t { */ /* wave table sample header: 32 bytes */ typedef struct soundfont_sample_info_t { struct soundfont_sample_info { unsigned short sf_id; /* file id (should be zero) */ unsigned short sample; /* sample id */ int start, end; /* start & end offset */ Loading @@ -174,17 +174,17 @@ typedef struct soundfont_sample_info_t { #define SNDRV_SFNT_SAMPLE_STEREO_RIGHT 64 /* stereo right sound */ #define SNDRV_SFNT_SAMPLE_REVERSE_LOOP 128 /* reverse looping */ unsigned int truesize; /* used memory size (set by driver) */ } soundfont_sample_info_t; }; /* * voice preset mapping (aliasing) */ typedef struct soundfont_voice_map_t { struct soundfont_voice_map { int map_bank, map_instr, map_key; /* key = -1 means all keys */ int src_bank, src_instr, src_key; } soundfont_voice_map_t; }; /* Loading @@ -195,7 +195,7 @@ typedef struct soundfont_voice_map_t { #define SNDRV_EMUX_VERSION ((1 << 16) | (0 << 8) | 0) /* 1.0.0 */ struct sndrv_emux_misc_mode { struct snd_emux_misc_mode { int port; /* -1 = all */ int mode; int value; Loading @@ -204,11 +204,11 @@ struct sndrv_emux_misc_mode { enum { SNDRV_EMUX_IOCTL_VERSION = _IOR('H', 0x80, unsigned int), SNDRV_EMUX_IOCTL_LOAD_PATCH = _IOWR('H', 0x81, soundfont_patch_info_t), SNDRV_EMUX_IOCTL_LOAD_PATCH = _IOWR('H', 0x81, struct soundfont_patch_info), SNDRV_EMUX_IOCTL_RESET_SAMPLES = _IO('H', 0x82), SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES = _IO('H', 0x83), SNDRV_EMUX_IOCTL_MEM_AVAIL = _IOW('H', 0x84, int), SNDRV_EMUX_IOCTL_MISC_MODE = _IOWR('H', 0x84, struct sndrv_emux_misc_mode), SNDRV_EMUX_IOCTL_MISC_MODE = _IOWR('H', 0x84, struct snd_emux_misc_mode), }; #endif /* __SOUND_SFNT_INFO_H */ include/sound/soundfont.h +37 −38 Original line number Diff line number Diff line Loading @@ -29,94 +29,93 @@ #define SF_MAX_PRESETS 256 /* drums are mapped from 128 to 256 */ #define SF_IS_DRUM_BANK(z) ((z) == 128) typedef struct snd_sf_zone { struct snd_sf_zone { struct snd_sf_zone *next; /* Link to next */ unsigned char bank; /* Midi bank for this zone */ unsigned char instr; /* Midi program for this zone */ unsigned char mapped; /* True if mapped to something else */ soundfont_voice_info_t v; /* All the soundfont parameters */ struct soundfont_voice_info v; /* All the soundfont parameters */ int counter; struct snd_sf_sample *sample; /* Link to sample */ /* The following deals with preset numbers (programs) */ struct snd_sf_zone *next_instr; /* Next zone of this instrument */ struct snd_sf_zone *next_zone; /* Next zone in play list */ } snd_sf_zone_t; }; typedef struct snd_sf_sample { soundfont_sample_info_t v; struct snd_sf_sample { struct soundfont_sample_info v; int counter; snd_util_memblk_t *block; /* allocated data block */ struct snd_util_memblk *block; /* allocated data block */ struct snd_sf_sample *next; } snd_sf_sample_t; }; /* * This represents all the information relating to a soundfont. */ typedef struct snd_soundfont { struct snd_soundfont { struct snd_soundfont *next; /* Link to next */ /*struct snd_soundfont *prev;*/ /* Link to previous */ short id; /* file id */ short type; /* font type */ unsigned char name[SNDRV_SFNT_PATCH_NAME_LEN]; /* identifier */ snd_sf_zone_t *zones; /* Font information */ snd_sf_sample_t *samples; /* The sample headers */ } snd_soundfont_t; struct snd_sf_zone *zones; /* Font information */ struct snd_sf_sample *samples; /* The sample headers */ }; /* * Type of the sample access callback */ typedef int (*snd_sf_sample_new_t)(void *private_data, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr, const void __user *buf, long count); typedef int (*snd_sf_sample_free_t)(void *private_data, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr); typedef void (*snd_sf_sample_reset_t)(void *private); typedef struct snd_sf_callback { struct snd_sf_callback { void *private_data; snd_sf_sample_new_t sample_new; snd_sf_sample_free_t sample_free; snd_sf_sample_reset_t sample_reset; } snd_sf_callback_t; int (*sample_new)(void *private_data, struct snd_sf_sample *sp, struct snd_util_memhdr *hdr, const void __user *buf, long count); int (*sample_free)(void *private_data, struct snd_sf_sample *sp, struct snd_util_memhdr *hdr); void (*sample_reset)(void *private); }; /* * List of soundfonts. */ typedef struct snd_sf_list { snd_soundfont_t *currsf; /* The currently open soundfont */ struct snd_sf_list { struct snd_soundfont *currsf; /* The currently open soundfont */ int open_client; /* client pointer for lock */ int mem_used; /* used memory size */ snd_sf_zone_t *presets[SF_MAX_PRESETS]; snd_soundfont_t *fonts; /* The list of soundfonts */ struct snd_sf_zone *presets[SF_MAX_PRESETS]; struct snd_soundfont *fonts; /* The list of soundfonts */ int fonts_size; /* number of fonts allocated */ int zone_counter; /* last allocated time for zone */ int sample_counter; /* last allocated time for sample */ int zone_locked; /* locked time for zone */ int sample_locked; /* locked time for sample */ snd_sf_callback_t callback; /* callback functions */ struct snd_sf_callback callback; /* callback functions */ int presets_locked; struct semaphore presets_mutex; spinlock_t lock; snd_util_memhdr_t *memhdr; } snd_sf_list_t; struct snd_util_memhdr *memhdr; }; /* Prototypes for soundfont.c */ int snd_soundfont_load(snd_sf_list_t *sflist, const void __user *data, long count, int client); int snd_soundfont_load_guspatch(snd_sf_list_t *sflist, const char __user *data, int snd_soundfont_load(struct snd_sf_list *sflist, const void __user *data, long count, int client); int snd_soundfont_load_guspatch(struct snd_sf_list *sflist, const char __user *data, long count, int client); int snd_soundfont_close_check(snd_sf_list_t *sflist, int client); int snd_soundfont_close_check(struct snd_sf_list *sflist, int client); snd_sf_list_t *snd_sf_new(snd_sf_callback_t *callback, snd_util_memhdr_t *hdr); void snd_sf_free(snd_sf_list_t *sflist); struct snd_sf_list *snd_sf_new(struct snd_sf_callback *callback, struct snd_util_memhdr *hdr); void snd_sf_free(struct snd_sf_list *sflist); int snd_soundfont_remove_samples(snd_sf_list_t *sflist); int snd_soundfont_remove_unlocked(snd_sf_list_t *sflist); int snd_soundfont_remove_samples(struct snd_sf_list *sflist); int snd_soundfont_remove_unlocked(struct snd_sf_list *sflist); int snd_soundfont_search_zone(snd_sf_list_t *sflist, int *notep, int vel, int snd_soundfont_search_zone(struct snd_sf_list *sflist, int *notep, int vel, int preset, int bank, int def_preset, int def_bank, snd_sf_zone_t **table, int max_layers); struct snd_sf_zone **table, int max_layers); /* Parameter conversions */ int snd_sf_calc_parm_hold(int msec); Loading include/sound/util_mem.h +15 −17 Original line number Diff line number Diff line Loading @@ -20,29 +20,25 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ typedef struct snd_util_memblk snd_util_memblk_t; typedef struct snd_util_memhdr snd_util_memhdr_t; typedef unsigned int snd_util_unit_t; /* * memory block */ struct snd_util_memblk { snd_util_unit_t size; /* size of this block */ snd_util_unit_t offset; /* zero-offset of this block */ unsigned int size; /* size of this block */ unsigned int offset; /* zero-offset of this block */ struct list_head list; /* link */ }; #define snd_util_memblk_argptr(blk) (void*)((char*)(blk) + sizeof(snd_util_memblk_t)) #define snd_util_memblk_argptr(blk) (void*)((char*)(blk) + sizeof(struct snd_util_memblk)) /* * memory management information */ struct snd_util_memhdr { snd_util_unit_t size; /* size of whole data */ unsigned int size; /* size of whole data */ struct list_head block; /* block linked-list header */ int nblocks; /* # of allocated blocks */ snd_util_unit_t used; /* used memory size */ unsigned int used; /* used memory size */ int block_extra_size; /* extra data size of chunk */ struct semaphore block_mutex; /* lock */ }; Loading @@ -50,15 +46,17 @@ struct snd_util_memhdr { /* * prototypes */ snd_util_memhdr_t *snd_util_memhdr_new(int memsize); void snd_util_memhdr_free(snd_util_memhdr_t *hdr); snd_util_memblk_t *snd_util_mem_alloc(snd_util_memhdr_t *hdr, int size); int snd_util_mem_free(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk); int snd_util_mem_avail(snd_util_memhdr_t *hdr); struct snd_util_memhdr *snd_util_memhdr_new(int memsize); void snd_util_memhdr_free(struct snd_util_memhdr *hdr); struct snd_util_memblk *snd_util_mem_alloc(struct snd_util_memhdr *hdr, int size); int snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk); int snd_util_mem_avail(struct snd_util_memhdr *hdr); /* functions without mutex */ snd_util_memblk_t *__snd_util_mem_alloc(snd_util_memhdr_t *hdr, int size); void __snd_util_mem_free(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk); snd_util_memblk_t *__snd_util_memblk_new(snd_util_memhdr_t *hdr, snd_util_unit_t units, struct list_head *prev); struct snd_util_memblk *__snd_util_mem_alloc(struct snd_util_memhdr *hdr, int size); void __snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk); struct snd_util_memblk *__snd_util_memblk_new(struct snd_util_memhdr *hdr, unsigned int units, struct list_head *prev); #endif /* __SOUND_UTIL_MEM_H */ sound/synth/emux/emux.c +15 −14 Original line number Diff line number Diff line Loading @@ -35,9 +35,9 @@ MODULE_LICENSE("GPL"); /* * create a new hardware dependent device for Emu8000/Emu10k1 */ int snd_emux_new(snd_emux_t **remu) int snd_emux_new(struct snd_emux **remu) { snd_emux_t *emu; struct snd_emux *emu; *remu = NULL; emu = kzalloc(sizeof(*emu), GFP_KERNEL); Loading Loading @@ -66,33 +66,33 @@ int snd_emux_new(snd_emux_t **remu) /* */ static int sf_sample_new(void *private_data, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr, static int sf_sample_new(void *private_data, struct snd_sf_sample *sp, struct snd_util_memhdr *hdr, const void __user *buf, long count) { snd_emux_t *emu = private_data; struct snd_emux *emu = private_data; return emu->ops.sample_new(emu, sp, hdr, buf, count); } static int sf_sample_free(void *private_data, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr) static int sf_sample_free(void *private_data, struct snd_sf_sample *sp, struct snd_util_memhdr *hdr) { snd_emux_t *emu = private_data; struct snd_emux *emu = private_data; return emu->ops.sample_free(emu, sp, hdr); } static void sf_sample_reset(void *private_data) { snd_emux_t *emu = private_data; struct snd_emux *emu = private_data; emu->ops.sample_reset(emu); } int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name) int snd_emux_register(struct snd_emux *emu, struct snd_card *card, int index, char *name) { int err; snd_sf_callback_t sf_cb; struct snd_sf_callback sf_cb; snd_assert(emu->hw != NULL, return -EINVAL); snd_assert(emu->max_voices > 0, return -EINVAL); Loading @@ -101,7 +101,8 @@ int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name) emu->card = card; emu->name = kstrdup(name, GFP_KERNEL); emu->voices = kcalloc(emu->max_voices, sizeof(snd_emux_voice_t), GFP_KERNEL); emu->voices = kcalloc(emu->max_voices, sizeof(struct snd_emux_voice), GFP_KERNEL); if (emu->voices == NULL) return -ENOMEM; Loading Loading @@ -138,7 +139,7 @@ int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name) /* */ int snd_emux_free(snd_emux_t *emu) int snd_emux_free(struct snd_emux *emu) { unsigned long flags; Loading Loading
include/sound/emux_synth.h +53 −52 Original line number Diff line number Diff line Loading @@ -36,39 +36,40 @@ */ #define SNDRV_EMUX_USE_RAW_EFFECT /* * typedefs */ typedef struct snd_emux_effect_table snd_emux_effect_table_t; typedef struct snd_emux_port snd_emux_port_t; typedef struct snd_emux_voice snd_emux_voice_t; typedef struct snd_emux snd_emux_t; struct snd_emux; struct snd_emux_port; struct snd_emux_voice; struct snd_emux_effect_table; /* * operators */ typedef struct snd_emux_operators { struct snd_emux_operators { struct module *owner; snd_emux_voice_t *(*get_voice)(snd_emux_t *emu, snd_emux_port_t *port); int (*prepare)(snd_emux_voice_t *vp); void (*trigger)(snd_emux_voice_t *vp); void (*release)(snd_emux_voice_t *vp); void (*update)(snd_emux_voice_t *vp, int update); void (*terminate)(snd_emux_voice_t *vp); void (*free_voice)(snd_emux_voice_t *vp); void (*reset)(snd_emux_t *emu, int ch); /* the first parameters are snd_emux_t */ int (*sample_new)(snd_emux_t *emu, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr, const void __user *data, long count); int (*sample_free)(snd_emux_t *emu, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr); void (*sample_reset)(snd_emux_t *emu); int (*load_fx)(snd_emux_t *emu, int type, int arg, const void __user *data, long count); void (*sysex)(snd_emux_t *emu, char *buf, int len, int parsed, snd_midi_channel_set_t *chset); struct snd_emux_voice *(*get_voice)(struct snd_emux *emu, struct snd_emux_port *port); int (*prepare)(struct snd_emux_voice *vp); void (*trigger)(struct snd_emux_voice *vp); void (*release)(struct snd_emux_voice *vp); void (*update)(struct snd_emux_voice *vp, int update); void (*terminate)(struct snd_emux_voice *vp); void (*free_voice)(struct snd_emux_voice *vp); void (*reset)(struct snd_emux *emu, int ch); /* the first parameters are struct snd_emux */ int (*sample_new)(struct snd_emux *emu, struct snd_sf_sample *sp, struct snd_util_memhdr *hdr, const void __user *data, long count); int (*sample_free)(struct snd_emux *emu, struct snd_sf_sample *sp, struct snd_util_memhdr *hdr); void (*sample_reset)(struct snd_emux *emu); int (*load_fx)(struct snd_emux *emu, int type, int arg, const void __user *data, long count); void (*sysex)(struct snd_emux *emu, char *buf, int len, int parsed, struct snd_midi_channel_set *chset); #ifdef CONFIG_SND_SEQUENCER_OSS int (*oss_ioctl)(snd_emux_t *emu, int cmd, int p1, int p2); int (*oss_ioctl)(struct snd_emux *emu, int cmd, int p1, int p2); #endif } snd_emux_operators_t; }; /* Loading @@ -90,46 +91,46 @@ typedef struct snd_emux_operators { */ struct snd_emux { snd_card_t *card; /* assigned card */ struct snd_card *card; /* assigned card */ /* following should be initialized before registration */ int max_voices; /* Number of voices */ int mem_size; /* memory size (in byte) */ int num_ports; /* number of ports to be created */ int pitch_shift; /* pitch shift value (for Emu10k1) */ snd_emux_operators_t ops; /* operators */ struct snd_emux_operators ops; /* operators */ void *hw; /* hardware */ unsigned long flags; /* other conditions */ int midi_ports; /* number of virtual midi devices */ int midi_devidx; /* device offset of virtual midi */ unsigned int linear_panning: 1; /* panning is linear (sbawe = 1, emu10k1 = 0) */ int hwdep_idx; /* hwdep device index */ snd_hwdep_t *hwdep; /* hwdep device */ struct snd_hwdep *hwdep; /* hwdep device */ /* private */ int num_voices; /* current number of voices */ snd_sf_list_t *sflist; /* root of SoundFont list */ snd_emux_voice_t *voices; /* Voices (EMU 'channel') */ struct snd_sf_list *sflist; /* root of SoundFont list */ struct snd_emux_voice *voices; /* Voices (EMU 'channel') */ int use_time; /* allocation counter */ spinlock_t voice_lock; /* Lock for voice access */ struct semaphore register_mutex; int client; /* For the sequencer client */ int ports[SNDRV_EMUX_MAX_PORTS]; /* The ports for this device */ snd_emux_port_t *portptrs[SNDRV_EMUX_MAX_PORTS]; struct snd_emux_port *portptrs[SNDRV_EMUX_MAX_PORTS]; int used; /* use counter */ char *name; /* name of the device (internal) */ snd_rawmidi_t **vmidi; struct snd_rawmidi **vmidi; struct timer_list tlist; /* for pending note-offs */ int timer_active; snd_util_memhdr_t *memhdr; /* memory chunk information */ struct snd_util_memhdr *memhdr; /* memory chunk information */ #ifdef CONFIG_PROC_FS snd_info_entry_t *proc; struct snd_info_entry *proc; #endif #ifdef CONFIG_SND_SEQUENCER_OSS snd_seq_device_t *oss_synth; struct snd_seq_device *oss_synth; #endif }; Loading @@ -139,18 +140,18 @@ struct snd_emux { */ struct snd_emux_port { snd_midi_channel_set_t chset; snd_emux_t *emu; struct snd_midi_channel_set chset; struct snd_emux *emu; char port_mode; /* operation mode */ int volume_atten; /* emuX raw attenuation */ unsigned long drum_flags; /* drum bitmaps */ int ctrls[EMUX_MD_END]; /* control parameters */ #ifdef SNDRV_EMUX_USE_RAW_EFFECT snd_emux_effect_table_t *effect; struct snd_emux_effect_table *effect; #endif #ifdef CONFIG_SND_SEQUENCER_OSS snd_seq_oss_arg_t *oss_arg; struct snd_seq_oss_arg *oss_arg; #endif }; Loading Loading @@ -179,16 +180,16 @@ struct snd_emux_voice { unsigned char key; unsigned char velocity; /* Velocity of current note */ snd_sf_zone_t *zone; /* Zone assigned to this note */ struct snd_sf_zone *zone; /* Zone assigned to this note */ void *block; /* sample block pointer (optional) */ snd_midi_channel_t *chan; /* Midi channel for this note */ snd_emux_port_t *port; /* associated port */ snd_emux_t *emu; /* assigned root info */ void *hw; /* hardware pointer (emu8000_t or emu10k1_t) */ struct snd_midi_channel *chan; /* Midi channel for this note */ struct snd_emux_port *port; /* associated port */ struct snd_emux *emu; /* assigned root info */ void *hw; /* hardware pointer (emu8000 or emu10k1) */ unsigned long ontime; /* jiffies at note triggered */ /* Emu8k/Emu10k1 registers */ soundfont_voice_info_t reg; struct soundfont_voice_info reg; /* additional registers */ int avol; /* volume attenuation */ Loading Loading @@ -229,15 +230,15 @@ struct snd_emux_effect_table { /* * prototypes - interface to Emu10k1 and Emu8k routines */ int snd_emux_new(snd_emux_t **remu); int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name); int snd_emux_free(snd_emux_t *emu); int snd_emux_new(struct snd_emux **remu); int snd_emux_register(struct snd_emux *emu, struct snd_card *card, int index, char *name); int snd_emux_free(struct snd_emux *emu); /* * exported functions */ void snd_emux_terminate_all(snd_emux_t *emu); void snd_emux_lock_voice(snd_emux_t *emu, int voice); void snd_emux_unlock_voice(snd_emux_t *emu, int voice); void snd_emux_terminate_all(struct snd_emux *emu); void snd_emux_lock_voice(struct snd_emux *emu, int voice); void snd_emux_unlock_voice(struct snd_emux *emu, int voice); #endif /* __SOUND_EMUX_SYNTH_H */
include/sound/sfnt_info.h +18 −18 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ #endif /* patch interface header: 16 bytes */ typedef struct soundfont_patch_info_t { struct soundfont_patch_info { unsigned short key; /* use the key below */ #define SNDRV_OSS_SOUNDFONT_PATCH SNDRV_OSS_PATCHKEY(0x07) Loading @@ -59,7 +59,7 @@ typedef struct soundfont_patch_info_t { short reserved; /* word alignment data */ /* the actual patch data begins after this */ } soundfont_patch_info_t; }; /* Loading @@ -68,7 +68,7 @@ typedef struct soundfont_patch_info_t { #define SNDRV_SFNT_PATCH_NAME_LEN 32 typedef struct soundfont_open_parm_t { struct soundfont_open_parm { unsigned short type; /* sample type */ #define SNDRV_SFNT_PAT_TYPE_MISC 0 #define SNDRV_SFNT_PAT_TYPE_GUS 6 Loading @@ -78,7 +78,7 @@ typedef struct soundfont_open_parm_t { short reserved; char name[SNDRV_SFNT_PATCH_NAME_LEN]; } soundfont_open_parm_t; }; /* Loading @@ -86,7 +86,7 @@ typedef struct soundfont_open_parm_t { */ /* wave table envelope & effect parameters to control EMU8000 */ typedef struct soundfont_voice_parm_t { struct soundfont_voice_parm { unsigned short moddelay; /* modulation delay (0x8000) */ unsigned short modatkhld; /* modulation attack & hold time (0x7f7f) */ unsigned short moddcysus; /* modulation decay & sustain (0x7f7f) */ Loading @@ -108,11 +108,11 @@ typedef struct soundfont_voice_parm_t { unsigned char chorus; /* chorus send (0x00) */ unsigned char reverb; /* reverb send (0x00) */ unsigned short reserved[4]; /* not used */ } soundfont_voice_parm_t; }; /* wave table parameters: 92 bytes */ typedef struct soundfont_voice_info_t { struct soundfont_voice_info { unsigned short sf_id; /* file id (should be zero) */ unsigned short sample; /* sample id */ int start, end; /* sample offset correction */ Loading @@ -135,13 +135,13 @@ typedef struct soundfont_voice_info_t { unsigned char amplitude; /* sample volume (127 max) */ unsigned char attenuation; /* attenuation (0.375dB) */ short scaleTuning; /* pitch scale tuning(%), normally 100 */ soundfont_voice_parm_t parm; /* voice envelope parameters */ struct soundfont_voice_parm parm; /* voice envelope parameters */ unsigned short sample_mode; /* sample mode_flag (set by driver) */ } soundfont_voice_info_t; }; /* instrument info header: 4 bytes */ typedef struct soundfont_voice_rec_hdr_t { struct soundfont_voice_rec_hdr { unsigned char bank; /* midi bank number */ unsigned char instr; /* midi preset number */ char nvoices; /* number of voices */ Loading @@ -149,7 +149,7 @@ typedef struct soundfont_voice_rec_hdr_t { #define SNDRV_SFNT_WR_APPEND 0 /* append anyway */ #define SNDRV_SFNT_WR_EXCLUSIVE 1 /* skip if already exists */ #define SNDRV_SFNT_WR_REPLACE 2 /* replace if already exists */ } soundfont_voice_rec_hdr_t; }; /* Loading @@ -157,7 +157,7 @@ typedef struct soundfont_voice_rec_hdr_t { */ /* wave table sample header: 32 bytes */ typedef struct soundfont_sample_info_t { struct soundfont_sample_info { unsigned short sf_id; /* file id (should be zero) */ unsigned short sample; /* sample id */ int start, end; /* start & end offset */ Loading @@ -174,17 +174,17 @@ typedef struct soundfont_sample_info_t { #define SNDRV_SFNT_SAMPLE_STEREO_RIGHT 64 /* stereo right sound */ #define SNDRV_SFNT_SAMPLE_REVERSE_LOOP 128 /* reverse looping */ unsigned int truesize; /* used memory size (set by driver) */ } soundfont_sample_info_t; }; /* * voice preset mapping (aliasing) */ typedef struct soundfont_voice_map_t { struct soundfont_voice_map { int map_bank, map_instr, map_key; /* key = -1 means all keys */ int src_bank, src_instr, src_key; } soundfont_voice_map_t; }; /* Loading @@ -195,7 +195,7 @@ typedef struct soundfont_voice_map_t { #define SNDRV_EMUX_VERSION ((1 << 16) | (0 << 8) | 0) /* 1.0.0 */ struct sndrv_emux_misc_mode { struct snd_emux_misc_mode { int port; /* -1 = all */ int mode; int value; Loading @@ -204,11 +204,11 @@ struct sndrv_emux_misc_mode { enum { SNDRV_EMUX_IOCTL_VERSION = _IOR('H', 0x80, unsigned int), SNDRV_EMUX_IOCTL_LOAD_PATCH = _IOWR('H', 0x81, soundfont_patch_info_t), SNDRV_EMUX_IOCTL_LOAD_PATCH = _IOWR('H', 0x81, struct soundfont_patch_info), SNDRV_EMUX_IOCTL_RESET_SAMPLES = _IO('H', 0x82), SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES = _IO('H', 0x83), SNDRV_EMUX_IOCTL_MEM_AVAIL = _IOW('H', 0x84, int), SNDRV_EMUX_IOCTL_MISC_MODE = _IOWR('H', 0x84, struct sndrv_emux_misc_mode), SNDRV_EMUX_IOCTL_MISC_MODE = _IOWR('H', 0x84, struct snd_emux_misc_mode), }; #endif /* __SOUND_SFNT_INFO_H */
include/sound/soundfont.h +37 −38 Original line number Diff line number Diff line Loading @@ -29,94 +29,93 @@ #define SF_MAX_PRESETS 256 /* drums are mapped from 128 to 256 */ #define SF_IS_DRUM_BANK(z) ((z) == 128) typedef struct snd_sf_zone { struct snd_sf_zone { struct snd_sf_zone *next; /* Link to next */ unsigned char bank; /* Midi bank for this zone */ unsigned char instr; /* Midi program for this zone */ unsigned char mapped; /* True if mapped to something else */ soundfont_voice_info_t v; /* All the soundfont parameters */ struct soundfont_voice_info v; /* All the soundfont parameters */ int counter; struct snd_sf_sample *sample; /* Link to sample */ /* The following deals with preset numbers (programs) */ struct snd_sf_zone *next_instr; /* Next zone of this instrument */ struct snd_sf_zone *next_zone; /* Next zone in play list */ } snd_sf_zone_t; }; typedef struct snd_sf_sample { soundfont_sample_info_t v; struct snd_sf_sample { struct soundfont_sample_info v; int counter; snd_util_memblk_t *block; /* allocated data block */ struct snd_util_memblk *block; /* allocated data block */ struct snd_sf_sample *next; } snd_sf_sample_t; }; /* * This represents all the information relating to a soundfont. */ typedef struct snd_soundfont { struct snd_soundfont { struct snd_soundfont *next; /* Link to next */ /*struct snd_soundfont *prev;*/ /* Link to previous */ short id; /* file id */ short type; /* font type */ unsigned char name[SNDRV_SFNT_PATCH_NAME_LEN]; /* identifier */ snd_sf_zone_t *zones; /* Font information */ snd_sf_sample_t *samples; /* The sample headers */ } snd_soundfont_t; struct snd_sf_zone *zones; /* Font information */ struct snd_sf_sample *samples; /* The sample headers */ }; /* * Type of the sample access callback */ typedef int (*snd_sf_sample_new_t)(void *private_data, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr, const void __user *buf, long count); typedef int (*snd_sf_sample_free_t)(void *private_data, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr); typedef void (*snd_sf_sample_reset_t)(void *private); typedef struct snd_sf_callback { struct snd_sf_callback { void *private_data; snd_sf_sample_new_t sample_new; snd_sf_sample_free_t sample_free; snd_sf_sample_reset_t sample_reset; } snd_sf_callback_t; int (*sample_new)(void *private_data, struct snd_sf_sample *sp, struct snd_util_memhdr *hdr, const void __user *buf, long count); int (*sample_free)(void *private_data, struct snd_sf_sample *sp, struct snd_util_memhdr *hdr); void (*sample_reset)(void *private); }; /* * List of soundfonts. */ typedef struct snd_sf_list { snd_soundfont_t *currsf; /* The currently open soundfont */ struct snd_sf_list { struct snd_soundfont *currsf; /* The currently open soundfont */ int open_client; /* client pointer for lock */ int mem_used; /* used memory size */ snd_sf_zone_t *presets[SF_MAX_PRESETS]; snd_soundfont_t *fonts; /* The list of soundfonts */ struct snd_sf_zone *presets[SF_MAX_PRESETS]; struct snd_soundfont *fonts; /* The list of soundfonts */ int fonts_size; /* number of fonts allocated */ int zone_counter; /* last allocated time for zone */ int sample_counter; /* last allocated time for sample */ int zone_locked; /* locked time for zone */ int sample_locked; /* locked time for sample */ snd_sf_callback_t callback; /* callback functions */ struct snd_sf_callback callback; /* callback functions */ int presets_locked; struct semaphore presets_mutex; spinlock_t lock; snd_util_memhdr_t *memhdr; } snd_sf_list_t; struct snd_util_memhdr *memhdr; }; /* Prototypes for soundfont.c */ int snd_soundfont_load(snd_sf_list_t *sflist, const void __user *data, long count, int client); int snd_soundfont_load_guspatch(snd_sf_list_t *sflist, const char __user *data, int snd_soundfont_load(struct snd_sf_list *sflist, const void __user *data, long count, int client); int snd_soundfont_load_guspatch(struct snd_sf_list *sflist, const char __user *data, long count, int client); int snd_soundfont_close_check(snd_sf_list_t *sflist, int client); int snd_soundfont_close_check(struct snd_sf_list *sflist, int client); snd_sf_list_t *snd_sf_new(snd_sf_callback_t *callback, snd_util_memhdr_t *hdr); void snd_sf_free(snd_sf_list_t *sflist); struct snd_sf_list *snd_sf_new(struct snd_sf_callback *callback, struct snd_util_memhdr *hdr); void snd_sf_free(struct snd_sf_list *sflist); int snd_soundfont_remove_samples(snd_sf_list_t *sflist); int snd_soundfont_remove_unlocked(snd_sf_list_t *sflist); int snd_soundfont_remove_samples(struct snd_sf_list *sflist); int snd_soundfont_remove_unlocked(struct snd_sf_list *sflist); int snd_soundfont_search_zone(snd_sf_list_t *sflist, int *notep, int vel, int snd_soundfont_search_zone(struct snd_sf_list *sflist, int *notep, int vel, int preset, int bank, int def_preset, int def_bank, snd_sf_zone_t **table, int max_layers); struct snd_sf_zone **table, int max_layers); /* Parameter conversions */ int snd_sf_calc_parm_hold(int msec); Loading
include/sound/util_mem.h +15 −17 Original line number Diff line number Diff line Loading @@ -20,29 +20,25 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ typedef struct snd_util_memblk snd_util_memblk_t; typedef struct snd_util_memhdr snd_util_memhdr_t; typedef unsigned int snd_util_unit_t; /* * memory block */ struct snd_util_memblk { snd_util_unit_t size; /* size of this block */ snd_util_unit_t offset; /* zero-offset of this block */ unsigned int size; /* size of this block */ unsigned int offset; /* zero-offset of this block */ struct list_head list; /* link */ }; #define snd_util_memblk_argptr(blk) (void*)((char*)(blk) + sizeof(snd_util_memblk_t)) #define snd_util_memblk_argptr(blk) (void*)((char*)(blk) + sizeof(struct snd_util_memblk)) /* * memory management information */ struct snd_util_memhdr { snd_util_unit_t size; /* size of whole data */ unsigned int size; /* size of whole data */ struct list_head block; /* block linked-list header */ int nblocks; /* # of allocated blocks */ snd_util_unit_t used; /* used memory size */ unsigned int used; /* used memory size */ int block_extra_size; /* extra data size of chunk */ struct semaphore block_mutex; /* lock */ }; Loading @@ -50,15 +46,17 @@ struct snd_util_memhdr { /* * prototypes */ snd_util_memhdr_t *snd_util_memhdr_new(int memsize); void snd_util_memhdr_free(snd_util_memhdr_t *hdr); snd_util_memblk_t *snd_util_mem_alloc(snd_util_memhdr_t *hdr, int size); int snd_util_mem_free(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk); int snd_util_mem_avail(snd_util_memhdr_t *hdr); struct snd_util_memhdr *snd_util_memhdr_new(int memsize); void snd_util_memhdr_free(struct snd_util_memhdr *hdr); struct snd_util_memblk *snd_util_mem_alloc(struct snd_util_memhdr *hdr, int size); int snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk); int snd_util_mem_avail(struct snd_util_memhdr *hdr); /* functions without mutex */ snd_util_memblk_t *__snd_util_mem_alloc(snd_util_memhdr_t *hdr, int size); void __snd_util_mem_free(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk); snd_util_memblk_t *__snd_util_memblk_new(snd_util_memhdr_t *hdr, snd_util_unit_t units, struct list_head *prev); struct snd_util_memblk *__snd_util_mem_alloc(struct snd_util_memhdr *hdr, int size); void __snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk); struct snd_util_memblk *__snd_util_memblk_new(struct snd_util_memhdr *hdr, unsigned int units, struct list_head *prev); #endif /* __SOUND_UTIL_MEM_H */
sound/synth/emux/emux.c +15 −14 Original line number Diff line number Diff line Loading @@ -35,9 +35,9 @@ MODULE_LICENSE("GPL"); /* * create a new hardware dependent device for Emu8000/Emu10k1 */ int snd_emux_new(snd_emux_t **remu) int snd_emux_new(struct snd_emux **remu) { snd_emux_t *emu; struct snd_emux *emu; *remu = NULL; emu = kzalloc(sizeof(*emu), GFP_KERNEL); Loading Loading @@ -66,33 +66,33 @@ int snd_emux_new(snd_emux_t **remu) /* */ static int sf_sample_new(void *private_data, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr, static int sf_sample_new(void *private_data, struct snd_sf_sample *sp, struct snd_util_memhdr *hdr, const void __user *buf, long count) { snd_emux_t *emu = private_data; struct snd_emux *emu = private_data; return emu->ops.sample_new(emu, sp, hdr, buf, count); } static int sf_sample_free(void *private_data, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr) static int sf_sample_free(void *private_data, struct snd_sf_sample *sp, struct snd_util_memhdr *hdr) { snd_emux_t *emu = private_data; struct snd_emux *emu = private_data; return emu->ops.sample_free(emu, sp, hdr); } static void sf_sample_reset(void *private_data) { snd_emux_t *emu = private_data; struct snd_emux *emu = private_data; emu->ops.sample_reset(emu); } int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name) int snd_emux_register(struct snd_emux *emu, struct snd_card *card, int index, char *name) { int err; snd_sf_callback_t sf_cb; struct snd_sf_callback sf_cb; snd_assert(emu->hw != NULL, return -EINVAL); snd_assert(emu->max_voices > 0, return -EINVAL); Loading @@ -101,7 +101,8 @@ int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name) emu->card = card; emu->name = kstrdup(name, GFP_KERNEL); emu->voices = kcalloc(emu->max_voices, sizeof(snd_emux_voice_t), GFP_KERNEL); emu->voices = kcalloc(emu->max_voices, sizeof(struct snd_emux_voice), GFP_KERNEL); if (emu->voices == NULL) return -ENOMEM; Loading Loading @@ -138,7 +139,7 @@ int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name) /* */ int snd_emux_free(snd_emux_t *emu) int snd_emux_free(struct snd_emux *emu) { unsigned long flags; Loading