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()
205 if (! sp->block->offset) { in snd_emu8000_sample_new()
213 for (i = 0; i < sp->v.size; i++) { in snd_emu8000_sample_new()
216 s = read_word(data, offset, sp->v.mode_flags); in snd_emu8000_sample_new()
225 if (i == sp->v.loopend && in snd_emu8000_sample_new()
226 (sp->v.mode_flags & (SNDRV_SFNT_SAMPLE_BIDIR_LOOP|SNDRV_SFNT_SAMPLE_REVERSE_LOOP))) in snd_emu8000_sample_new()
228 int looplen = sp->v.loopend - sp->v.loopstart; in snd_emu8000_sample_new()
233 s = read_word(data, offset - k, sp->v.mode_flags); in snd_emu8000_sample_new()
236 if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_BIDIR_LOOP) { in snd_emu8000_sample_new()
237 sp->v.loopend += looplen; in snd_emu8000_sample_new()
239 sp->v.loopstart += looplen; in snd_emu8000_sample_new()
240 sp->v.loopend += looplen; in snd_emu8000_sample_new()
242 sp->v.end += looplen; in snd_emu8000_sample_new()
247 if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_NO_BLANK) { in snd_emu8000_sample_new()
251 if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_SINGLESHOT) { in snd_emu8000_sample_new()
252 sp->v.loopstart = sp->v.end + BLANK_LOOP_START; in snd_emu8000_sample_new()
253 sp->v.loopend = sp->v.end + BLANK_LOOP_END; in snd_emu8000_sample_new()
258 sp->v.start += dram_start; in snd_emu8000_sample_new()
259 sp->v.end += dram_start; in snd_emu8000_sample_new()
260 sp->v.loopstart += dram_start; in snd_emu8000_sample_new()
261 sp->v.loopend += dram_start; in snd_emu8000_sample_new()
273 snd_emu8000_sample_free(struct snd_emux *rec, struct snd_sf_sample *sp, in snd_emu8000_sample_free() argument
276 if (sp->block) { in snd_emu8000_sample_free()
277 snd_util_mem_free(hdr, sp->block); in snd_emu8000_sample_free()
278 sp->block = NULL; in snd_emu8000_sample_free()