Lines Matching +full:sample +full:- +full:at +full:- +full:reset
1 // SPDX-License-Identifier: GPL-2.0-or-later
6 * Copyright (C) 1999-2000 Takashi Iwai <tiwai@suse.de>
17 MODULE_PARM_DESC(emu8000_reset_addr, "reset write address at each time (makes slowdown)");
30 snd_emux_lock_voice(emu->emu, i); in snd_emu8000_open_dma()
57 snd_emux_unlock_voice(emu->emu, i); in snd_emu8000_close_dma()
80 c = cc << 8; /* convert 8bit -> 16bit */ in read_word()
91 c ^= 0x8000; /* unsigned -> signed */ in read_word()
108 * write sample word data
112 * It mostly does, but during writes of some samples at random it
116 * This is therefore much slower than need be, but is at least
132 * Write the sample to EMU800 memory. This routine is invoked out of
147 emu = rec->hw; in snd_emu8000_sample_new()
149 return -EINVAL; in snd_emu8000_sample_new()
152 truesize = sp->v.size; in snd_emu8000_sample_new()
153 if (sp->v.mode_flags & (SNDRV_SFNT_SAMPLE_BIDIR_LOOP|SNDRV_SFNT_SAMPLE_REVERSE_LOOP)) in snd_emu8000_sample_new()
154 truesize += sp->v.loopend - sp->v.loopstart; in snd_emu8000_sample_new()
155 if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_NO_BLANK) in snd_emu8000_sample_new()
158 sp->block = snd_util_mem_alloc(hdr, truesize * 2); in snd_emu8000_sample_new()
159 if (sp->block == NULL) { in snd_emu8000_sample_new()
161 return -ENOSPC; in snd_emu8000_sample_new()
164 if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_8BITS) { in snd_emu8000_sample_new()
165 if (!access_ok(data, sp->v.size)) in snd_emu8000_sample_new()
166 return -EFAULT; in snd_emu8000_sample_new()
168 if (!access_ok(data, sp->v.size * 2)) in snd_emu8000_sample_new()
169 return -EFAULT; in snd_emu8000_sample_new()
172 /* dram position (in word) -- mem_offset is byte */ in snd_emu8000_sample_new()
173 dram_offset = EMU8000_DRAM_OFFSET + (sp->block->offset >> 1); in snd_emu8000_sample_new()
177 sp->v.truesize = truesize * 2; /* in bytes */ in snd_emu8000_sample_new()
179 snd_emux_terminate_all(emu->emu); in snd_emu8000_sample_new()
184 /* Set the address to start writing at */ in snd_emu8000_sample_new()
191 /* first block - write 48 samples for silence */ in snd_emu8000_sample_new()
192 if (! sp->block->offset) { in snd_emu8000_sample_new()
200 for (i = 0; i < sp->v.size; i++) { in snd_emu8000_sample_new()
203 s = read_word(data, offset, sp->v.mode_flags); in snd_emu8000_sample_new()
212 if (i == sp->v.loopend && in snd_emu8000_sample_new()
213 (sp->v.mode_flags & (SNDRV_SFNT_SAMPLE_BIDIR_LOOP|SNDRV_SFNT_SAMPLE_REVERSE_LOOP))) in snd_emu8000_sample_new()
215 int looplen = sp->v.loopend - sp->v.loopstart; in snd_emu8000_sample_new()
220 s = read_word(data, offset - k, sp->v.mode_flags); in snd_emu8000_sample_new()
223 if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_BIDIR_LOOP) { in snd_emu8000_sample_new()
224 sp->v.loopend += looplen; in snd_emu8000_sample_new()
226 sp->v.loopstart += looplen; in snd_emu8000_sample_new()
227 sp->v.loopend += looplen; in snd_emu8000_sample_new()
229 sp->v.end += looplen; in snd_emu8000_sample_new()
233 /* if no blank loop is attached in the sample, add it */ in snd_emu8000_sample_new()
234 if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_NO_BLANK) { in snd_emu8000_sample_new()
238 if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_SINGLESHOT) { in snd_emu8000_sample_new()
239 sp->v.loopstart = sp->v.end + BLANK_LOOP_START; in snd_emu8000_sample_new()
240 sp->v.loopend = sp->v.end + BLANK_LOOP_END; in snd_emu8000_sample_new()
245 sp->v.start += dram_start; in snd_emu8000_sample_new()
246 sp->v.end += dram_start; in snd_emu8000_sample_new()
247 sp->v.loopstart += dram_start; in snd_emu8000_sample_new()
248 sp->v.loopend += dram_start; in snd_emu8000_sample_new()
257 * free a sample block
263 if (sp->block) { in snd_emu8000_sample_free()
264 snd_util_mem_free(hdr, sp->block); in snd_emu8000_sample_free()
265 sp->block = NULL; in snd_emu8000_sample_free()
272 * sample_reset callback - terminate voices