Lines Matching refs:sp
136 snd_emu8000_sample_new(struct snd_emux *rec, struct snd_sf_sample *sp, in snd_emu8000_sample_new() argument
148 if (snd_BUG_ON(!sp)) in snd_emu8000_sample_new()
151 if (sp->v.size == 0) in snd_emu8000_sample_new()
155 if (sp->v.loopstart > sp->v.loopend) in snd_emu8000_sample_new()
156 swap(sp->v.loopstart, sp->v.loopend); in snd_emu8000_sample_new()
159 truesize = sp->v.size; in snd_emu8000_sample_new()
160 if (sp->v.mode_flags & (SNDRV_SFNT_SAMPLE_BIDIR_LOOP|SNDRV_SFNT_SAMPLE_REVERSE_LOOP)) in snd_emu8000_sample_new()
161 truesize += sp->v.loopend - sp->v.loopstart; in snd_emu8000_sample_new()
162 if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_NO_BLANK) in snd_emu8000_sample_new()
165 sp->block = snd_util_mem_alloc(hdr, truesize * 2); in snd_emu8000_sample_new()
166 if (sp->block == NULL) { in snd_emu8000_sample_new()
172 if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_8BITS) { in snd_emu8000_sample_new()
173 if (!access_ok(data, sp->v.size)) in snd_emu8000_sample_new()
176 if (!access_ok(data, sp->v.size * 2)) in snd_emu8000_sample_new()
181 sp->v.end -= sp->v.start; in snd_emu8000_sample_new()
182 sp->v.loopstart -= sp->v.start; in snd_emu8000_sample_new()
183 sp->v.loopend -= sp->v.start; in snd_emu8000_sample_new()
184 sp->v.start = 0; in snd_emu8000_sample_new()
187 dram_offset = EMU8000_DRAM_OFFSET + (sp->block->offset >> 1); in snd_emu8000_sample_new()
191 sp->v.truesize = truesize * 2; /* in bytes */ in snd_emu8000_sample_new()
206 if (! sp->block->offset) { in snd_emu8000_sample_new()
214 for (i = 0; i < sp->v.size; i++) { in snd_emu8000_sample_new()
217 s = read_word(data, offset, sp->v.mode_flags); in snd_emu8000_sample_new()
226 if (i == sp->v.loopend && in snd_emu8000_sample_new()
227 (sp->v.mode_flags & (SNDRV_SFNT_SAMPLE_BIDIR_LOOP|SNDRV_SFNT_SAMPLE_REVERSE_LOOP))) in snd_emu8000_sample_new()
229 int looplen = sp->v.loopend - sp->v.loopstart; in snd_emu8000_sample_new()
234 s = read_word(data, offset - k, sp->v.mode_flags); in snd_emu8000_sample_new()
237 if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_BIDIR_LOOP) { in snd_emu8000_sample_new()
238 sp->v.loopend += looplen; in snd_emu8000_sample_new()
240 sp->v.loopstart += looplen; in snd_emu8000_sample_new()
241 sp->v.loopend += looplen; in snd_emu8000_sample_new()
243 sp->v.end += looplen; in snd_emu8000_sample_new()
248 if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_NO_BLANK) { in snd_emu8000_sample_new()
252 if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_SINGLESHOT) { in snd_emu8000_sample_new()
253 sp->v.loopstart = sp->v.end + BLANK_LOOP_START; in snd_emu8000_sample_new()
254 sp->v.loopend = sp->v.end + BLANK_LOOP_END; in snd_emu8000_sample_new()
259 sp->v.start += dram_start; in snd_emu8000_sample_new()
260 sp->v.end += dram_start; in snd_emu8000_sample_new()
261 sp->v.loopstart += dram_start; in snd_emu8000_sample_new()
262 sp->v.loopend += dram_start; in snd_emu8000_sample_new()
274 snd_emu8000_sample_free(struct snd_emux *rec, struct snd_sf_sample *sp, in snd_emu8000_sample_free() argument
277 if (sp->block) { in snd_emu8000_sample_free()
278 snd_util_mem_free(hdr, sp->block); in snd_emu8000_sample_free()
279 sp->block = NULL; in snd_emu8000_sample_free()