http://bugs.winehq.org/show_bug.cgi?id=14717
--- Comment #150 from Raymond superquad.vortex2@gmail.com 2011-02-21 21:44:31 CST --- Just give another example of sound card which only support 48000Hz (e.g. sb0220 )
static struct snd_pcm_hardware snd_emu10k1x_playback_hw = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_MMAP_VALID), .formats = SNDRV_PCM_FMTBIT_S16_LE, .rates = SNDRV_PCM_RATE_48000, .rate_min = 48000, .rate_max = 48000, .channels_min = 2, .channels_max = 2, .buffer_bytes_max = (32*1024), .period_bytes_min = 64, .period_bytes_max = (16*1024), .periods_min = 2, .periods_max = 8, .fifo_size = 0, };
if you look at winealsa.drv/dsoutput.c , you should notice that emu10k1x only can have 8 periods, but dsoutput.c assume all sound cards support 16 periods
snd_pcm_hw_params_set_periods_integer(pcm, hw_params); snd_pcm_hw_params_set_buffer_time_near(pcm, hw_params, &buffer_time, NULL); buffer_time = 10000; snd_pcm_hw_params_set_period_time_near(pcm, hw_params, &buffer_time, NULL);
err = snd_pcm_hw_params_get_period_size(hw_params, &psize, NULL); buffer_time = 16; snd_pcm_hw_params_set_periods_near(pcm, hw_params, &buffer_time, NULL);
if (!This->mmap) { HeapFree(GetProcessHeap(), 0, This->mmap_buffer); This->mmap_buffer = NULL; }
err = snd_pcm_hw_params_set_access (pcm, hw_params, SND_PCM_ACCESS_MMAP_INTERLEAVED); if (err >= 0) This->mmap = 1; else { This->mmap = 0; err = snd_pcm_hw_params_set_access (pcm, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED); }
err = snd_pcm_hw_params(pcm, hw_params);
/* ALSA needs at least 3 buffers to work successfully */ This->mmap_commitahead = 3 * psize; while (This->mmap_commitahead <= 512) This->mmap_commitahead += psize;