|
@@ -34,38 +34,49 @@
|
|
|
|
|
|
/* Prototypes for static functions */
|
|
/* Prototypes for static functions */
|
|
|
|
|
|
-static int open_patch(snd_sf_list_t *sflist, const char __user *data, int count, int client);
|
|
|
|
-static snd_soundfont_t *newsf(snd_sf_list_t *sflist, int type, char *name);
|
|
|
|
-static int is_identical_font(snd_soundfont_t *sf, int type, unsigned char *name);
|
|
|
|
-static int close_patch(snd_sf_list_t *sflist);
|
|
|
|
-static int probe_data(snd_sf_list_t *sflist, int sample_id);
|
|
|
|
-static void set_zone_counter(snd_sf_list_t *sflist, snd_soundfont_t *sf, snd_sf_zone_t *zp);
|
|
|
|
-static snd_sf_zone_t *sf_zone_new(snd_sf_list_t *sflist, snd_soundfont_t *sf);
|
|
|
|
-static void set_sample_counter(snd_sf_list_t *sflist, snd_soundfont_t *sf, snd_sf_sample_t *sp);
|
|
|
|
-static snd_sf_sample_t *sf_sample_new(snd_sf_list_t *sflist, snd_soundfont_t *sf);
|
|
|
|
-static void sf_sample_delete(snd_sf_list_t *sflist, snd_soundfont_t *sf, snd_sf_sample_t *sp);
|
|
|
|
-static int load_map(snd_sf_list_t *sflist, const void __user *data, int count);
|
|
|
|
-static int load_info(snd_sf_list_t *sflist, const void __user *data, long count);
|
|
|
|
-static int remove_info(snd_sf_list_t *sflist, snd_soundfont_t *sf, int bank, int instr);
|
|
|
|
-static void init_voice_info(soundfont_voice_info_t *avp);
|
|
|
|
-static void init_voice_parm(soundfont_voice_parm_t *pp);
|
|
|
|
-static snd_sf_sample_t *set_sample(snd_soundfont_t *sf, soundfont_voice_info_t *avp);
|
|
|
|
-static snd_sf_sample_t *find_sample(snd_soundfont_t *sf, int sample_id);
|
|
|
|
-static int load_data(snd_sf_list_t *sflist, const void __user *data, long count);
|
|
|
|
-static void rebuild_presets(snd_sf_list_t *sflist);
|
|
|
|
-static void add_preset(snd_sf_list_t *sflist, snd_sf_zone_t *cur);
|
|
|
|
-static void delete_preset(snd_sf_list_t *sflist, snd_sf_zone_t *zp);
|
|
|
|
-static snd_sf_zone_t *search_first_zone(snd_sf_list_t *sflist, int bank, int preset, int key);
|
|
|
|
-static int search_zones(snd_sf_list_t *sflist, int *notep, int vel, int preset, int bank, snd_sf_zone_t **table, int max_layers, int level);
|
|
|
|
|
|
+static int open_patch(struct snd_sf_list *sflist, const char __user *data,
|
|
|
|
+ int count, int client);
|
|
|
|
+static struct snd_soundfont *newsf(struct snd_sf_list *sflist, int type, char *name);
|
|
|
|
+static int is_identical_font(struct snd_soundfont *sf, int type, unsigned char *name);
|
|
|
|
+static int close_patch(struct snd_sf_list *sflist);
|
|
|
|
+static int probe_data(struct snd_sf_list *sflist, int sample_id);
|
|
|
|
+static void set_zone_counter(struct snd_sf_list *sflist,
|
|
|
|
+ struct snd_soundfont *sf, struct snd_sf_zone *zp);
|
|
|
|
+static struct snd_sf_zone *sf_zone_new(struct snd_sf_list *sflist,
|
|
|
|
+ struct snd_soundfont *sf);
|
|
|
|
+static void set_sample_counter(struct snd_sf_list *sflist,
|
|
|
|
+ struct snd_soundfont *sf, struct snd_sf_sample *sp);
|
|
|
|
+static struct snd_sf_sample *sf_sample_new(struct snd_sf_list *sflist,
|
|
|
|
+ struct snd_soundfont *sf);
|
|
|
|
+static void sf_sample_delete(struct snd_sf_list *sflist,
|
|
|
|
+ struct snd_soundfont *sf, struct snd_sf_sample *sp);
|
|
|
|
+static int load_map(struct snd_sf_list *sflist, const void __user *data, int count);
|
|
|
|
+static int load_info(struct snd_sf_list *sflist, const void __user *data, long count);
|
|
|
|
+static int remove_info(struct snd_sf_list *sflist, struct snd_soundfont *sf,
|
|
|
|
+ int bank, int instr);
|
|
|
|
+static void init_voice_info(struct soundfont_voice_info *avp);
|
|
|
|
+static void init_voice_parm(struct soundfont_voice_parm *pp);
|
|
|
|
+static struct snd_sf_sample *set_sample(struct snd_soundfont *sf,
|
|
|
|
+ struct soundfont_voice_info *avp);
|
|
|
|
+static struct snd_sf_sample *find_sample(struct snd_soundfont *sf, int sample_id);
|
|
|
|
+static int load_data(struct snd_sf_list *sflist, const void __user *data, long count);
|
|
|
|
+static void rebuild_presets(struct snd_sf_list *sflist);
|
|
|
|
+static void add_preset(struct snd_sf_list *sflist, struct snd_sf_zone *cur);
|
|
|
|
+static void delete_preset(struct snd_sf_list *sflist, struct snd_sf_zone *zp);
|
|
|
|
+static struct snd_sf_zone *search_first_zone(struct snd_sf_list *sflist,
|
|
|
|
+ int bank, int preset, int key);
|
|
|
|
+static int search_zones(struct snd_sf_list *sflist, int *notep, int vel,
|
|
|
|
+ int preset, int bank, struct snd_sf_zone **table,
|
|
|
|
+ int max_layers, int level);
|
|
static int get_index(int bank, int instr, int key);
|
|
static int get_index(int bank, int instr, int key);
|
|
-static void snd_sf_init(snd_sf_list_t *sflist);
|
|
|
|
-static void snd_sf_clear(snd_sf_list_t *sflist);
|
|
|
|
|
|
+static void snd_sf_init(struct snd_sf_list *sflist);
|
|
|
|
+static void snd_sf_clear(struct snd_sf_list *sflist);
|
|
|
|
|
|
/*
|
|
/*
|
|
* lock access to sflist
|
|
* lock access to sflist
|
|
*/
|
|
*/
|
|
static void
|
|
static void
|
|
-lock_preset(snd_sf_list_t *sflist)
|
|
|
|
|
|
+lock_preset(struct snd_sf_list *sflist)
|
|
{
|
|
{
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
down(&sflist->presets_mutex);
|
|
down(&sflist->presets_mutex);
|
|
@@ -79,7 +90,7 @@ lock_preset(snd_sf_list_t *sflist)
|
|
* remove lock
|
|
* remove lock
|
|
*/
|
|
*/
|
|
static void
|
|
static void
|
|
-unlock_preset(snd_sf_list_t *sflist)
|
|
|
|
|
|
+unlock_preset(struct snd_sf_list *sflist)
|
|
{
|
|
{
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
spin_lock_irqsave(&sflist->lock, flags);
|
|
spin_lock_irqsave(&sflist->lock, flags);
|
|
@@ -93,7 +104,7 @@ unlock_preset(snd_sf_list_t *sflist)
|
|
* close the patch if the patch was opened by this client.
|
|
* close the patch if the patch was opened by this client.
|
|
*/
|
|
*/
|
|
int
|
|
int
|
|
-snd_soundfont_close_check(snd_sf_list_t *sflist, int client)
|
|
|
|
|
|
+snd_soundfont_close_check(struct snd_sf_list *sflist, int client)
|
|
{
|
|
{
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
spin_lock_irqsave(&sflist->lock, flags);
|
|
spin_lock_irqsave(&sflist->lock, flags);
|
|
@@ -115,9 +126,10 @@ snd_soundfont_close_check(snd_sf_list_t *sflist, int client)
|
|
* it wants to do with it.
|
|
* it wants to do with it.
|
|
*/
|
|
*/
|
|
int
|
|
int
|
|
-snd_soundfont_load(snd_sf_list_t *sflist, const void __user *data, long count, int client)
|
|
|
|
|
|
+snd_soundfont_load(struct snd_sf_list *sflist, const void __user *data,
|
|
|
|
+ long count, int client)
|
|
{
|
|
{
|
|
- soundfont_patch_info_t patch;
|
|
|
|
|
|
+ struct soundfont_patch_info patch;
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
int rc;
|
|
int rc;
|
|
|
|
|
|
@@ -215,10 +227,11 @@ is_special_type(int type)
|
|
|
|
|
|
/* open patch; create sf list */
|
|
/* open patch; create sf list */
|
|
static int
|
|
static int
|
|
-open_patch(snd_sf_list_t *sflist, const char __user *data, int count, int client)
|
|
|
|
|
|
+open_patch(struct snd_sf_list *sflist, const char __user *data,
|
|
|
|
+ int count, int client)
|
|
{
|
|
{
|
|
- soundfont_open_parm_t parm;
|
|
|
|
- snd_soundfont_t *sf;
|
|
|
|
|
|
+ struct soundfont_open_parm parm;
|
|
|
|
+ struct snd_soundfont *sf;
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
|
|
|
|
spin_lock_irqsave(&sflist->lock, flags);
|
|
spin_lock_irqsave(&sflist->lock, flags);
|
|
@@ -251,10 +264,10 @@ open_patch(snd_sf_list_t *sflist, const char __user *data, int count, int client
|
|
/*
|
|
/*
|
|
* Allocate a new soundfont structure.
|
|
* Allocate a new soundfont structure.
|
|
*/
|
|
*/
|
|
-static snd_soundfont_t *
|
|
|
|
-newsf(snd_sf_list_t *sflist, int type, char *name)
|
|
|
|
|
|
+static struct snd_soundfont *
|
|
|
|
+newsf(struct snd_sf_list *sflist, int type, char *name)
|
|
{
|
|
{
|
|
- snd_soundfont_t *sf;
|
|
|
|
|
|
+ struct snd_soundfont *sf;
|
|
|
|
|
|
/* check the shared fonts */
|
|
/* check the shared fonts */
|
|
if (type & SNDRV_SFNT_PAT_SHARED) {
|
|
if (type & SNDRV_SFNT_PAT_SHARED) {
|
|
@@ -287,7 +300,7 @@ newsf(snd_sf_list_t *sflist, int type, char *name)
|
|
|
|
|
|
/* check if the given name matches to the existing list */
|
|
/* check if the given name matches to the existing list */
|
|
static int
|
|
static int
|
|
-is_identical_font(snd_soundfont_t *sf, int type, unsigned char *name)
|
|
|
|
|
|
+is_identical_font(struct snd_soundfont *sf, int type, unsigned char *name)
|
|
{
|
|
{
|
|
return ((sf->type & SNDRV_SFNT_PAT_SHARED) &&
|
|
return ((sf->type & SNDRV_SFNT_PAT_SHARED) &&
|
|
(sf->type & 0x0f) == (type & 0x0f) &&
|
|
(sf->type & 0x0f) == (type & 0x0f) &&
|
|
@@ -299,7 +312,7 @@ is_identical_font(snd_soundfont_t *sf, int type, unsigned char *name)
|
|
* Close the current patch.
|
|
* Close the current patch.
|
|
*/
|
|
*/
|
|
static int
|
|
static int
|
|
-close_patch(snd_sf_list_t *sflist)
|
|
|
|
|
|
+close_patch(struct snd_sf_list *sflist)
|
|
{
|
|
{
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
|
|
|
|
@@ -316,7 +329,7 @@ close_patch(snd_sf_list_t *sflist)
|
|
|
|
|
|
/* probe sample in the current list -- nothing to be loaded */
|
|
/* probe sample in the current list -- nothing to be loaded */
|
|
static int
|
|
static int
|
|
-probe_data(snd_sf_list_t *sflist, int sample_id)
|
|
|
|
|
|
+probe_data(struct snd_sf_list *sflist, int sample_id)
|
|
{
|
|
{
|
|
/* patch must be opened */
|
|
/* patch must be opened */
|
|
if (sflist->currsf) {
|
|
if (sflist->currsf) {
|
|
@@ -331,7 +344,8 @@ probe_data(snd_sf_list_t *sflist, int sample_id)
|
|
* increment zone counter
|
|
* increment zone counter
|
|
*/
|
|
*/
|
|
static void
|
|
static void
|
|
-set_zone_counter(snd_sf_list_t *sflist, snd_soundfont_t *sf, snd_sf_zone_t *zp)
|
|
|
|
|
|
+set_zone_counter(struct snd_sf_list *sflist, struct snd_soundfont *sf,
|
|
|
|
+ struct snd_sf_zone *zp)
|
|
{
|
|
{
|
|
zp->counter = sflist->zone_counter++;
|
|
zp->counter = sflist->zone_counter++;
|
|
if (sf->type & SNDRV_SFNT_PAT_LOCKED)
|
|
if (sf->type & SNDRV_SFNT_PAT_LOCKED)
|
|
@@ -341,10 +355,10 @@ set_zone_counter(snd_sf_list_t *sflist, snd_soundfont_t *sf, snd_sf_zone_t *zp)
|
|
/*
|
|
/*
|
|
* allocate a new zone record
|
|
* allocate a new zone record
|
|
*/
|
|
*/
|
|
-static snd_sf_zone_t *
|
|
|
|
-sf_zone_new(snd_sf_list_t *sflist, snd_soundfont_t *sf)
|
|
|
|
|
|
+static struct snd_sf_zone *
|
|
|
|
+sf_zone_new(struct snd_sf_list *sflist, struct snd_soundfont *sf)
|
|
{
|
|
{
|
|
- snd_sf_zone_t *zp;
|
|
|
|
|
|
+ struct snd_sf_zone *zp;
|
|
|
|
|
|
if ((zp = kzalloc(sizeof(*zp), GFP_KERNEL)) == NULL)
|
|
if ((zp = kzalloc(sizeof(*zp), GFP_KERNEL)) == NULL)
|
|
return NULL;
|
|
return NULL;
|
|
@@ -362,7 +376,8 @@ sf_zone_new(snd_sf_list_t *sflist, snd_soundfont_t *sf)
|
|
* increment sample couter
|
|
* increment sample couter
|
|
*/
|
|
*/
|
|
static void
|
|
static void
|
|
-set_sample_counter(snd_sf_list_t *sflist, snd_soundfont_t *sf, snd_sf_sample_t *sp)
|
|
|
|
|
|
+set_sample_counter(struct snd_sf_list *sflist, struct snd_soundfont *sf,
|
|
|
|
+ struct snd_sf_sample *sp)
|
|
{
|
|
{
|
|
sp->counter = sflist->sample_counter++;
|
|
sp->counter = sflist->sample_counter++;
|
|
if (sf->type & SNDRV_SFNT_PAT_LOCKED)
|
|
if (sf->type & SNDRV_SFNT_PAT_LOCKED)
|
|
@@ -372,10 +387,10 @@ set_sample_counter(snd_sf_list_t *sflist, snd_soundfont_t *sf, snd_sf_sample_t *
|
|
/*
|
|
/*
|
|
* allocate a new sample list record
|
|
* allocate a new sample list record
|
|
*/
|
|
*/
|
|
-static snd_sf_sample_t *
|
|
|
|
-sf_sample_new(snd_sf_list_t *sflist, snd_soundfont_t *sf)
|
|
|
|
|
|
+static struct snd_sf_sample *
|
|
|
|
+sf_sample_new(struct snd_sf_list *sflist, struct snd_soundfont *sf)
|
|
{
|
|
{
|
|
- snd_sf_sample_t *sp;
|
|
|
|
|
|
+ struct snd_sf_sample *sp;
|
|
|
|
|
|
if ((sp = kzalloc(sizeof(*sp), GFP_KERNEL)) == NULL)
|
|
if ((sp = kzalloc(sizeof(*sp), GFP_KERNEL)) == NULL)
|
|
return NULL;
|
|
return NULL;
|
|
@@ -392,7 +407,8 @@ sf_sample_new(snd_sf_list_t *sflist, snd_soundfont_t *sf)
|
|
* only the last allocated sample can be deleted.
|
|
* only the last allocated sample can be deleted.
|
|
*/
|
|
*/
|
|
static void
|
|
static void
|
|
-sf_sample_delete(snd_sf_list_t *sflist, snd_soundfont_t *sf, snd_sf_sample_t *sp)
|
|
|
|
|
|
+sf_sample_delete(struct snd_sf_list *sflist, struct snd_soundfont *sf,
|
|
|
|
+ struct snd_sf_sample *sp)
|
|
{
|
|
{
|
|
/* only last sample is accepted */
|
|
/* only last sample is accepted */
|
|
if (sp == sf->samples) {
|
|
if (sp == sf->samples) {
|
|
@@ -404,11 +420,11 @@ sf_sample_delete(snd_sf_list_t *sflist, snd_soundfont_t *sf, snd_sf_sample_t *sp
|
|
|
|
|
|
/* load voice map */
|
|
/* load voice map */
|
|
static int
|
|
static int
|
|
-load_map(snd_sf_list_t *sflist, const void __user *data, int count)
|
|
|
|
|
|
+load_map(struct snd_sf_list *sflist, const void __user *data, int count)
|
|
{
|
|
{
|
|
- snd_sf_zone_t *zp, *prevp;
|
|
|
|
- snd_soundfont_t *sf;
|
|
|
|
- soundfont_voice_map_t map;
|
|
|
|
|
|
+ struct snd_sf_zone *zp, *prevp;
|
|
|
|
+ struct snd_soundfont *sf;
|
|
|
|
+ struct soundfont_voice_map map;
|
|
|
|
|
|
/* get the link info */
|
|
/* get the link info */
|
|
if (count < (int)sizeof(map))
|
|
if (count < (int)sizeof(map))
|
|
@@ -469,9 +485,10 @@ load_map(snd_sf_list_t *sflist, const void __user *data, int count)
|
|
|
|
|
|
/* remove the present instrument layers */
|
|
/* remove the present instrument layers */
|
|
static int
|
|
static int
|
|
-remove_info(snd_sf_list_t *sflist, snd_soundfont_t *sf, int bank, int instr)
|
|
|
|
|
|
+remove_info(struct snd_sf_list *sflist, struct snd_soundfont *sf,
|
|
|
|
+ int bank, int instr)
|
|
{
|
|
{
|
|
- snd_sf_zone_t *prev, *next, *p;
|
|
|
|
|
|
+ struct snd_sf_zone *prev, *next, *p;
|
|
int removed = 0;
|
|
int removed = 0;
|
|
|
|
|
|
prev = NULL;
|
|
prev = NULL;
|
|
@@ -500,11 +517,11 @@ remove_info(snd_sf_list_t *sflist, snd_soundfont_t *sf, int bank, int instr)
|
|
* open soundfont.
|
|
* open soundfont.
|
|
*/
|
|
*/
|
|
static int
|
|
static int
|
|
-load_info(snd_sf_list_t *sflist, const void __user *data, long count)
|
|
|
|
|
|
+load_info(struct snd_sf_list *sflist, const void __user *data, long count)
|
|
{
|
|
{
|
|
- snd_soundfont_t *sf;
|
|
|
|
- snd_sf_zone_t *zone;
|
|
|
|
- soundfont_voice_rec_hdr_t hdr;
|
|
|
|
|
|
+ struct snd_soundfont *sf;
|
|
|
|
+ struct snd_sf_zone *zone;
|
|
|
|
+ struct soundfont_voice_rec_hdr hdr;
|
|
int i;
|
|
int i;
|
|
|
|
|
|
/* patch must be opened */
|
|
/* patch must be opened */
|
|
@@ -529,7 +546,7 @@ load_info(snd_sf_list_t *sflist, const void __user *data, long count)
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
- if (count < (long)sizeof(soundfont_voice_info_t)*hdr.nvoices) {
|
|
|
|
|
|
+ if (count < (long)sizeof(struct soundfont_voice_info) * hdr.nvoices) {
|
|
printk("Soundfont Error: patch length(%ld) is smaller than nvoices(%d)\n",
|
|
printk("Soundfont Error: patch length(%ld) is smaller than nvoices(%d)\n",
|
|
count, hdr.nvoices);
|
|
count, hdr.nvoices);
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
@@ -553,7 +570,7 @@ load_info(snd_sf_list_t *sflist, const void __user *data, long count)
|
|
}
|
|
}
|
|
|
|
|
|
for (i = 0; i < hdr.nvoices; i++) {
|
|
for (i = 0; i < hdr.nvoices; i++) {
|
|
- snd_sf_zone_t tmpzone;
|
|
|
|
|
|
+ struct snd_sf_zone tmpzone;
|
|
|
|
|
|
/* copy awe_voice_info parameters */
|
|
/* copy awe_voice_info parameters */
|
|
if (copy_from_user(&tmpzone.v, data, sizeof(tmpzone.v))) {
|
|
if (copy_from_user(&tmpzone.v, data, sizeof(tmpzone.v))) {
|
|
@@ -590,7 +607,7 @@ load_info(snd_sf_list_t *sflist, const void __user *data, long count)
|
|
|
|
|
|
/* initialize voice_info record */
|
|
/* initialize voice_info record */
|
|
static void
|
|
static void
|
|
-init_voice_info(soundfont_voice_info_t *avp)
|
|
|
|
|
|
+init_voice_info(struct soundfont_voice_info *avp)
|
|
{
|
|
{
|
|
memset(avp, 0, sizeof(*avp));
|
|
memset(avp, 0, sizeof(*avp));
|
|
|
|
|
|
@@ -614,7 +631,7 @@ init_voice_info(soundfont_voice_info_t *avp)
|
|
* Chorus and Reverb effects are zero.
|
|
* Chorus and Reverb effects are zero.
|
|
*/
|
|
*/
|
|
static void
|
|
static void
|
|
-init_voice_parm(soundfont_voice_parm_t *pp)
|
|
|
|
|
|
+init_voice_parm(struct soundfont_voice_parm *pp)
|
|
{
|
|
{
|
|
memset(pp, 0, sizeof(*pp));
|
|
memset(pp, 0, sizeof(*pp));
|
|
|
|
|
|
@@ -635,10 +652,10 @@ init_voice_parm(soundfont_voice_parm_t *pp)
|
|
}
|
|
}
|
|
|
|
|
|
/* search the specified sample */
|
|
/* search the specified sample */
|
|
-static snd_sf_sample_t *
|
|
|
|
-set_sample(snd_soundfont_t *sf, soundfont_voice_info_t *avp)
|
|
|
|
|
|
+static struct snd_sf_sample *
|
|
|
|
+set_sample(struct snd_soundfont *sf, struct soundfont_voice_info *avp)
|
|
{
|
|
{
|
|
- snd_sf_sample_t *sample;
|
|
|
|
|
|
+ struct snd_sf_sample *sample;
|
|
|
|
|
|
sample = find_sample(sf, avp->sample);
|
|
sample = find_sample(sf, avp->sample);
|
|
if (sample == NULL)
|
|
if (sample == NULL)
|
|
@@ -661,10 +678,10 @@ set_sample(snd_soundfont_t *sf, soundfont_voice_info_t *avp)
|
|
}
|
|
}
|
|
|
|
|
|
/* find the sample pointer with the given id in the soundfont */
|
|
/* find the sample pointer with the given id in the soundfont */
|
|
-static snd_sf_sample_t *
|
|
|
|
-find_sample(snd_soundfont_t *sf, int sample_id)
|
|
|
|
|
|
+static struct snd_sf_sample *
|
|
|
|
+find_sample(struct snd_soundfont *sf, int sample_id)
|
|
{
|
|
{
|
|
- snd_sf_sample_t *p;
|
|
|
|
|
|
+ struct snd_sf_sample *p;
|
|
|
|
|
|
if (sf == NULL)
|
|
if (sf == NULL)
|
|
return NULL;
|
|
return NULL;
|
|
@@ -684,11 +701,11 @@ find_sample(snd_soundfont_t *sf, int sample_id)
|
|
* routine.
|
|
* routine.
|
|
*/
|
|
*/
|
|
static int
|
|
static int
|
|
-load_data(snd_sf_list_t *sflist, const void __user *data, long count)
|
|
|
|
|
|
+load_data(struct snd_sf_list *sflist, const void __user *data, long count)
|
|
{
|
|
{
|
|
- snd_soundfont_t *sf;
|
|
|
|
- soundfont_sample_info_t sample_info;
|
|
|
|
- snd_sf_sample_t *sp;
|
|
|
|
|
|
+ struct snd_soundfont *sf;
|
|
|
|
+ struct soundfont_sample_info sample_info;
|
|
|
|
+ struct snd_sf_sample *sp;
|
|
long off;
|
|
long off;
|
|
|
|
|
|
/* patch must be opened */
|
|
/* patch must be opened */
|
|
@@ -922,12 +939,13 @@ int snd_sf_vol_table[128] = {
|
|
|
|
|
|
/* load GUS patch */
|
|
/* load GUS patch */
|
|
static int
|
|
static int
|
|
-load_guspatch(snd_sf_list_t *sflist, const char __user *data, long count, int client)
|
|
|
|
|
|
+load_guspatch(struct snd_sf_list *sflist, const char __user *data,
|
|
|
|
+ long count, int client)
|
|
{
|
|
{
|
|
struct patch_info patch;
|
|
struct patch_info patch;
|
|
- snd_soundfont_t *sf;
|
|
|
|
- snd_sf_zone_t *zone;
|
|
|
|
- snd_sf_sample_t *smp;
|
|
|
|
|
|
+ struct snd_soundfont *sf;
|
|
|
|
+ struct snd_sf_zone *zone;
|
|
|
|
+ struct snd_sf_sample *smp;
|
|
int note, sample_id;
|
|
int note, sample_id;
|
|
int rc;
|
|
int rc;
|
|
|
|
|
|
@@ -992,7 +1010,8 @@ load_guspatch(snd_sf_list_t *sflist, const char __user *data, long count, int cl
|
|
*/
|
|
*/
|
|
if (sflist->callback.sample_new) {
|
|
if (sflist->callback.sample_new) {
|
|
rc = sflist->callback.sample_new
|
|
rc = sflist->callback.sample_new
|
|
- (sflist->callback.private_data, smp, sflist->memhdr, data, count);
|
|
|
|
|
|
+ (sflist->callback.private_data, smp, sflist->memhdr,
|
|
|
|
+ data, count);
|
|
if (rc < 0) {
|
|
if (rc < 0) {
|
|
sf_sample_delete(sflist, sf, smp);
|
|
sf_sample_delete(sflist, sf, smp);
|
|
return rc;
|
|
return rc;
|
|
@@ -1095,7 +1114,7 @@ load_guspatch(snd_sf_list_t *sflist, const char __user *data, long count, int cl
|
|
|
|
|
|
/* load GUS patch */
|
|
/* load GUS patch */
|
|
int
|
|
int
|
|
-snd_soundfont_load_guspatch(snd_sf_list_t *sflist, const char __user *data,
|
|
|
|
|
|
+snd_soundfont_load_guspatch(struct snd_sf_list *sflist, const char __user *data,
|
|
long count, int client)
|
|
long count, int client)
|
|
{
|
|
{
|
|
int rc;
|
|
int rc;
|
|
@@ -1114,10 +1133,10 @@ snd_soundfont_load_guspatch(snd_sf_list_t *sflist, const char __user *data,
|
|
* bank/key combination).
|
|
* bank/key combination).
|
|
*/
|
|
*/
|
|
static void
|
|
static void
|
|
-rebuild_presets(snd_sf_list_t *sflist)
|
|
|
|
|
|
+rebuild_presets(struct snd_sf_list *sflist)
|
|
{
|
|
{
|
|
- snd_soundfont_t *sf;
|
|
|
|
- snd_sf_zone_t *cur;
|
|
|
|
|
|
+ struct snd_soundfont *sf;
|
|
|
|
+ struct snd_sf_zone *cur;
|
|
|
|
|
|
/* clear preset table */
|
|
/* clear preset table */
|
|
memset(sflist->presets, 0, sizeof(sflist->presets));
|
|
memset(sflist->presets, 0, sizeof(sflist->presets));
|
|
@@ -1142,15 +1161,15 @@ rebuild_presets(snd_sf_list_t *sflist)
|
|
* add the given zone to preset table
|
|
* add the given zone to preset table
|
|
*/
|
|
*/
|
|
static void
|
|
static void
|
|
-add_preset(snd_sf_list_t *sflist, snd_sf_zone_t *cur)
|
|
|
|
|
|
+add_preset(struct snd_sf_list *sflist, struct snd_sf_zone *cur)
|
|
{
|
|
{
|
|
- snd_sf_zone_t *zone;
|
|
|
|
|
|
+ struct snd_sf_zone *zone;
|
|
int index;
|
|
int index;
|
|
|
|
|
|
zone = search_first_zone(sflist, cur->bank, cur->instr, cur->v.low);
|
|
zone = search_first_zone(sflist, cur->bank, cur->instr, cur->v.low);
|
|
if (zone && zone->v.sf_id != cur->v.sf_id) {
|
|
if (zone && zone->v.sf_id != cur->v.sf_id) {
|
|
/* different instrument was already defined */
|
|
/* different instrument was already defined */
|
|
- snd_sf_zone_t *p;
|
|
|
|
|
|
+ struct snd_sf_zone *p;
|
|
/* compare the allocated time */
|
|
/* compare the allocated time */
|
|
for (p = zone; p; p = p->next_zone) {
|
|
for (p = zone; p; p = p->next_zone) {
|
|
if (p->counter > cur->counter)
|
|
if (p->counter > cur->counter)
|
|
@@ -1174,10 +1193,10 @@ add_preset(snd_sf_list_t *sflist, snd_sf_zone_t *cur)
|
|
* delete the given zones from preset_table
|
|
* delete the given zones from preset_table
|
|
*/
|
|
*/
|
|
static void
|
|
static void
|
|
-delete_preset(snd_sf_list_t *sflist, snd_sf_zone_t *zp)
|
|
|
|
|
|
+delete_preset(struct snd_sf_list *sflist, struct snd_sf_zone *zp)
|
|
{
|
|
{
|
|
int index;
|
|
int index;
|
|
- snd_sf_zone_t *p;
|
|
|
|
|
|
+ struct snd_sf_zone *p;
|
|
|
|
|
|
if ((index = get_index(zp->bank, zp->instr, zp->v.low)) < 0)
|
|
if ((index = get_index(zp->bank, zp->instr, zp->v.low)) < 0)
|
|
return;
|
|
return;
|
|
@@ -1200,10 +1219,10 @@ delete_preset(snd_sf_list_t *sflist, snd_sf_zone_t *zp)
|
|
* This function returns the number of found zones. 0 if not found.
|
|
* This function returns the number of found zones. 0 if not found.
|
|
*/
|
|
*/
|
|
int
|
|
int
|
|
-snd_soundfont_search_zone(snd_sf_list_t *sflist, int *notep, int vel,
|
|
|
|
|
|
+snd_soundfont_search_zone(struct snd_sf_list *sflist, int *notep, int vel,
|
|
int preset, int bank,
|
|
int preset, int bank,
|
|
int def_preset, int def_bank,
|
|
int def_preset, int def_bank,
|
|
- snd_sf_zone_t **table, int max_layers)
|
|
|
|
|
|
+ struct snd_sf_zone **table, int max_layers)
|
|
{
|
|
{
|
|
int nvoices;
|
|
int nvoices;
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
@@ -1217,10 +1236,13 @@ snd_soundfont_search_zone(snd_sf_list_t *sflist, int *notep, int vel,
|
|
spin_unlock_irqrestore(&sflist->lock, flags);
|
|
spin_unlock_irqrestore(&sflist->lock, flags);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
- nvoices = search_zones(sflist, notep, vel, preset, bank, table, max_layers, 0);
|
|
|
|
|
|
+ nvoices = search_zones(sflist, notep, vel, preset, bank,
|
|
|
|
+ table, max_layers, 0);
|
|
if (! nvoices) {
|
|
if (! nvoices) {
|
|
if (preset != def_preset || bank != def_bank)
|
|
if (preset != def_preset || bank != def_bank)
|
|
- nvoices = search_zones(sflist, notep, vel, def_preset, def_bank, table, max_layers, 0);
|
|
|
|
|
|
+ nvoices = search_zones(sflist, notep, vel,
|
|
|
|
+ def_preset, def_bank,
|
|
|
|
+ table, max_layers, 0);
|
|
}
|
|
}
|
|
spin_unlock_irqrestore(&sflist->lock, flags);
|
|
spin_unlock_irqrestore(&sflist->lock, flags);
|
|
return nvoices;
|
|
return nvoices;
|
|
@@ -1230,11 +1252,11 @@ snd_soundfont_search_zone(snd_sf_list_t *sflist, int *notep, int vel,
|
|
/*
|
|
/*
|
|
* search the first matching zone
|
|
* search the first matching zone
|
|
*/
|
|
*/
|
|
-static snd_sf_zone_t *
|
|
|
|
-search_first_zone(snd_sf_list_t *sflist, int bank, int preset, int key)
|
|
|
|
|
|
+static struct snd_sf_zone *
|
|
|
|
+search_first_zone(struct snd_sf_list *sflist, int bank, int preset, int key)
|
|
{
|
|
{
|
|
int index;
|
|
int index;
|
|
- snd_sf_zone_t *zp;
|
|
|
|
|
|
+ struct snd_sf_zone *zp;
|
|
|
|
|
|
if ((index = get_index(bank, preset, key)) < 0)
|
|
if ((index = get_index(bank, preset, key)) < 0)
|
|
return NULL;
|
|
return NULL;
|
|
@@ -1250,9 +1272,11 @@ search_first_zone(snd_sf_list_t *sflist, int bank, int preset, int key)
|
|
* search matching zones from sflist. can be called recursively.
|
|
* search matching zones from sflist. can be called recursively.
|
|
*/
|
|
*/
|
|
static int
|
|
static int
|
|
-search_zones(snd_sf_list_t *sflist, int *notep, int vel, int preset, int bank, snd_sf_zone_t **table, int max_layers, int level)
|
|
|
|
|
|
+search_zones(struct snd_sf_list *sflist, int *notep, int vel,
|
|
|
|
+ int preset, int bank, struct snd_sf_zone **table,
|
|
|
|
+ int max_layers, int level)
|
|
{
|
|
{
|
|
- snd_sf_zone_t *zp;
|
|
|
|
|
|
+ struct snd_sf_zone *zp;
|
|
int nvoices;
|
|
int nvoices;
|
|
|
|
|
|
zp = search_first_zone(sflist, bank, preset, *notep);
|
|
zp = search_first_zone(sflist, bank, preset, *notep);
|
|
@@ -1310,7 +1334,7 @@ get_index(int bank, int instr, int key)
|
|
* Initialise the sflist structure.
|
|
* Initialise the sflist structure.
|
|
*/
|
|
*/
|
|
static void
|
|
static void
|
|
-snd_sf_init(snd_sf_list_t *sflist)
|
|
|
|
|
|
+snd_sf_init(struct snd_sf_list *sflist)
|
|
{
|
|
{
|
|
memset(sflist->presets, 0, sizeof(sflist->presets));
|
|
memset(sflist->presets, 0, sizeof(sflist->presets));
|
|
|
|
|
|
@@ -1329,11 +1353,11 @@ snd_sf_init(snd_sf_list_t *sflist)
|
|
* Release all list records
|
|
* Release all list records
|
|
*/
|
|
*/
|
|
static void
|
|
static void
|
|
-snd_sf_clear(snd_sf_list_t *sflist)
|
|
|
|
|
|
+snd_sf_clear(struct snd_sf_list *sflist)
|
|
{
|
|
{
|
|
- snd_soundfont_t *sf, *nextsf;
|
|
|
|
- snd_sf_zone_t *zp, *nextzp;
|
|
|
|
- snd_sf_sample_t *sp, *nextsp;
|
|
|
|
|
|
+ struct snd_soundfont *sf, *nextsf;
|
|
|
|
+ struct snd_sf_zone *zp, *nextzp;
|
|
|
|
+ struct snd_sf_sample *sp, *nextsp;
|
|
|
|
|
|
for (sf = sflist->fonts; sf; sf = nextsf) {
|
|
for (sf = sflist->fonts; sf; sf = nextsf) {
|
|
nextsf = sf->next;
|
|
nextsf = sf->next;
|
|
@@ -1344,7 +1368,8 @@ snd_sf_clear(snd_sf_list_t *sflist)
|
|
for (sp = sf->samples; sp; sp = nextsp) {
|
|
for (sp = sf->samples; sp; sp = nextsp) {
|
|
nextsp = sp->next;
|
|
nextsp = sp->next;
|
|
if (sflist->callback.sample_free)
|
|
if (sflist->callback.sample_free)
|
|
- sflist->callback.sample_free(sflist->callback.private_data, sp, sflist->memhdr);
|
|
|
|
|
|
+ sflist->callback.sample_free(sflist->callback.private_data,
|
|
|
|
+ sp, sflist->memhdr);
|
|
kfree(sp);
|
|
kfree(sp);
|
|
}
|
|
}
|
|
kfree(sf);
|
|
kfree(sf);
|
|
@@ -1357,10 +1382,10 @@ snd_sf_clear(snd_sf_list_t *sflist)
|
|
/*
|
|
/*
|
|
* Create a new sflist structure
|
|
* Create a new sflist structure
|
|
*/
|
|
*/
|
|
-snd_sf_list_t *
|
|
|
|
-snd_sf_new(snd_sf_callback_t *callback, snd_util_memhdr_t *hdr)
|
|
|
|
|
|
+struct snd_sf_list *
|
|
|
|
+snd_sf_new(struct snd_sf_callback *callback, struct snd_util_memhdr *hdr)
|
|
{
|
|
{
|
|
- snd_sf_list_t *sflist;
|
|
|
|
|
|
+ struct snd_sf_list *sflist;
|
|
|
|
|
|
if ((sflist = kzalloc(sizeof(*sflist), GFP_KERNEL)) == NULL)
|
|
if ((sflist = kzalloc(sizeof(*sflist), GFP_KERNEL)) == NULL)
|
|
return NULL;
|
|
return NULL;
|
|
@@ -1381,7 +1406,7 @@ snd_sf_new(snd_sf_callback_t *callback, snd_util_memhdr_t *hdr)
|
|
* Free everything allocated off the sflist structure.
|
|
* Free everything allocated off the sflist structure.
|
|
*/
|
|
*/
|
|
void
|
|
void
|
|
-snd_sf_free(snd_sf_list_t *sflist)
|
|
|
|
|
|
+snd_sf_free(struct snd_sf_list *sflist)
|
|
{
|
|
{
|
|
if (sflist == NULL)
|
|
if (sflist == NULL)
|
|
return;
|
|
return;
|
|
@@ -1400,7 +1425,7 @@ snd_sf_free(snd_sf_list_t *sflist)
|
|
* The soundcard should be silet before calling this function.
|
|
* The soundcard should be silet before calling this function.
|
|
*/
|
|
*/
|
|
int
|
|
int
|
|
-snd_soundfont_remove_samples(snd_sf_list_t *sflist)
|
|
|
|
|
|
+snd_soundfont_remove_samples(struct snd_sf_list *sflist)
|
|
{
|
|
{
|
|
lock_preset(sflist);
|
|
lock_preset(sflist);
|
|
if (sflist->callback.sample_reset)
|
|
if (sflist->callback.sample_reset)
|
|
@@ -1416,11 +1441,11 @@ snd_soundfont_remove_samples(snd_sf_list_t *sflist)
|
|
* The soundcard should be silent before calling this function.
|
|
* The soundcard should be silent before calling this function.
|
|
*/
|
|
*/
|
|
int
|
|
int
|
|
-snd_soundfont_remove_unlocked(snd_sf_list_t *sflist)
|
|
|
|
|
|
+snd_soundfont_remove_unlocked(struct snd_sf_list *sflist)
|
|
{
|
|
{
|
|
- snd_soundfont_t *sf;
|
|
|
|
- snd_sf_zone_t *zp, *nextzp;
|
|
|
|
- snd_sf_sample_t *sp, *nextsp;
|
|
|
|
|
|
+ struct snd_soundfont *sf;
|
|
|
|
+ struct snd_sf_zone *zp, *nextzp;
|
|
|
|
+ struct snd_sf_sample *sp, *nextsp;
|
|
|
|
|
|
lock_preset(sflist);
|
|
lock_preset(sflist);
|
|
|
|
|
|
@@ -1446,7 +1471,8 @@ snd_soundfont_remove_unlocked(snd_sf_list_t *sflist)
|
|
sf->samples = nextsp;
|
|
sf->samples = nextsp;
|
|
sflist->mem_used -= sp->v.truesize;
|
|
sflist->mem_used -= sp->v.truesize;
|
|
if (sflist->callback.sample_free)
|
|
if (sflist->callback.sample_free)
|
|
- sflist->callback.sample_free(sflist->callback.private_data, sp, sflist->memhdr);
|
|
|
|
|
|
+ sflist->callback.sample_free(sflist->callback.private_data,
|
|
|
|
+ sp, sflist->memhdr);
|
|
kfree(sp);
|
|
kfree(sp);
|
|
}
|
|
}
|
|
}
|
|
}
|