Lines Matching refs:sp

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