Lines Matching refs:woinst

49 	struct woinst *woinst = wave_dev->woinst;  in query_format()  local
58 woinst->num_voices = 1; in query_format()
60 woinst->num_voices = wave_fmt->channels; in query_format()
91 if (i < 0 || j < 0 || woinst->state != WAVE_STATE_CLOSED || in query_format()
120 static int get_voice(struct emu10k1_card *card, struct woinst *woinst, unsigned int voicenum) in get_voice() argument
122 struct emu_voice *voice = &woinst->voice[voicenum]; in get_voice()
130 if (woinst->format.channels == 2) in get_voice()
133 if (woinst->format.bitsperchannel == 16) in get_voice()
142 voice->initial_pitch = (u16) (srToPitch(woinst->format.samplingrate) >> 8); in get_voice()
143 voice->pitch_target = samplerate_to_linearpitch(woinst->format.samplingrate); in get_voice()
148 woinst->format.bytespervoicesample; in get_voice()
149 voice->endloop = voice->startloop + woinst->buffer.size / woinst->format.bytespervoicesample; in get_voice()
158 if (woinst->device) in get_voice()
174 if (woinst->device) in get_voice()
185 if (woinst->num_voices > 1) { in get_voice()
199 if (woinst->device) in get_voice()
222 struct woinst *woinst = wave_dev->woinst; in emu10k1_waveout_open() local
223 struct waveout_buffer *buffer = &woinst->buffer; in emu10k1_waveout_open()
229 for (voicenum = 0; voicenum < woinst->num_voices; voicenum++) { in emu10k1_waveout_open()
230 if (emu10k1_voice_alloc_buffer(card, &woinst->voice[voicenum].mem, woinst->buffer.pages) < 0) { in emu10k1_waveout_open()
236 if (get_voice(card, woinst, voicenum) < 0) { in emu10k1_waveout_open()
247 buffer->free_bytes = woinst->buffer.size; in emu10k1_waveout_open()
249 delay = (48000 * woinst->buffer.fragment_size) / in emu10k1_waveout_open()
250 (woinst->format.samplingrate * woinst->format.bytespervoicesample); in emu10k1_waveout_open()
252 emu10k1_timer_install(card, &woinst->timer, delay); in emu10k1_waveout_open()
254 woinst->state = WAVE_STATE_OPEN; in emu10k1_waveout_open()
262 struct woinst *woinst = wave_dev->woinst; in emu10k1_waveout_close() local
269 emu10k1_timer_uninstall(card, &woinst->timer); in emu10k1_waveout_close()
271 for (voicenum = 0; voicenum < woinst->num_voices; voicenum++) { in emu10k1_waveout_close()
272 emu10k1_voice_free(&woinst->voice[voicenum]); in emu10k1_waveout_close()
273 emu10k1_voice_free_buffer(card, &woinst->voice[voicenum].mem); in emu10k1_waveout_close()
276 woinst->state = WAVE_STATE_CLOSED; in emu10k1_waveout_close()
282 struct woinst *woinst = wave_dev->woinst; in emu10k1_waveout_start() local
287 emu10k1_voices_start(woinst->voice, woinst->num_voices, woinst->total_played); in emu10k1_waveout_start()
289 emu10k1_timer_enable(card, &woinst->timer); in emu10k1_waveout_start()
291 woinst->state |= WAVE_STATE_STARTED; in emu10k1_waveout_start()
297 struct woinst *woinst = wave_dev->woinst; in emu10k1_waveout_setformat() local
303 if (woinst->state & WAVE_STATE_STARTED) in emu10k1_waveout_setformat()
308 if (woinst->format.samplingrate != format->samplingrate || in emu10k1_waveout_setformat()
309 woinst->format.channels != format->channels || in emu10k1_waveout_setformat()
310 woinst->format.bitsperchannel != format->bitsperchannel) { in emu10k1_waveout_setformat()
312 woinst->format = *format; in emu10k1_waveout_setformat()
314 if (woinst->state == WAVE_STATE_CLOSED) in emu10k1_waveout_setformat()
317 emu10k1_timer_uninstall(card, &woinst->timer); in emu10k1_waveout_setformat()
319 for (voicenum = 0; voicenum < woinst->num_voices; voicenum++) { in emu10k1_waveout_setformat()
320 emu10k1_voice_free(&woinst->voice[voicenum]); in emu10k1_waveout_setformat()
322 if (get_voice(card, woinst, voicenum) < 0) { in emu10k1_waveout_setformat()
329 delay = (48000 * woinst->buffer.fragment_size) / in emu10k1_waveout_setformat()
330 (woinst->format.samplingrate * woinst->format.bytespervoicesample); in emu10k1_waveout_setformat()
332 emu10k1_timer_install(card, &woinst->timer, delay); in emu10k1_waveout_setformat()
341 struct woinst *woinst = wave_dev->woinst; in emu10k1_waveout_stop() local
345 if (!(woinst->state & WAVE_STATE_STARTED)) in emu10k1_waveout_stop()
348 emu10k1_timer_disable(card, &woinst->timer); in emu10k1_waveout_stop()
351 emu10k1_voices_stop(woinst->voice, woinst->num_voices); in emu10k1_waveout_stop()
353 emu10k1_waveout_update(woinst); in emu10k1_waveout_stop()
355 woinst->state &= ~WAVE_STATE_STARTED; in emu10k1_waveout_stop()
365 void emu10k1_waveout_getxfersize(struct woinst *woinst, u32 *total_free_bytes) in emu10k1_waveout_getxfersize() argument
367 struct waveout_buffer *buffer = &woinst->buffer; in emu10k1_waveout_getxfersize()
370 if (woinst->mmapped) { in emu10k1_waveout_getxfersize()
431 static void copy_ilv_block(struct woinst *woinst, u32 str, u8 *src, u32 len) in copy_ilv_block() argument
436 struct emu_voice *voice = woinst->voice; in copy_ilv_block()
442 for (voice_num = 0; voice_num < woinst->num_voices; voice_num++) { in copy_ilv_block()
443 …__copy_from_user((u8 *)(voice[voice_num].mem.addr[pg]) + pgoff, src, woinst->format.bytespervoices… in copy_ilv_block()
444 src += woinst->format.bytespervoicesample; in copy_ilv_block()
447 len -= woinst->format.bytespervoicesample; in copy_ilv_block()
449 pgoff += woinst->format.bytespervoicesample; in copy_ilv_block()
463 static void fill_block(struct woinst *woinst, u32 str, u8 data, u32 len) in fill_block() argument
468 struct emu_voice *voice = woinst->voice; in fill_block()
476 for (voice_num = 0; voice_num < woinst->num_voices; voice_num++) in fill_block()
481 for (voice_num = 0; voice_num < woinst->num_voices; voice_num++) in fill_block()
487 for (voice_num = 0; voice_num < woinst->num_voices; voice_num++) in fill_block()
491 for (voice_num = 0; voice_num < woinst->num_voices; voice_num++) in fill_block()
503 void emu10k1_waveout_xferdata(struct woinst *woinst, u8 *data, u32 *size) in emu10k1_waveout_xferdata() argument
505 struct waveout_buffer *buffer = &woinst->buffer; in emu10k1_waveout_xferdata()
506 struct voice_mem *mem = &woinst->voice[0].mem; in emu10k1_waveout_xferdata()
516 spin_lock_irqsave(&woinst->lock, flags); in emu10k1_waveout_xferdata()
526 spin_unlock_irqrestore(&woinst->lock, flags); in emu10k1_waveout_xferdata()
531 if (woinst->num_voices > 1) { in emu10k1_waveout_xferdata()
532 copy_ilv_block(woinst, start, data, sizetocopy_now); in emu10k1_waveout_xferdata()
533 copy_ilv_block(woinst, 0, data + sizetocopy_now * woinst->num_voices, sizetocopy); in emu10k1_waveout_xferdata()
539 if (woinst->num_voices > 1) in emu10k1_waveout_xferdata()
540 copy_ilv_block(woinst, start, data, sizetocopy); in emu10k1_waveout_xferdata()
553 void emu10k1_waveout_fillsilence(struct woinst *woinst) in emu10k1_waveout_fillsilence() argument
555 struct waveout_buffer *buffer = &woinst->buffer; in emu10k1_waveout_fillsilence()
562 if (woinst->format.bitsperchannel == 16) in emu10k1_waveout_fillsilence()
567 spin_lock_irqsave(&woinst->lock, flags); in emu10k1_waveout_fillsilence()
573 spin_unlock_irqrestore(&woinst->lock, flags); in emu10k1_waveout_fillsilence()
579 fill_block(woinst, start, filldata, sizetocopy_now); in emu10k1_waveout_fillsilence()
580 fill_block(woinst, 0, filldata, sizetocopy); in emu10k1_waveout_fillsilence()
582 fill_block(woinst, start, filldata, sizetocopy); in emu10k1_waveout_fillsilence()
595 void emu10k1_waveout_update(struct woinst *woinst) in emu10k1_waveout_update() argument
601 if (!(woinst->state & WAVE_STATE_STARTED)) { in emu10k1_waveout_update()
602 hw_pos = woinst->buffer.hw_pos; in emu10k1_waveout_update()
605 hw_pos = sblive_readptr(woinst->voice[0].card, CCCA_CURRADDR, woinst->voice[0].num); in emu10k1_waveout_update()
607 if(hw_pos < woinst->voice[0].start) in emu10k1_waveout_update()
608 hw_pos += woinst->buffer.size / woinst->format.bytespervoicesample - woinst->voice[0].start; in emu10k1_waveout_update()
610 hw_pos -= woinst->voice[0].start; in emu10k1_waveout_update()
612 hw_pos *= woinst->format.bytespervoicesample; in emu10k1_waveout_update()
615 diff = (woinst->buffer.size + hw_pos - woinst->buffer.hw_pos) % woinst->buffer.size; in emu10k1_waveout_update()
616 woinst->total_played += diff; in emu10k1_waveout_update()
617 woinst->buffer.free_bytes += diff; in emu10k1_waveout_update()
618 woinst->buffer.hw_pos = hw_pos; in emu10k1_waveout_update()