Lines Matching refs:sp
147 snd_emu8000_sample_new(struct snd_emux *rec, struct snd_sf_sample *sp, in snd_emu8000_sample_new() argument
159 if (snd_BUG_ON(!sp)) in snd_emu8000_sample_new()
162 if (sp->v.size == 0) in snd_emu8000_sample_new()
166 if (sp->v.loopstart > sp->v.loopend) { in snd_emu8000_sample_new()
167 int tmp = sp->v.loopstart; in snd_emu8000_sample_new()
168 sp->v.loopstart = sp->v.loopend; in snd_emu8000_sample_new()
169 sp->v.loopend = tmp; in snd_emu8000_sample_new()
173 truesize = sp->v.size; in snd_emu8000_sample_new()
174 if (sp->v.mode_flags & (SNDRV_SFNT_SAMPLE_BIDIR_LOOP|SNDRV_SFNT_SAMPLE_REVERSE_LOOP)) in snd_emu8000_sample_new()
175 truesize += sp->v.loopend - sp->v.loopstart; in snd_emu8000_sample_new()
176 if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_NO_BLANK) in snd_emu8000_sample_new()
179 sp->block = snd_util_mem_alloc(hdr, truesize * 2); in snd_emu8000_sample_new()
180 if (sp->block == NULL) { in snd_emu8000_sample_new()
186 if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_8BITS) { in snd_emu8000_sample_new()
187 if (!access_ok(VERIFY_READ, data, sp->v.size)) in snd_emu8000_sample_new()
190 if (!access_ok(VERIFY_READ, data, sp->v.size * 2)) in snd_emu8000_sample_new()
195 sp->v.end -= sp->v.start; in snd_emu8000_sample_new()
196 sp->v.loopstart -= sp->v.start; in snd_emu8000_sample_new()
197 sp->v.loopend -= sp->v.start; in snd_emu8000_sample_new()
198 sp->v.start = 0; in snd_emu8000_sample_new()
201 dram_offset = EMU8000_DRAM_OFFSET + (sp->block->offset >> 1); in snd_emu8000_sample_new()
205 sp->v.truesize = truesize * 2; /* in bytes */ in snd_emu8000_sample_new()
219 if (! sp->block->offset) { in snd_emu8000_sample_new()
227 for (i = 0; i < sp->v.size; i++) { in snd_emu8000_sample_new()
230 s = read_word(data, offset, sp->v.mode_flags); in snd_emu8000_sample_new()
239 if (i == sp->v.loopend && in snd_emu8000_sample_new()
240 (sp->v.mode_flags & (SNDRV_SFNT_SAMPLE_BIDIR_LOOP|SNDRV_SFNT_SAMPLE_REVERSE_LOOP))) in snd_emu8000_sample_new()
242 int looplen = sp->v.loopend - sp->v.loopstart; in snd_emu8000_sample_new()
247 s = read_word(data, offset - k, sp->v.mode_flags); in snd_emu8000_sample_new()
250 if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_BIDIR_LOOP) { in snd_emu8000_sample_new()
251 sp->v.loopend += looplen; in snd_emu8000_sample_new()
253 sp->v.loopstart += looplen; in snd_emu8000_sample_new()
254 sp->v.loopend += looplen; in snd_emu8000_sample_new()
256 sp->v.end += looplen; in snd_emu8000_sample_new()
261 if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_NO_BLANK) { in snd_emu8000_sample_new()
265 if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_SINGLESHOT) { in snd_emu8000_sample_new()
266 sp->v.loopstart = sp->v.end + BLANK_LOOP_START; in snd_emu8000_sample_new()
267 sp->v.loopend = sp->v.end + BLANK_LOOP_END; in snd_emu8000_sample_new()
272 sp->v.start += dram_start; in snd_emu8000_sample_new()
273 sp->v.end += dram_start; in snd_emu8000_sample_new()
274 sp->v.loopstart += dram_start; in snd_emu8000_sample_new()
275 sp->v.loopend += dram_start; in snd_emu8000_sample_new()
287 snd_emu8000_sample_free(struct snd_emux *rec, struct snd_sf_sample *sp, in snd_emu8000_sample_free() argument
290 if (sp->block) { in snd_emu8000_sample_free()
291 snd_util_mem_free(hdr, sp->block); in snd_emu8000_sample_free()
292 sp->block = NULL; in snd_emu8000_sample_free()