Home | History | Annotate | Download | only in audio

Lines Matching defs:hw

25 #include "hw/hw.h"
38 HWVoiceOut hw;
58 static int wav_out_run (HWVoiceOut *hw, int live)
60 WAVVoiceOut *wav = (WAVVoiceOut *) hw;
67 muldiv64 (ticks, hw->info.bytes_per_second, get_ticks_per_sec ());
70 samples = INT_MAX >> hw->info.shift;
73 samples = bytes >> hw->info.shift;
79 rpos = hw->rpos;
81 int left_till_end_samples = hw->samples - rpos;
84 src = hw->mix_buf + rpos;
85 dst = advance (wav->pcm_buf, rpos << hw->info.shift);
87 hw->clip (dst, src, convert_samples);
88 qemu_put_buffer (wav->f, dst, convert_samples << hw->info.shift);
90 rpos = (rpos + convert_samples) % hw->samples;
95 hw->rpos = rpos;
114 static int wav_out_init (HWVoiceOut *hw, struct audsettings *as)
116 WAVVoiceOut *wav = (WAVVoiceOut *) hw;
149 audio_pcm_init_info (&hw->info, &wav_as);
151 hw->samples = 1024;
152 wav->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift);
155 hw->samples << hw->info.shift);
159 le_store (hdr + 22, hw->info.nchannels, 2);
160 le_store (hdr + 24, hw->info.freq, 4);
161 le_store (hdr + 28, hw->info.freq << (bits16 + stereo), 4);
177 static void wav_out_fini (HWVoiceOut *hw)
179 WAVVoiceOut *wav = (WAVVoiceOut *) hw;
182 uint32_t datalen = wav->total_samples << hw->info.shift;
205 static int wav_out_ctl (HWVoiceOut *hw, int cmd, ...)
207 (void) hw;
225 HWVoiceIn hw;
247 wav_in_init (HWVoiceIn *hw, struct audsettings *as)
249 WAVVoiceIn* wav = (WAVVoiceIn *) hw;
314 audio_pcm_init_info (&hw->info, &wav_as);
316 hw->samples = 1024;
317 wav->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift);
330 static void wav_in_fini (HWVoiceIn *hw)
332 WAVVoiceIn *wav = (WAVVoiceIn *) hw;
345 static int wav_in_run (HWVoiceIn *hw)
347 WAVVoiceIn* wav = (WAVVoiceIn *) hw;
354 int64_t bytes = muldiv64(ticks, hw->info.bytes_per_second, get_ticks_per_sec());
357 samples = INT_MAX >> hw->info.shift;
360 samples = bytes >> hw->info.shift;
363 live = audio_pcm_hw_get_live_in (hw);
372 wpos = hw->wpos;
374 int left_till_end_samples = hw->samples - wpos;
377 dst = hw->conv_buf + wpos;
378 src = advance (wav->pcm_buf, wpos << hw->info.shift);
380 qemu_get_buffer (wav->f, src, convert_samples << hw->info.shift);
381 memcpy (dst, src, convert_samples << hw->info.shift);
383 wpos = (wpos + convert_samples) % hw->samples;
388 hw->wpos = wpos;
397 static int wav_in_ctl (HWVoiceIn *hw, int cmd, ...)
399 (void) hw;