diff options
Diffstat (limited to 'include/sound/soundfont.h')
-rw-r--r-- | include/sound/soundfont.h | 75 |
1 files changed, 37 insertions, 38 deletions
diff --git a/include/sound/soundfont.h b/include/sound/soundfont.h index c992958f5e3c..61a010c65d02 100644 --- a/include/sound/soundfont.h +++ b/include/sound/soundfont.h | |||
@@ -29,94 +29,93 @@ | |||
29 | #define SF_MAX_PRESETS 256 /* drums are mapped from 128 to 256 */ | 29 | #define SF_MAX_PRESETS 256 /* drums are mapped from 128 to 256 */ |
30 | #define SF_IS_DRUM_BANK(z) ((z) == 128) | 30 | #define SF_IS_DRUM_BANK(z) ((z) == 128) |
31 | 31 | ||
32 | typedef struct snd_sf_zone { | 32 | struct snd_sf_zone { |
33 | struct snd_sf_zone *next; /* Link to next */ | 33 | struct snd_sf_zone *next; /* Link to next */ |
34 | unsigned char bank; /* Midi bank for this zone */ | 34 | unsigned char bank; /* Midi bank for this zone */ |
35 | unsigned char instr; /* Midi program for this zone */ | 35 | unsigned char instr; /* Midi program for this zone */ |
36 | unsigned char mapped; /* True if mapped to something else */ | 36 | unsigned char mapped; /* True if mapped to something else */ |
37 | 37 | ||
38 | soundfont_voice_info_t v; /* All the soundfont parameters */ | 38 | struct soundfont_voice_info v; /* All the soundfont parameters */ |
39 | int counter; | 39 | int counter; |
40 | struct snd_sf_sample *sample; /* Link to sample */ | 40 | struct snd_sf_sample *sample; /* Link to sample */ |
41 | 41 | ||
42 | /* The following deals with preset numbers (programs) */ | 42 | /* The following deals with preset numbers (programs) */ |
43 | struct snd_sf_zone *next_instr; /* Next zone of this instrument */ | 43 | struct snd_sf_zone *next_instr; /* Next zone of this instrument */ |
44 | struct snd_sf_zone *next_zone; /* Next zone in play list */ | 44 | struct snd_sf_zone *next_zone; /* Next zone in play list */ |
45 | } snd_sf_zone_t; | 45 | }; |
46 | 46 | ||
47 | typedef struct snd_sf_sample { | 47 | struct snd_sf_sample { |
48 | soundfont_sample_info_t v; | 48 | struct soundfont_sample_info v; |
49 | int counter; | 49 | int counter; |
50 | snd_util_memblk_t *block; /* allocated data block */ | 50 | struct snd_util_memblk *block; /* allocated data block */ |
51 | struct snd_sf_sample *next; | 51 | struct snd_sf_sample *next; |
52 | } snd_sf_sample_t; | 52 | }; |
53 | 53 | ||
54 | /* | 54 | /* |
55 | * This represents all the information relating to a soundfont. | 55 | * This represents all the information relating to a soundfont. |
56 | */ | 56 | */ |
57 | typedef struct snd_soundfont { | 57 | struct snd_soundfont { |
58 | struct snd_soundfont *next; /* Link to next */ | 58 | struct snd_soundfont *next; /* Link to next */ |
59 | /*struct snd_soundfont *prev;*/ /* Link to previous */ | 59 | /*struct snd_soundfont *prev;*/ /* Link to previous */ |
60 | short id; /* file id */ | 60 | short id; /* file id */ |
61 | short type; /* font type */ | 61 | short type; /* font type */ |
62 | unsigned char name[SNDRV_SFNT_PATCH_NAME_LEN]; /* identifier */ | 62 | unsigned char name[SNDRV_SFNT_PATCH_NAME_LEN]; /* identifier */ |
63 | snd_sf_zone_t *zones; /* Font information */ | 63 | struct snd_sf_zone *zones; /* Font information */ |
64 | snd_sf_sample_t *samples; /* The sample headers */ | 64 | struct snd_sf_sample *samples; /* The sample headers */ |
65 | } snd_soundfont_t; | 65 | }; |
66 | 66 | ||
67 | /* | 67 | /* |
68 | * Type of the sample access callback | 68 | * Type of the sample access callback |
69 | */ | 69 | */ |
70 | typedef int (*snd_sf_sample_new_t)(void *private_data, snd_sf_sample_t *sp, | 70 | struct snd_sf_callback { |
71 | snd_util_memhdr_t *hdr, const void __user *buf, long count); | ||
72 | typedef int (*snd_sf_sample_free_t)(void *private_data, snd_sf_sample_t *sp, | ||
73 | snd_util_memhdr_t *hdr); | ||
74 | typedef void (*snd_sf_sample_reset_t)(void *private); | ||
75 | |||
76 | typedef struct snd_sf_callback { | ||
77 | void *private_data; | 71 | void *private_data; |
78 | snd_sf_sample_new_t sample_new; | 72 | int (*sample_new)(void *private_data, struct snd_sf_sample *sp, |
79 | snd_sf_sample_free_t sample_free; | 73 | struct snd_util_memhdr *hdr, |
80 | snd_sf_sample_reset_t sample_reset; | 74 | const void __user *buf, long count); |
81 | } snd_sf_callback_t; | 75 | int (*sample_free)(void *private_data, struct snd_sf_sample *sp, |
76 | struct snd_util_memhdr *hdr); | ||
77 | void (*sample_reset)(void *private); | ||
78 | }; | ||
82 | 79 | ||
83 | /* | 80 | /* |
84 | * List of soundfonts. | 81 | * List of soundfonts. |
85 | */ | 82 | */ |
86 | typedef struct snd_sf_list { | 83 | struct snd_sf_list { |
87 | snd_soundfont_t *currsf; /* The currently open soundfont */ | 84 | struct snd_soundfont *currsf; /* The currently open soundfont */ |
88 | int open_client; /* client pointer for lock */ | 85 | int open_client; /* client pointer for lock */ |
89 | int mem_used; /* used memory size */ | 86 | int mem_used; /* used memory size */ |
90 | snd_sf_zone_t *presets[SF_MAX_PRESETS]; | 87 | struct snd_sf_zone *presets[SF_MAX_PRESETS]; |
91 | snd_soundfont_t *fonts; /* The list of soundfonts */ | 88 | struct snd_soundfont *fonts; /* The list of soundfonts */ |
92 | int fonts_size; /* number of fonts allocated */ | 89 | int fonts_size; /* number of fonts allocated */ |
93 | int zone_counter; /* last allocated time for zone */ | 90 | int zone_counter; /* last allocated time for zone */ |
94 | int sample_counter; /* last allocated time for sample */ | 91 | int sample_counter; /* last allocated time for sample */ |
95 | int zone_locked; /* locked time for zone */ | 92 | int zone_locked; /* locked time for zone */ |
96 | int sample_locked; /* locked time for sample */ | 93 | int sample_locked; /* locked time for sample */ |
97 | snd_sf_callback_t callback; /* callback functions */ | 94 | struct snd_sf_callback callback; /* callback functions */ |
98 | int presets_locked; | 95 | int presets_locked; |
99 | struct semaphore presets_mutex; | 96 | struct semaphore presets_mutex; |
100 | spinlock_t lock; | 97 | spinlock_t lock; |
101 | snd_util_memhdr_t *memhdr; | 98 | struct snd_util_memhdr *memhdr; |
102 | } snd_sf_list_t; | 99 | }; |
103 | 100 | ||
104 | /* Prototypes for soundfont.c */ | 101 | /* Prototypes for soundfont.c */ |
105 | int snd_soundfont_load(snd_sf_list_t *sflist, const void __user *data, long count, int client); | 102 | int snd_soundfont_load(struct snd_sf_list *sflist, const void __user *data, |
106 | int snd_soundfont_load_guspatch(snd_sf_list_t *sflist, const char __user *data, | 103 | long count, int client); |
104 | int snd_soundfont_load_guspatch(struct snd_sf_list *sflist, const char __user *data, | ||
107 | long count, int client); | 105 | long count, int client); |
108 | int snd_soundfont_close_check(snd_sf_list_t *sflist, int client); | 106 | int snd_soundfont_close_check(struct snd_sf_list *sflist, int client); |
109 | 107 | ||
110 | snd_sf_list_t *snd_sf_new(snd_sf_callback_t *callback, snd_util_memhdr_t *hdr); | 108 | struct snd_sf_list *snd_sf_new(struct snd_sf_callback *callback, |
111 | void snd_sf_free(snd_sf_list_t *sflist); | 109 | struct snd_util_memhdr *hdr); |
110 | void snd_sf_free(struct snd_sf_list *sflist); | ||
112 | 111 | ||
113 | int snd_soundfont_remove_samples(snd_sf_list_t *sflist); | 112 | int snd_soundfont_remove_samples(struct snd_sf_list *sflist); |
114 | int snd_soundfont_remove_unlocked(snd_sf_list_t *sflist); | 113 | int snd_soundfont_remove_unlocked(struct snd_sf_list *sflist); |
115 | 114 | ||
116 | int snd_soundfont_search_zone(snd_sf_list_t *sflist, int *notep, int vel, | 115 | int snd_soundfont_search_zone(struct snd_sf_list *sflist, int *notep, int vel, |
117 | int preset, int bank, | 116 | int preset, int bank, |
118 | int def_preset, int def_bank, | 117 | int def_preset, int def_bank, |
119 | snd_sf_zone_t **table, int max_layers); | 118 | struct snd_sf_zone **table, int max_layers); |
120 | 119 | ||
121 | /* Parameter conversions */ | 120 | /* Parameter conversions */ |
122 | int snd_sf_calc_parm_hold(int msec); | 121 | int snd_sf_calc_parm_hold(int msec); |