Lines Matching full:sp
25 snd_emu10k1_sample_new(struct snd_emux *rec, struct snd_sf_sample *sp, in snd_emu10k1_sample_new() argument
37 if (snd_BUG_ON(!sp || !hdr)) in snd_emu10k1_sample_new()
40 if (sp->v.size == 0) { in snd_emu10k1_sample_new()
42 "emu: rom font for sample %d\n", sp->v.sample); in snd_emu10k1_sample_new()
47 sp->v.end -= sp->v.start; in snd_emu10k1_sample_new()
48 sp->v.loopstart -= sp->v.start; in snd_emu10k1_sample_new()
49 sp->v.loopend -= sp->v.start; in snd_emu10k1_sample_new()
50 sp->v.start = 0; in snd_emu10k1_sample_new()
53 sampleend = sp->v.end; in snd_emu10k1_sample_new()
54 if (sampleend > sp->v.size) in snd_emu10k1_sample_new()
55 sampleend = sp->v.size; in snd_emu10k1_sample_new()
56 loopend = sp->v.loopend; in snd_emu10k1_sample_new()
61 if (sp->v.loopstart >= sp->v.loopend) in snd_emu10k1_sample_new()
62 swap(sp->v.loopstart, sp->v.loopend); in snd_emu10k1_sample_new()
65 truesize = sp->v.size + BLANK_HEAD_SIZE; in snd_emu10k1_sample_new()
68 if (sp->v.mode_flags & (SNDRV_SFNT_SAMPLE_BIDIR_LOOP|SNDRV_SFNT_SAMPLE_REVERSE_LOOP)) in snd_emu10k1_sample_new()
69 loopsize = sp->v.loopend - sp->v.loopstart; in snd_emu10k1_sample_new()
72 if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_NO_BLANK) in snd_emu10k1_sample_new()
77 if (! (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_8BITS)) in snd_emu10k1_sample_new()
79 sp->block = snd_emu10k1_synth_alloc(emu, blocksize); in snd_emu10k1_sample_new()
80 if (sp->block == NULL) { in snd_emu10k1_sample_new()
87 sp->v.truesize = blocksize; in snd_emu10k1_sample_new()
92 if (! (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_8BITS)) in snd_emu10k1_sample_new()
96 snd_emu10k1_synth_bzero(emu, sp->block, offset, size); in snd_emu10k1_sample_new()
101 if (! (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_8BITS)) in snd_emu10k1_sample_new()
105 if (snd_emu10k1_synth_copy_from_user(emu, sp->block, offset, data, size)) { in snd_emu10k1_sample_new()
106 snd_emu10k1_synth_free(emu, sp->block); in snd_emu10k1_sample_new()
107 sp->block = NULL; in snd_emu10k1_sample_new()
115 if (sp->v.mode_flags & (SNDRV_SFNT_SAMPLE_BIDIR_LOOP|SNDRV_SFNT_SAMPLE_REVERSE_LOOP)) { in snd_emu10k1_sample_new()
117 if (! (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_8BITS)) { in snd_emu10k1_sample_new()
135 if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_BIDIR_LOOP) { in snd_emu10k1_sample_new()
136 sp->v.loopend += loopsize; in snd_emu10k1_sample_new()
138 sp->v.loopstart += loopsize; in snd_emu10k1_sample_new()
139 sp->v.loopend += loopsize; in snd_emu10k1_sample_new()
142 sp->v.end += loopsize; in snd_emu10k1_sample_new()
147 size = sp->v.size - loopend; in snd_emu10k1_sample_new()
150 if (! (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_8BITS)) in snd_emu10k1_sample_new()
152 if (snd_emu10k1_synth_copy_from_user(emu, sp->block, offset, data, size)) { in snd_emu10k1_sample_new()
153 snd_emu10k1_synth_free(emu, sp->block); in snd_emu10k1_sample_new()
154 sp->block = NULL; in snd_emu10k1_sample_new()
161 snd_emu10k1_synth_bzero(emu, sp->block, offset, blocksize - offset); in snd_emu10k1_sample_new()
163 if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_NO_BLANK) { in snd_emu10k1_sample_new()
165 if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_SINGLESHOT) { in snd_emu10k1_sample_new()
166 sp->v.loopstart = sp->v.end + BLANK_LOOP_START; in snd_emu10k1_sample_new()
167 sp->v.loopend = sp->v.end + BLANK_LOOP_END; in snd_emu10k1_sample_new()
172 if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_UNSIGNED) { in snd_emu10k1_sample_new()
174 if (! (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_8BITS)) { in snd_emu10k1_sample_new()
187 if (! (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_8BITS)) in snd_emu10k1_sample_new()
189 sp->v.start += start_addr; in snd_emu10k1_sample_new()
190 sp->v.end += start_addr; in snd_emu10k1_sample_new()
191 sp->v.loopstart += start_addr; in snd_emu10k1_sample_new()
192 sp->v.loopend += start_addr; in snd_emu10k1_sample_new()
201 snd_emu10k1_sample_free(struct snd_emux *rec, struct snd_sf_sample *sp, in snd_emu10k1_sample_free() argument
207 if (snd_BUG_ON(!sp || !hdr)) in snd_emu10k1_sample_free()
210 if (sp->block) { in snd_emu10k1_sample_free()
211 snd_emu10k1_synth_free(emu, sp->block); in snd_emu10k1_sample_free()
212 sp->block = NULL; in snd_emu10k1_sample_free()